feat: support lingyiwanwu

This commit is contained in:
JustSong 2024-03-14 23:11:36 +08:00
parent 89e111ac69
commit be9eb59fbb
8 changed files with 30 additions and 0 deletions

View File

@ -80,6 +80,7 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用
+ [x] [MINIMAX](https://api.minimax.chat/) + [x] [MINIMAX](https://api.minimax.chat/)
+ [x] [Groq](https://wow.groq.com/) + [x] [Groq](https://wow.groq.com/)
+ [x] [Ollama](https://github.com/ollama/ollama) + [x] [Ollama](https://github.com/ollama/ollama)
+ [x] [零一万物](https://platform.lingyiwanwu.com/)
2. 支持配置镜像以及众多[第三方代理服务](https://iamazing.cn/page/openai-api-third-party-services)。 2. 支持配置镜像以及众多[第三方代理服务](https://iamazing.cn/page/openai-api-third-party-services)。
3. 支持通过**负载均衡**的方式访问多个渠道。 3. 支持通过**负载均衡**的方式访问多个渠道。
4. 支持 **stream 模式**,可以通过流式传输实现打字机效果。 4. 支持 **stream 模式**,可以通过流式传输实现打字机效果。

View File

@ -70,6 +70,7 @@ const (
ChannelTypeMistral ChannelTypeMistral
ChannelTypeGroq ChannelTypeGroq
ChannelTypeOllama ChannelTypeOllama
ChannelTypeLingYiWanWu
ChannelTypeDummy ChannelTypeDummy
) )
@ -106,6 +107,7 @@ var ChannelBaseURLs = []string{
"https://api.mistral.ai", // 28 "https://api.mistral.ai", // 28
"https://api.groq.com/openai", // 29 "https://api.groq.com/openai", // 29
"http://localhost:11434", // 30 "http://localhost:11434", // 30
"https://api.lingyiwanwu.com", // 31
} }
const ( const (

View File

@ -130,6 +130,10 @@ var ModelRatio = map[string]float64{
"llama2-7b-2048": 0.1 / 1000 * USD, "llama2-7b-2048": 0.1 / 1000 * USD,
"mixtral-8x7b-32768": 0.27 / 1000 * USD, "mixtral-8x7b-32768": 0.27 / 1000 * USD,
"gemma-7b-it": 0.1 / 1000 * USD, "gemma-7b-it": 0.1 / 1000 * USD,
// https://platform.lingyiwanwu.com/docs#-计费单元
"yi-34b-chat-0205": 2.5 / 1000000 * RMB,
"yi-34b-chat-200k": 12.0 / 1000000 * RMB,
"yi-vl-plus": 6.0 / 1000000 * RMB,
} }
var CompletionRatio = map[string]float64{} var CompletionRatio = map[string]float64{}

View File

@ -0,0 +1,9 @@
package lingyiwanwu
// https://platform.lingyiwanwu.com/docs
var ModelList = []string{
"yi-34b-chat-0205",
"yi-34b-chat-200k",
"yi-vl-plus",
}

View File

@ -5,6 +5,7 @@ import (
"github.com/songquanpeng/one-api/relay/channel/ai360" "github.com/songquanpeng/one-api/relay/channel/ai360"
"github.com/songquanpeng/one-api/relay/channel/baichuan" "github.com/songquanpeng/one-api/relay/channel/baichuan"
"github.com/songquanpeng/one-api/relay/channel/groq" "github.com/songquanpeng/one-api/relay/channel/groq"
"github.com/songquanpeng/one-api/relay/channel/lingyiwanwu"
"github.com/songquanpeng/one-api/relay/channel/minimax" "github.com/songquanpeng/one-api/relay/channel/minimax"
"github.com/songquanpeng/one-api/relay/channel/mistral" "github.com/songquanpeng/one-api/relay/channel/mistral"
"github.com/songquanpeng/one-api/relay/channel/moonshot" "github.com/songquanpeng/one-api/relay/channel/moonshot"
@ -18,6 +19,7 @@ var CompatibleChannels = []int{
common.ChannelTypeMinimax, common.ChannelTypeMinimax,
common.ChannelTypeMistral, common.ChannelTypeMistral,
common.ChannelTypeGroq, common.ChannelTypeGroq,
common.ChannelTypeLingYiWanWu,
} }
func GetCompatibleChannelMeta(channelType int) (string, []string) { func GetCompatibleChannelMeta(channelType int) (string, []string) {
@ -36,6 +38,8 @@ func GetCompatibleChannelMeta(channelType int) (string, []string) {
return "mistralai", mistral.ModelList return "mistralai", mistral.ModelList
case common.ChannelTypeGroq: case common.ChannelTypeGroq:
return "groq", groq.ModelList return "groq", groq.ModelList
case common.ChannelTypeLingYiWanWu:
return "lingyiwanwu", lingyiwanwu.ModelList
default: default:
return "openai", ModelList return "openai", ModelList
} }

View File

@ -101,6 +101,12 @@ export const CHANNEL_OPTIONS = {
value: 30, value: 30,
color: 'default' color: 'default'
}, },
31: {
key: 31,
text: '零一万物',
value: 31,
color: 'default'
},
8: { 8: {
key: 8, key: 8,
text: '自定义渠道', text: '自定义渠道',

View File

@ -169,6 +169,9 @@ const typeConfig = {
30: { 30: {
modelGroup: "ollama", modelGroup: "ollama",
}, },
31: {
modelGroup: "lingyiwanwu",
},
}; };
export { defaultConfig, typeConfig }; export { defaultConfig, typeConfig };

View File

@ -16,6 +16,7 @@ export const CHANNEL_OPTIONS = [
{ key: 27, text: 'MiniMax', value: 27, color: 'red' }, { key: 27, text: 'MiniMax', value: 27, color: 'red' },
{ key: 29, text: 'Groq', value: 29, color: 'orange' }, { key: 29, text: 'Groq', value: 29, color: 'orange' },
{ key: 30, text: 'Ollama', value: 30, color: 'black' }, { key: 30, text: 'Ollama', value: 30, color: 'black' },
{ key: 31, text: '零一万物', value: 31, color: 'green' },
{ key: 8, text: '自定义渠道', value: 8, color: 'pink' }, { key: 8, text: '自定义渠道', value: 8, color: 'pink' },
{ key: 22, text: '知识库FastGPT', value: 22, color: 'blue' }, { key: 22, text: '知识库FastGPT', value: 22, color: 'blue' },
{ key: 21, text: '知识库AI Proxy', value: 21, color: 'purple' }, { key: 21, text: '知识库AI Proxy', value: 21, color: 'purple' },