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
296bbfa6
authored
2023-11-22 17:22:38 +0800
by
Jerald Lim
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
opensource
1 parent
34d94fa0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
6 deletions
client/package-lock.json
client/src/App.js
env-template
index.js
package-lock.json
client/package-lock.json
View file @
296bbfa
This diff is collapsed.
Click to expand it.
client/src/App.js
View file @
296bbfa
...
...
@@ -28,9 +28,12 @@ function App() {
const
[
chatLogTurbo
,
setChatLogTurbo
]
=
useState
(
defaultChatLogTurbo
);
//
const
[
chatLogOpenSource
,
setChatLogOpenSource
]
=
useState
([]);
function
clearChat
(){
setChatLog
([]);
setChatLogTurbo
(
defaultChatLogTurbo
);
setChatLogOpenSource
([]);
setChatInput
(
""
);
setStartedInteraction
(
false
);
}
...
...
@@ -94,12 +97,20 @@ function App() {
setChatLog
(
prevChatLog
=>
[...
prevChatLog
,
userMessage
]);
var
messages
=
chatLogNew
.
map
((
message
)
=>
{
if
(
message
.
user
!==
'me'
)
return
message
.
message
}).
join
(
"\n"
)
if
(
currentModel
==
GPTTurbo
||
currentModel
==
GPTTurbo0301
)
{
if
(
currentModel
==
=
GPTTurbo
||
currentModel
=
==
GPTTurbo0301
)
{
// "gpt-3.5-turbo"
let
chatLogTurboNew
=
[...
chatLogTurbo
,
{
role
:
"user"
,
content
:
chatInput
}];
setChatLogTurbo
(
chatLogTurboNew
);
messages
=
JSON
.
stringify
(
chatLogTurboNew
);
}
if
(
currentModel
===
"openchat_3.5-GPTQ"
||
currentModel
===
"zephyr-7B-beta-GPTQ"
)
{
// "gpt-3.5-turbo"
let
chatLogOpenSourceNew
=
[...
chatLogOpenSource
,
{
role
:
"user"
,
content
:
chatInput
}];
setChatLogOpenSource
(
chatLogOpenSourceNew
);
messages
=
JSON
.
stringify
(
chatLogOpenSourceNew
);
}
let
intervalId
=
startInterval
();
try
{
const
response
=
await
fetch
(
process
.
env
.
REACT_APP_SERVER_URL
+
"/api"
,
{
...
...
@@ -117,6 +128,7 @@ function App() {
const
parsedData
=
data
.
message
.
trim
();
// "gpt-3.5-turbo"
let
chatLogTurboNew
=
chatLogTurbo
;
let
chatLogOpenSourceNew
=
chatLogOpenSource
;
if
(
data
.
success
===
false
)
{
setChatLog
(
prevChatLog
=>
{
const
lastMsg
=
prevChatLog
[
prevChatLog
.
length
-
2
];
...
...
@@ -129,7 +141,11 @@ function App() {
}
chatLogTurboNew
.
push
({
role
:
"user"
,
content
:
userModifiedInput
});
chatLogTurboNew
.
push
({
role
:
"assistant"
,
content
:
parsedData
});
chatLogOpenSourceNew
.
push
({
role
:
"user"
,
content
:
userModifiedInput
});
chatLogOpenSourceNew
.
push
({
role
:
"assistant"
,
content
:
parsedData
});
setChatLogTurbo
(
chatLogTurboNew
);
setChatLogOpenSource
(
chatLogOpenSourceNew
);
//
clearInterval
(
intervalId
);
const
programmingKeywords
=
[
'code'
,
'application'
,
'controller'
,
'rails'
,
'PHP'
,
'java'
,
'javascript'
,
'script'
,
'console'
,
'python'
,
'programming'
,
'table'
];
...
...
env-template
View file @
296bbfa
OPENAI_API_ORG=
OPENAI_API_KEY=
\ No newline at end of file
OPENAI_API_KEY=
OPENSOURCE_MODELS="openchat_3.5-GPTQ,zephyr-7B-beta-GPTQ"
OPENSOURCE_ENDPOINTS={"openchat_3.5-GPTQ": "https://openchat.llm.ai-pro.org/v1", "zephyr-7B-beta-GPTQ": "https://zephyr.llm.ai-pro.org/v1"}
\ No newline at end of file
...
...
index.js
View file @
296bbfa
This diff is collapsed.
Click to expand it.
package-lock.json
View file @
296bbfa
...
...
@@ -10,11 +10,15 @@
"license"
:
"ISC"
,
"dependencies"
:
{
"anchorme"
:
"^2.1.2"
,
"axios"
:
"^1.5.1"
,
"body-parser"
:
"^1.20.1"
,
"cookie"
:
"0.5.0"
,
"cookie-parser"
:
"1.4.6"
,
"cors"
:
"^2.8.5"
,
"dotenv"
:
"^16.0.3"
,
"express"
:
"^4.18.2"
,
"express-rate-limit"
:
"^6.7.0"
,
"js-tiktoken"
:
"1.0.7"
,
"morgan"
:
"^1.10.0"
,
"openai"
:
"^3.2.0"
}
...
...
@@ -47,13 +51,34 @@
"integrity"
:
"sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/axios"
:
{
"version"
:
"
0.26.1
"
,
"resolved"
:
"https://registry.npmjs.org/axios/-/axios-
0.26.1
.tgz"
,
"integrity"
:
"sha512-
fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMe
A=="
,
"version"
:
"
1.6.2
"
,
"resolved"
:
"https://registry.npmjs.org/axios/-/axios-
1.6.2
.tgz"
,
"integrity"
:
"sha512-
7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8
A=="
,
"dependencies"
:
{
"follow-redirects"
:
"^1.14.8"
"follow-redirects"
:
"^1.15.0"
,
"form-data"
:
"^4.0.0"
,
"proxy-from-env"
:
"^1.1.0"
}
},
"node_modules/base64-js"
:
{
"version"
:
"1.5.1"
,
"resolved"
:
"https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"
,
"integrity"
:
"sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
,
"funding"
:
[
{
"type"
:
"github"
,
"url"
:
"https://github.com/sponsors/feross"
},
{
"type"
:
"patreon"
,
"url"
:
"https://www.patreon.com/feross"
},
{
"type"
:
"consulting"
,
"url"
:
"https://feross.org/support"
}
]
},
"node_modules/basic-auth"
:
{
"version"
:
"2.0.1"
,
"resolved"
:
"https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz"
,
...
...
@@ -151,6 +176,26 @@
"node"
:
">= 0.6"
}
},
"node_modules/cookie-parser"
:
{
"version"
:
"1.4.6"
,
"resolved"
:
"https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz"
,
"integrity"
:
"sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA=="
,
"dependencies"
:
{
"cookie"
:
"0.4.1"
,
"cookie-signature"
:
"1.0.6"
},
"engines"
:
{
"node"
:
">= 0.8.0"
}
},
"node_modules/cookie-parser/node_modules/cookie"
:
{
"version"
:
"0.4.1"
,
"resolved"
:
"https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz"
,
"integrity"
:
"sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA=="
,
"engines"
:
{
"node"
:
">= 0.6"
}
},
"node_modules/cookie-signature"
:
{
"version"
:
"1.0.6"
,
"resolved"
:
"https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz"
,
...
...
@@ -431,6 +476,14 @@
"node"
:
">= 0.10"
}
},
"node_modules/js-tiktoken"
:
{
"version"
:
"1.0.7"
,
"resolved"
:
"https://registry.npmjs.org/js-tiktoken/-/js-tiktoken-1.0.7.tgz"
,
"integrity"
:
"sha512-biba8u/clw7iesNEWLOLwrNGoBP2lA+hTaBLs/D45pJdUPFXyxD6nhcDVtADChghv4GgyAiMKYMiRx7x6h7Biw=="
,
"dependencies"
:
{
"base64-js"
:
"^1.5.1"
}
},
"node_modules/media-typer"
:
{
"version"
:
"0.3.0"
,
"resolved"
:
"https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz"
,
...
...
@@ -565,6 +618,14 @@
"form-data"
:
"^4.0.0"
}
},
"node_modules/openai/node_modules/axios"
:
{
"version"
:
"0.26.1"
,
"resolved"
:
"https://registry.npmjs.org/axios/-/axios-0.26.1.tgz"
,
"integrity"
:
"sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA=="
,
"dependencies"
:
{
"follow-redirects"
:
"^1.14.8"
}
},
"node_modules/parseurl"
:
{
"version"
:
"1.3.3"
,
"resolved"
:
"https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz"
,
...
...
@@ -590,6 +651,11 @@
"node"
:
">= 0.10"
}
},
"node_modules/proxy-from-env"
:
{
"version"
:
"1.1.0"
,
"resolved"
:
"https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz"
,
"integrity"
:
"sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
},
"node_modules/qs"
:
{
"version"
:
"6.11.0"
,
"resolved"
:
"https://registry.npmjs.org/qs/-/qs-6.11.0.tgz"
,
...
...
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