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
7c2be8ae
authored
2024-05-10 13:15:33 +0800
by
Leff Tubat
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Update
1 parent
43b5f469
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
index.js
index.js
View file @
7c2be8a
...
...
@@ -79,11 +79,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
;
if
(
currentModel
==
"gpt-3.5-turbo"
||
currentModel
==
"gpt-3.5-turbo-0301"
)
{
...
...
@@ -152,7 +152,7 @@ app.post('/api', async (req, res) => {
console
.
log
(
'Error encoding prompt text'
,
e
);
}
let
usage_params
=
{
aiwp_logged_in
,
app
:
'chatbot+'
,
prompt_token
:
usage
.
prompt_tokens
,
total_token
:
usage
.
total_tokens
,
aiwp_app_id
,
usage_tries
:
TRIED_USAGE
"aiwp_logged_in"
:
aiwp_logged_in
,
"app"
:
"chatbot+"
,
"prompt_token"
:
usage
.
prompt_tokens
,
"total_token"
:
usage
.
total_tokens
,
"aiwp_app_id"
:
aiwp_app_id
,
"usage_tries"
:
TRIED_USAGE
};
if
(
IS_FREE_USER
)
{
await
setUsage
(
usage_params
);
...
...
@@ -234,7 +234,7 @@ async function runGPTTurbo(req, res) {
console
.
log
(
'Error encoding prompt text'
,
e
);
}
let
usage_params
=
{
aiwp_logged_in
,
app
:
'chatbot+'
,
prompt_token
:
usage
.
prompt_tokens
,
total_token
:
usage
.
total_tokens
,
aiwp_app_id
,
usage_tries
:
TRIED_USAGE
"aiwp_logged_in"
:
aiwp_logged_in
,
"app"
:
"chatbot+"
,
"prompt_token"
:
usage
.
prompt_tokens
,
"total_token"
:
usage
.
total_tokens
,
"aiwp_app_id"
:
aiwp_app_id
,
"usage_tries"
:
TRIED_USAGE
};
if
(
IS_FREE_USER
)
{
await
setUsage
(
usage_params
);
...
...
@@ -321,7 +321,7 @@ async function runOpensource(req, res) {
console
.
log
(
'Error encoding prompt text'
,
e
);
}
let
usage_params
=
{
aiwp_logged_in
,
app
:
'chatbot+'
,
prompt_token
:
usage
.
prompt_tokens
,
total_token
:
usage
.
total_tokens
,
aiwp_app_id
,
usage_tries
:
TRIED_USAGE
"aiwp_logged_in"
:
aiwp_logged_in
,
"app"
:
"chatbot+"
,
"prompt_token"
:
usage
.
prompt_tokens
,
"total_token"
:
usage
.
total_tokens
,
"aiwp_app_id"
:
aiwp_app_id
,
"usage_tries"
:
TRIED_USAGE
};
if
(
IS_FREE_USER
)
{
await
setUsage
(
usage_params
);
...
...
@@ -346,7 +346,6 @@ async function runOpensource(req, res) {
}
async
function
authenticate
(
params
)
{
console
.
log
(
"params"
,
params
);
let
data
=
await
fetch
(
`
${
hostapi
}
/e/authenticate/v2`
,
{
method
:
"POST"
,
headers
:
{
...
...
@@ -438,7 +437,7 @@ async function validation (aiwp_app_id, req, res) {
}
else
{
IS_FREE_USER
=
true
;
let
data
=
await
getLimitedUsage
({
aiwp_app_id
"aiwp_app_id"
:
aiwp_app_id
});
if
(
data
.
usage
!==
null
)
{
...
...
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