7db45447 by Janis

Merge branch '28859_integrate_llm_chatbot_plus' into 'master'

opensource

See merge request !81
2 parents 34d94fa0 7e30965a
......@@ -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'];
......
......@@ -33,7 +33,7 @@ const SideMenu = ({
{models && models.length ? (
models.map((model, index) => (
<option key={model.id} value={model.id}>
{model.id}
{model.id} {model.beta ? "(beta)" : ""}
</option>
))
) : (
......
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
......
......@@ -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/sGKNaD8YaMeA==",
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz",
"integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==",
"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",
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!