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
1800e0ae
authored
Mar 12, 2025
by
1808837298@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(relay): Add Xinference channel support
parent
215e768c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
28 additions
and
5 deletions
+28
-5
common/constants.go
+2
-0
relay/channel/openai/adaptor.go
+5
-0
relay/channel/xinference/constant.go
+7
-0
relay/constant/api_type.go
+3
-0
relay/relay_adaptor.go
+2
-2
web/src/constants/channel.constants.js
+9
-3
No files found.
common/constants.go
View file @
1800e0ae
...
...
@@ -235,6 +235,7 @@ const (
ChannelTypeMokaAI
=
44
ChannelTypeVolcEngine
=
45
ChannelTypeBaiduV2
=
46
ChannelTypeXinference
=
47
ChannelTypeDummy
// this one is only for count, do not add any channel after this
)
...
...
@@ -287,4 +288,5 @@ var ChannelBaseURLs = []string{
"https://api.moka.ai"
,
//44
"https://ark.cn-beijing.volces.com"
,
//45
"https://qianfan.baidubce.com"
,
//46
""
,
//47
}
relay/channel/openai/adaptor.go
View file @
1800e0ae
...
...
@@ -18,6 +18,7 @@ import (
"one-api/relay/channel/lingyiwanwu"
"one-api/relay/channel/minimax"
"one-api/relay/channel/moonshot"
"one-api/relay/channel/xinference"
relaycommon
"one-api/relay/common"
"one-api/relay/constant"
"strings"
...
...
@@ -251,6 +252,8 @@ func (a *Adaptor) GetModelList() []string {
return
lingyiwanwu
.
ModelList
case
common
.
ChannelTypeMiniMax
:
return
minimax
.
ModelList
case
common
.
ChannelTypeXinference
:
return
xinference
.
ModelList
default
:
return
ModelList
}
...
...
@@ -266,6 +269,8 @@ func (a *Adaptor) GetChannelName() string {
return
lingyiwanwu
.
ChannelName
case
common
.
ChannelTypeMiniMax
:
return
minimax
.
ChannelName
case
common
.
ChannelTypeXinference
:
return
xinference
.
ChannelName
default
:
return
ChannelName
}
...
...
relay/channel/xinference/constant.go
0 → 100644
View file @
1800e0ae
package
xinference
var
ModelList
=
[]
string
{
"bge-reranker-v2-m3"
,
}
var
ChannelName
=
"xinference"
relay/constant/api_type.go
View file @
1800e0ae
...
...
@@ -31,6 +31,7 @@ const (
APITypeVolcEngine
APITypeBaiduV2
APITypeOpenRouter
APITypeXinference
APITypeDummy
// this one is only for count, do not add any channel after this
)
...
...
@@ -89,6 +90,8 @@ func ChannelType2APIType(channelType int) (int, bool) {
apiType
=
APITypeBaiduV2
case
common
.
ChannelTypeOpenRouter
:
apiType
=
APITypeOpenRouter
case
common
.
ChannelTypeXinference
:
apiType
=
APITypeXinference
}
if
apiType
==
-
1
{
return
APITypeOpenAI
,
false
...
...
relay/relay_adaptor.go
View file @
1800e0ae
...
...
@@ -34,8 +34,6 @@ import (
func
GetAdaptor
(
apiType
int
)
channel
.
Adaptor
{
switch
apiType
{
//case constant.APITypeAIProxyLibrary:
// return &aiproxy.Adaptor{}
case
constant
.
APITypeAli
:
return
&
ali
.
Adaptor
{}
case
constant
.
APITypeAnthropic
:
...
...
@@ -86,6 +84,8 @@ func GetAdaptor(apiType int) channel.Adaptor {
return
&
baidu_v2
.
Adaptor
{}
case
constant
.
APITypeOpenRouter
:
return
&
openrouter
.
Adaptor
{}
case
constant
.
APITypeXinference
:
return
&
openai
.
Adaptor
{}
}
return
nil
}
...
...
web/src/constants/channel.constants.js
View file @
1800e0ae
...
...
@@ -80,11 +80,12 @@ export const CHANNEL_OPTIONS = [
label
:
'Google PaLM2'
},
{
value
:
4
5
,
value
:
4
7
,
color
:
'blue'
,
label
:
'
字节火山方舟、豆包、DeepSeek通用
'
label
:
'
Xinference
'
},
{
value
:
25
,
color
:
'green'
,
label
:
'Moonshot'
},
{
value
:
20
,
color
:
'green'
,
label
:
'OpenRouter'
},
{
value
:
19
,
color
:
'blue'
,
label
:
'360 智脑'
},
{
value
:
23
,
color
:
'teal'
,
label
:
'腾讯混元'
},
{
value
:
31
,
color
:
'green'
,
label
:
'零一万物'
},
...
...
@@ -108,5 +109,10 @@ export const CHANNEL_OPTIONS = [
value
:
44
,
color
:
'purple'
,
label
:
'嵌入模型:MokaAI M3E'
}
},
{
value
:
45
,
color
:
'blue'
,
label
:
'字节火山方舟、豆包、DeepSeek通用'
},
];
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