diff --git a/common/constants.go b/common/constants.go index 9611ed0e..36b6277e 100644 --- a/common/constants.go +++ b/common/constants.go @@ -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 } diff --git a/relay/channel/openai/adaptor.go b/relay/channel/openai/adaptor.go index 6dbbb17e..d8a44335 100644 --- a/relay/channel/openai/adaptor.go +++ b/relay/channel/openai/adaptor.go @@ -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 } diff --git a/relay/channel/xinference/constant.go b/relay/channel/xinference/constant.go new file mode 100644 index 00000000..98ec9b04 --- /dev/null +++ b/relay/channel/xinference/constant.go @@ -0,0 +1,7 @@ +package xinference + +var ModelList = []string{ + "bge-reranker-v2-m3", +} + +var ChannelName = "xinference" diff --git a/relay/constant/api_type.go b/relay/constant/api_type.go index 8ccfee03..2cd0e399 100644 --- a/relay/constant/api_type.go +++ b/relay/constant/api_type.go @@ -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 diff --git a/relay/relay_adaptor.go b/relay/relay_adaptor.go index 00cff316..f6d141fa 100644 --- a/relay/relay_adaptor.go +++ b/relay/relay_adaptor.go @@ -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 } diff --git a/web/src/constants/channel.constants.js b/web/src/constants/channel.constants.js index 5738d656..f1d0c88d 100644 --- a/web/src/constants/channel.constants.js +++ b/web/src/constants/channel.constants.js @@ -80,11 +80,12 @@ export const CHANNEL_OPTIONS = [ label: 'Google PaLM2' }, { - value: 45, + value: 47, 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通用' + }, ];