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
3045995a
authored
2024-09-04 12:30:36 +0800
by
Jerald Lim
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
remove models
1 parent
78963d5d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
22 deletions
index.js
index.js
View file @
3045995
...
...
@@ -466,41 +466,31 @@ async function validation (aiwp_app_id, req, res) {
// Get Models Route
app
.
get
(
'/models'
,
async
(
req
,
res
)
=>
{
const
response
=
await
openai
.
listModels
();
const
models
=
response
.
data
;
const
openai_models
=
process
.
env
.
OPENAI_MODELS
?
JSON
.
parse
(
process
.
env
.
OPENAI_MODELS
)
:
[{
"value"
:
"gpt-3.5-turbo"
,
"label"
:
"GPT-3.5"
}];
const
opensource_models
=
process
.
env
.
OPENSOURCE_MODELS
?
JSON
.
parse
(
process
.
env
.
OPENSOURCE_MODELS
)
:
[];
const
excluded_models
=
process
.
env
.
EXCLUDED_MODELS
?
String
(
process
.
env
.
EXCLUDED_MODELS
).
split
(
','
)
:
[];
const
models
=
{
data
:
[]
};
models
.
data
=
models
.
data
.
filter
((
model
)
=>
{
return
model
.
id
.
indexOf
(
'gpt-3'
)
===
0
&&
!
excluded_models
.
includes
(
model
.
id
)
openai_models
.
forEach
((
model
)
=>
{
models
.
data
.
push
({
id
:
model
.
value
,
label
:
model
.
label
,
name
:
model
.
label
,
beta
:
false
,
});
})
opensource_models
.
forEach
((
model
)
=>
{
models
.
data
.
push
({
id
:
model
.
value
,
label
:
model
.
label
,
name
:
model
.
label
,
beta
:
true
,
});
})
const
months
=
[
"JAN"
,
"FEB"
,
"MAR"
,
"APR"
,
"MAY"
,
"JUN"
,
"JUL"
,
"AUG"
,
"SEP"
,
"OCT"
,
"NOV"
,
"DEC"
];
// add name
models
.
data
.
forEach
((
model
)
=>
{
if
(
model
.
id
.
includes
(
'gpt-3'
))
{
const
d
=
new
Date
(
model
.
created
*
1000
);
let
month
=
months
[
d
.
getMonth
()];
model
.
name
=
'GPT-3.5 '
+
month
+
' '
+
d
.
getDate
();
}
else
if
(
model
.
id
==
'dall-e-2'
)
{
model
.
name
=
'DALL-E 2'
;
}
else
if
(
model
.
id
==
'dall-e-3'
)
{
model
.
name
=
'DALL-E 3'
;
}
else
{
model
.
name
=
model
.
label
?
model
.
label
:
model
.
id
;
}
})
res
.
json
({
models
})
...
...
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