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
e45cfbc0
authored
2024-08-12 18:40:01 +0800
by
Jonille Arreglo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
31675_chatbotplus_llm
1 parent
4fa0b1d3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
client/src/App.js
index.js
client/src/App.js
View file @
e45cfbc
...
...
@@ -48,14 +48,14 @@ function App() {
return
0
;
});
let
model_list
=
[];
for
(
var
i
=
1
;
i
<
data
.
models
.
data
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
data
.
models
.
data
.
length
;
i
++
)
{
let
model
=
data
.
models
.
data
[
i
];
if
(
!
(
model
.
id
===
"whisper-1"
||
model
.
id
===
"gpt-4"
||
model
.
id
===
"gpt-4-0314"
||
model
.
id
===
"gpt-4-0613"
)
)
model_list
.
push
(
model
);
}
setModels
(
model_list
)
setModels
(
model_list
)
;
})
}
...
...
@@ -104,7 +104,8 @@ function App() {
messages
=
JSON
.
stringify
(
chatLogTurboNew
);
}
if
(
currentModel
===
"openchat_3.5"
||
currentModel
===
"zephyr-7B-beta"
)
{
if
(
currentModel
===
"openchat_3.5"
||
currentModel
===
"zephyr-7B-beta"
||
currentModel
===
"meta-llama/Llama-3-8b-chat-hf"
||
currentModel
===
"google/gemma-7b-it"
)
{
// "gpt-3.5-turbo"
let
chatLogOpenSourceNew
=
[...
chatLogOpenSource
,
{
role
:
"user"
,
content
:
chatInput
}];
setChatLogOpenSource
(
chatLogOpenSourceNew
);
...
...
@@ -150,7 +151,7 @@ function App() {
});
userModifiedInput
=
""
;
}
chatLogTurboNew
.
push
({
role
:
"user"
,
content
:
userModifiedInput
});
chatLogTurboNew
.
push
({
role
:
"assistant"
,
content
:
parsedData
});
...
...
index.js
View file @
e45cfbc
...
...
@@ -92,7 +92,9 @@ app.post('/api', async (req, res) => {
return
;
}
if
(
currentModel
==
"openchat_3.5"
||
currentModel
==
"zephyr-7B-beta"
)
{
if
(
currentModel
==
"openchat_3.5"
||
currentModel
==
"zephyr-7B-beta"
||
currentModel
==
"google/gemma-7b-it"
||
currentModel
==
"meta-llama/Llama-3-8b-chat-hf"
)
{
runOpensource
(
req
,
res
);
return
;
...
...
@@ -284,6 +286,7 @@ async function runOpensource(req, res) {
const
endpoint_api_url
=
get_endpoint_api_url
(
currentModel
);
const
api_key
=
get_endpoint_api_key
(
currentModel
);
const
response
=
await
axios
.
post
(
endpoint_api_url
+
'/chat/completions'
,
{
model
:
currentModel
,
messages
:
JSON
.
parse
(
message
),
temperature
},
{
...
...
@@ -465,7 +468,7 @@ async function validation (aiwp_app_id, req, res) {
app
.
get
(
'/models'
,
async
(
req
,
res
)
=>
{
const
response
=
await
openai
.
listModels
();
const
models
=
response
.
data
;
const
opensource_models
=
process
.
env
.
OPENSOURCE_MODELS
?
process
.
env
.
OPENSOURCE_MODELS
.
split
(
','
)
:
[];
const
opensource_models
=
process
.
env
.
OPENSOURCE_MODELS
?
JSON
.
parse
(
process
.
env
.
OPENSOURCE_MODELS
)
:
[];
models
.
data
=
models
.
data
.
filter
((
model
)
=>
{
return
model
.
id
.
indexOf
(
'gpt-3'
)
===
0
...
...
@@ -473,7 +476,8 @@ app.get('/models', async (req, res) => {
opensource_models
.
forEach
((
model
)
=>
{
models
.
data
.
push
({
id
:
model
,
id
:
model
.
value
,
label
:
model
.
label
,
beta
:
true
,
});
})
...
...
@@ -491,7 +495,7 @@ app.get('/models', async (req, res) => {
}
else
if
(
model
.
id
==
'dall-e-3'
)
{
model
.
name
=
'DALL-E 3'
;
}
else
{
model
.
name
=
model
.
id
;
model
.
name
=
model
.
label
?
model
.
label
:
model
.
id
;
}
})
...
...
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