Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6c808f80
authored
Aug 26, 2023
by
JustSong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support 360's models (close #331, close #461)
feat: support 360's models (close #331, close #461)
parent
574be5bd
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
101 additions
and
40 deletions
+101
-40
README.md
+1
-0
common/constants.go
+2
-0
common/model-ratio.go
+45
-40
controller/channel-test.go
+4
-0
controller/model.go
+45
-0
web/src/constants/channel.constants.js
+1
-0
web/src/pages/Channel/EditChannel.js
+3
-0
No files found.
README.md
View file @
6c808f80
...
@@ -68,6 +68,7 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用
...
@@ -68,6 +68,7 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用
+
[
x
]
[
阿里通义千问系列模型
]
(https://help.aliyun.com/document_detail/2400395.html)
+
[
x
]
[
阿里通义千问系列模型
]
(https://help.aliyun.com/document_detail/2400395.html)
+
[
x
]
[
讯飞星火认知大模型
]
(https://www.xfyun.cn/doc/spark/Web.html)
+
[
x
]
[
讯飞星火认知大模型
]
(https://www.xfyun.cn/doc/spark/Web.html)
+
[
x
]
[
智谱 ChatGLM 系列模型
]
(https://bigmodel.cn)
+
[
x
]
[
智谱 ChatGLM 系列模型
]
(https://bigmodel.cn)
+
[
x
]
[
360 智脑
]
(https://ai.360.cn)
2.
支持配置镜像以及众多第三方代理服务:
2.
支持配置镜像以及众多第三方代理服务:
+
[
x
]
[
OpenAI-SB
]
(https://openai-sb.com)
+
[
x
]
[
OpenAI-SB
]
(https://openai-sb.com)
+
[
x
]
[
API2D
]
(https://api2d.com/r/197971)
+
[
x
]
[
API2D
]
(https://api2d.com/r/197971)
...
...
common/constants.go
View file @
6c808f80
...
@@ -173,6 +173,7 @@ const (
...
@@ -173,6 +173,7 @@ const (
ChannelTypeZhipu
=
16
ChannelTypeZhipu
=
16
ChannelTypeAli
=
17
ChannelTypeAli
=
17
ChannelTypeXunfei
=
18
ChannelTypeXunfei
=
18
ChannelType360
=
19
)
)
var
ChannelBaseURLs
=
[]
string
{
var
ChannelBaseURLs
=
[]
string
{
...
@@ -195,4 +196,5 @@ var ChannelBaseURLs = []string{
...
@@ -195,4 +196,5 @@ var ChannelBaseURLs = []string{
"https://open.bigmodel.cn"
,
// 16
"https://open.bigmodel.cn"
,
// 16
"https://dashscope.aliyuncs.com"
,
// 17
"https://dashscope.aliyuncs.com"
,
// 17
""
,
// 18
""
,
// 18
"https://ai.360.cn"
,
// 19
}
}
common/model-ratio.go
View file @
6c808f80
...
@@ -13,46 +13,51 @@ import (
...
@@ -13,46 +13,51 @@ import (
// 1 === $0.002 / 1K tokens
// 1 === $0.002 / 1K tokens
// 1 === ¥0.014 / 1k tokens
// 1 === ¥0.014 / 1k tokens
var
ModelRatio
=
map
[
string
]
float64
{
var
ModelRatio
=
map
[
string
]
float64
{
"gpt-4"
:
15
,
"gpt-4"
:
15
,
"gpt-4-0314"
:
15
,
"gpt-4-0314"
:
15
,
"gpt-4-0613"
:
15
,
"gpt-4-0613"
:
15
,
"gpt-4-32k"
:
30
,
"gpt-4-32k"
:
30
,
"gpt-4-32k-0314"
:
30
,
"gpt-4-32k-0314"
:
30
,
"gpt-4-32k-0613"
:
30
,
"gpt-4-32k-0613"
:
30
,
"gpt-3.5-turbo"
:
0.75
,
// $0.0015 / 1K tokens
"gpt-3.5-turbo"
:
0.75
,
// $0.0015 / 1K tokens
"gpt-3.5-turbo-0301"
:
0.75
,
"gpt-3.5-turbo-0301"
:
0.75
,
"gpt-3.5-turbo-0613"
:
0.75
,
"gpt-3.5-turbo-0613"
:
0.75
,
"gpt-3.5-turbo-16k"
:
1.5
,
// $0.003 / 1K tokens
"gpt-3.5-turbo-16k"
:
1.5
,
// $0.003 / 1K tokens
"gpt-3.5-turbo-16k-0613"
:
1.5
,
"gpt-3.5-turbo-16k-0613"
:
1.5
,
"text-ada-001"
:
0.2
,
"text-ada-001"
:
0.2
,
"text-babbage-001"
:
0.25
,
"text-babbage-001"
:
0.25
,
"text-curie-001"
:
1
,
"text-curie-001"
:
1
,
"text-davinci-002"
:
10
,
"text-davinci-002"
:
10
,
"text-davinci-003"
:
10
,
"text-davinci-003"
:
10
,
"text-davinci-edit-001"
:
10
,
"text-davinci-edit-001"
:
10
,
"code-davinci-edit-001"
:
10
,
"code-davinci-edit-001"
:
10
,
"whisper-1"
:
10
,
"whisper-1"
:
10
,
"davinci"
:
10
,
"davinci"
:
10
,
"curie"
:
10
,
"curie"
:
10
,
"babbage"
:
10
,
"babbage"
:
10
,
"ada"
:
10
,
"ada"
:
10
,
"text-embedding-ada-002"
:
0.05
,
"text-embedding-ada-002"
:
0.05
,
"text-search-ada-doc-001"
:
10
,
"text-search-ada-doc-001"
:
10
,
"text-moderation-stable"
:
0.1
,
"text-moderation-stable"
:
0.1
,
"text-moderation-latest"
:
0.1
,
"text-moderation-latest"
:
0.1
,
"dall-e"
:
8
,
"dall-e"
:
8
,
"claude-instant-1"
:
0.815
,
// $1.63 / 1M tokens
"claude-instant-1"
:
0.815
,
// $1.63 / 1M tokens
"claude-2"
:
5.51
,
// $11.02 / 1M tokens
"claude-2"
:
5.51
,
// $11.02 / 1M tokens
"ERNIE-Bot"
:
0.8572
,
// ¥0.012 / 1k tokens
"ERNIE-Bot"
:
0.8572
,
// ¥0.012 / 1k tokens
"ERNIE-Bot-turbo"
:
0.5715
,
// ¥0.008 / 1k tokens
"ERNIE-Bot-turbo"
:
0.5715
,
// ¥0.008 / 1k tokens
"Embedding-V1"
:
0.1429
,
// ¥0.002 / 1k tokens
"Embedding-V1"
:
0.1429
,
// ¥0.002 / 1k tokens
"PaLM-2"
:
1
,
"PaLM-2"
:
1
,
"chatglm_pro"
:
0.7143
,
// ¥0.01 / 1k tokens
"chatglm_pro"
:
0.7143
,
// ¥0.01 / 1k tokens
"chatglm_std"
:
0.3572
,
// ¥0.005 / 1k tokens
"chatglm_std"
:
0.3572
,
// ¥0.005 / 1k tokens
"chatglm_lite"
:
0.1429
,
// ¥0.002 / 1k tokens
"chatglm_lite"
:
0.1429
,
// ¥0.002 / 1k tokens
"qwen-v1"
:
0.8572
,
// TBD: https://help.aliyun.com/document_detail/2399482.html?spm=a2c4g.2399482.0.0.1ad347feilAgag
"qwen-v1"
:
0.8572
,
// TBD: https://help.aliyun.com/document_detail/2399482.html?spm=a2c4g.2399482.0.0.1ad347feilAgag
"qwen-plus-v1"
:
0.5715
,
// Same as above
"qwen-plus-v1"
:
0.5715
,
// Same as above
"SparkDesk"
:
0.8572
,
// TBD
"SparkDesk"
:
0.8572
,
// TBD
"360GPT_S2_V9"
:
0.8572
,
// ¥0.012 / 1k tokens
"embedding-bert-512-v1"
:
0.0715
,
// ¥0.001 / 1k tokens
"embedding_s1_v1"
:
0.0715
,
// ¥0.001 / 1k tokens
"semantic_similarity_s1_v1"
:
0.0715
,
// ¥0.001 / 1k tokens
"360GPT_S2_V9.4"
:
0.8572
,
// ¥0.012 / 1k tokens
}
}
func
ModelRatio2JSONString
()
string
{
func
ModelRatio2JSONString
()
string
{
...
...
controller/channel-test.go
View file @
6c808f80
...
@@ -24,6 +24,10 @@ func testChannel(channel *model.Channel, request ChatRequest) (error, *OpenAIErr
...
@@ -24,6 +24,10 @@ func testChannel(channel *model.Channel, request ChatRequest) (error, *OpenAIErr
fallthrough
fallthrough
case
common
.
ChannelTypeZhipu
:
case
common
.
ChannelTypeZhipu
:
fallthrough
fallthrough
case
common
.
ChannelTypeAli
:
fallthrough
case
common
.
ChannelType360
:
fallthrough
case
common
.
ChannelTypeXunfei
:
case
common
.
ChannelTypeXunfei
:
return
errors
.
New
(
"该渠道类型当前版本不支持测试,请手动测试"
),
nil
return
errors
.
New
(
"该渠道类型当前版本不支持测试,请手动测试"
),
nil
case
common
.
ChannelTypeAzure
:
case
common
.
ChannelTypeAzure
:
...
...
controller/model.go
View file @
6c808f80
...
@@ -360,6 +360,51 @@ func init() {
...
@@ -360,6 +360,51 @@ func init() {
Root
:
"SparkDesk"
,
Root
:
"SparkDesk"
,
Parent
:
nil
,
Parent
:
nil
,
},
},
{
Id
:
"360GPT_S2_V9"
,
Object
:
"model"
,
Created
:
1677649963
,
OwnedBy
:
"360"
,
Permission
:
permission
,
Root
:
"360GPT_S2_V9"
,
Parent
:
nil
,
},
{
Id
:
"embedding-bert-512-v1"
,
Object
:
"model"
,
Created
:
1677649963
,
OwnedBy
:
"360"
,
Permission
:
permission
,
Root
:
"embedding-bert-512-v1"
,
Parent
:
nil
,
},
{
Id
:
"embedding_s1_v1"
,
Object
:
"model"
,
Created
:
1677649963
,
OwnedBy
:
"360"
,
Permission
:
permission
,
Root
:
"embedding_s1_v1"
,
Parent
:
nil
,
},
{
Id
:
"semantic_similarity_s1_v1"
,
Object
:
"model"
,
Created
:
1677649963
,
OwnedBy
:
"360"
,
Permission
:
permission
,
Root
:
"semantic_similarity_s1_v1"
,
Parent
:
nil
,
},
{
Id
:
"360GPT_S2_V9.4"
,
Object
:
"model"
,
Created
:
1677649963
,
OwnedBy
:
"360"
,
Permission
:
permission
,
Root
:
"360GPT_S2_V9.4"
,
Parent
:
nil
,
},
}
}
openAIModelsMap
=
make
(
map
[
string
]
OpenAIModels
)
openAIModelsMap
=
make
(
map
[
string
]
OpenAIModels
)
for
_
,
model
:=
range
openAIModels
{
for
_
,
model
:=
range
openAIModels
{
...
...
web/src/constants/channel.constants.js
View file @
6c808f80
...
@@ -7,6 +7,7 @@ export const CHANNEL_OPTIONS = [
...
@@ -7,6 +7,7 @@ export const CHANNEL_OPTIONS = [
{
key
:
17
,
text
:
'阿里通义千问'
,
value
:
17
,
color
:
'orange'
},
{
key
:
17
,
text
:
'阿里通义千问'
,
value
:
17
,
color
:
'orange'
},
{
key
:
18
,
text
:
'讯飞星火认知'
,
value
:
18
,
color
:
'blue'
},
{
key
:
18
,
text
:
'讯飞星火认知'
,
value
:
18
,
color
:
'blue'
},
{
key
:
16
,
text
:
'智谱 ChatGLM'
,
value
:
16
,
color
:
'violet'
},
{
key
:
16
,
text
:
'智谱 ChatGLM'
,
value
:
16
,
color
:
'violet'
},
{
key
:
19
,
text
:
'360 智脑'
,
value
:
19
,
color
:
'blue'
},
{
key
:
8
,
text
:
'自定义渠道'
,
value
:
8
,
color
:
'pink'
},
{
key
:
8
,
text
:
'自定义渠道'
,
value
:
8
,
color
:
'pink'
},
{
key
:
2
,
text
:
'代理:API2D'
,
value
:
2
,
color
:
'blue'
},
{
key
:
2
,
text
:
'代理:API2D'
,
value
:
2
,
color
:
'blue'
},
{
key
:
5
,
text
:
'代理:OpenAI-SB'
,
value
:
5
,
color
:
'brown'
},
{
key
:
5
,
text
:
'代理:OpenAI-SB'
,
value
:
5
,
color
:
'brown'
},
...
...
web/src/pages/Channel/EditChannel.js
View file @
6c808f80
...
@@ -61,6 +61,9 @@ const EditChannel = () => {
...
@@ -61,6 +61,9 @@ const EditChannel = () => {
case
18
:
case
18
:
localModels
=
[
'SparkDesk'
];
localModels
=
[
'SparkDesk'
];
break
;
break
;
case
19
:
localModels
=
[
'360GPT_S2_V9'
,
'embedding-bert-512-v1'
,
'embedding_s1_v1'
,
'semantic_similarity_s1_v1'
,
'360GPT_S2_V9.4'
]
break
;
}
}
setInputs
((
inputs
)
=>
({
...
inputs
,
models
:
localModels
}));
setInputs
((
inputs
)
=>
({
...
inputs
,
models
:
localModels
}));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment