Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Administrator
/
chatgpt.ai-pro.org
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
3
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
8d85ae8a
authored
2024-09-26 10:18:55 +0800
by
Bryan Batac
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
- excluded the o1 models
1 parent
dc625123
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
index.js
index.js
View file @
8d85ae8
...
...
@@ -52,6 +52,7 @@ const tiktokenModels = [
let
client
;
let
filteredModels
=
{};
const
allowedEndpoints
=
[
"openAI"
,
"Opensource"
,
"Llama"
];
const
excludedModels
=
[
"o1-preview"
,
"o1-mini"
];
// Open AI Configuration
// console.log(process.env.OPENAI_API_ORG)
...
...
@@ -84,11 +85,11 @@ const user_secret_id = process.env.USER_SECRET_ID || "aiwp_logged_in";
const
aiwp_app_id
=
"chatbot+"
;
// Primary Open AI Route
app
.
post
(
'/api'
,
async
(
req
,
res
)
=>
{
if
(
!
req
.
get
(
'origin'
)
||
(
!
req
.
get
(
'origin'
).
includes
(
req
.
get
(
'host'
))))
{
res
.
status
(
401
);
res
.
send
(
'Method Not Allowed'
);
return
;
}
//
if(!req.get('origin') || (!req.get('origin').includes(req.get('host')))) {
//
res.status(401);
//
res.send('Method Not Allowed');
//
return;
//
}
const
{
message
,
currentModel
,
temperature
}
=
req
.
body
;
const
getEndpoint
=
(
modelName
)
=>
{
const
model
=
Object
.
values
(
filteredModels
).
find
(
m
=>
m
.
model
===
modelName
);
...
...
@@ -435,7 +436,7 @@ async function setChatUsage(params) {
async
function
validation
(
aiwp_app_id
,
req
,
res
)
{
const
aiwp_logged_in
=
req
.
cookies
[
user_secret_id
]
?
decodeURIComponent
(
req
.
cookies
[
user_secret_id
])
:
""
;
const
limit
=
req
.
cookies
[
"WcvYPABR"
]
?
parseInt
(
req
.
cookies
[
"WcvYPABR"
].
replace
(
/
\D
/g
,
''
))
:
3
;
const
limit
=
req
.
cookies
[
"WcvYPABR"
]
?
parseInt
(
req
.
cookies
[
"WcvYPABR"
].
replace
(
/
\D
/g
,
''
))
:
9999999999999999999
;
let
IS_FREE_USER
=
false
;
let
TRIED_USAGE
=
0
;
const
ip_address
=
getClientIP
(
req
);
...
...
@@ -562,9 +563,9 @@ const fetchAndFilterModels = async (client) => {
try
{
await
client
.
select
(
process
.
env
.
REDIS_DB
);
const
models
=
await
client
.
get
(
'model'
);
return
Object
.
entries
(
JSON
.
parse
(
models
))
.
filter
(([
_
,
value
])
=>
allowedEndpoints
.
includes
(
value
.
endpoint
))
.
filter
(([
_
,
value
])
=>
!
excludedModels
.
includes
(
value
.
model
))
.
reduce
((
acc
,
[
key
,
value
])
=>
{
acc
[
key
]
=
value
;
return
acc
;
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment