From 5b41f5742325480779263d34439f34201d53f89b Mon Sep 17 00:00:00 2001 From: JustSong Date: Fri, 5 Apr 2024 12:32:05 +0800 Subject: [PATCH] feat: support stepfun's models --- README.md | 1 + common/constants.go | 2 ++ relay/channel/openai/compatible.go | 4 ++++ relay/channel/stepfun/constants.go | 7 +++++++ web/berry/src/constants/ChannelConstants.js | 6 ++++++ web/default/src/constants/channel.constants.js | 1 + 6 files changed, 21 insertions(+) create mode 100644 relay/channel/stepfun/constants.go diff --git a/README.md b/README.md index 596def13..d5c939be 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用 + [x] [Groq](https://wow.groq.com/) + [x] [Ollama](https://github.com/ollama/ollama) + [x] [零一万物](https://platform.lingyiwanwu.com/) + + [x] [阶跃星辰](https://platform.stepfun.com/) 2. 支持配置镜像以及众多[第三方代理服务](https://iamazing.cn/page/openai-api-third-party-services)。 3. 支持通过**负载均衡**的方式访问多个渠道。 4. 支持 **stream 模式**,可以通过流式传输实现打字机效果。 diff --git a/common/constants.go b/common/constants.go index 849bdce7..04a56649 100644 --- a/common/constants.go +++ b/common/constants.go @@ -71,6 +71,7 @@ const ( ChannelTypeGroq ChannelTypeOllama ChannelTypeLingYiWanWu + ChannelTypeStepFun ChannelTypeDummy ) @@ -108,6 +109,7 @@ var ChannelBaseURLs = []string{ "https://api.groq.com/openai", // 29 "http://localhost:11434", // 30 "https://api.lingyiwanwu.com", // 31 + "https://api.stepfun.com", // 32 } const ( diff --git a/relay/channel/openai/compatible.go b/relay/channel/openai/compatible.go index e4951a34..2a1447ab 100644 --- a/relay/channel/openai/compatible.go +++ b/relay/channel/openai/compatible.go @@ -9,6 +9,7 @@ import ( "github.com/songquanpeng/one-api/relay/channel/minimax" "github.com/songquanpeng/one-api/relay/channel/mistral" "github.com/songquanpeng/one-api/relay/channel/moonshot" + "github.com/songquanpeng/one-api/relay/channel/stepfun" ) var CompatibleChannels = []int{ @@ -20,6 +21,7 @@ var CompatibleChannels = []int{ common.ChannelTypeMistral, common.ChannelTypeGroq, common.ChannelTypeLingYiWanWu, + common.ChannelTypeStepFun, } func GetCompatibleChannelMeta(channelType int) (string, []string) { @@ -40,6 +42,8 @@ func GetCompatibleChannelMeta(channelType int) (string, []string) { return "groq", groq.ModelList case common.ChannelTypeLingYiWanWu: return "lingyiwanwu", lingyiwanwu.ModelList + case common.ChannelTypeStepFun: + return "stepfun", stepfun.ModelList default: return "openai", ModelList } diff --git a/relay/channel/stepfun/constants.go b/relay/channel/stepfun/constants.go new file mode 100644 index 00000000..a82e562b --- /dev/null +++ b/relay/channel/stepfun/constants.go @@ -0,0 +1,7 @@ +package stepfun + +var ModelList = []string{ + "step-1-32k", + "step-1v-32k", + "step-1-200k", +} diff --git a/web/berry/src/constants/ChannelConstants.js b/web/berry/src/constants/ChannelConstants.js index ec049f7d..b74c58c7 100644 --- a/web/berry/src/constants/ChannelConstants.js +++ b/web/berry/src/constants/ChannelConstants.js @@ -107,6 +107,12 @@ export const CHANNEL_OPTIONS = { value: 31, color: 'primary' }, + 32: { + key: 32, + text: '阶跃星辰', + value: 32, + color: 'primary' + }, 8: { key: 8, text: '自定义渠道', diff --git a/web/default/src/constants/channel.constants.js b/web/default/src/constants/channel.constants.js index 8d536e58..2bf53c81 100644 --- a/web/default/src/constants/channel.constants.js +++ b/web/default/src/constants/channel.constants.js @@ -17,6 +17,7 @@ export const CHANNEL_OPTIONS = [ { key: 29, text: 'Groq', value: 29, color: 'orange' }, { key: 30, text: 'Ollama', value: 30, color: 'black' }, { key: 31, text: '零一万物', value: 31, color: 'green' }, + { key: 31, text: '阶跃星辰', value: 32, color: 'blue' }, { key: 8, text: '自定义渠道', value: 8, color: 'pink' }, { key: 22, text: '知识库:FastGPT', value: 22, color: 'blue' }, { key: 21, text: '知识库:AI Proxy', value: 21, color: 'purple' },