From 5e07ff85eb13539e58f0ead9886b5ace80e17529 Mon Sep 17 00:00:00 2001 From: CaIon <1808837298@qq.com> Date: Thu, 16 May 2024 18:31:03 +0800 Subject: [PATCH] feat: pre to delete custom channel type --- relay/constant/api_type.go | 4 ++-- relay/relay_adaptor.go | 2 +- web/src/components/ChannelsTable.js | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/relay/constant/api_type.go b/relay/constant/api_type.go index 8a1dbd6..943c407 100644 --- a/relay/constant/api_type.go +++ b/relay/constant/api_type.go @@ -15,7 +15,7 @@ const ( APITypeAIProxyLibrary APITypeTencent APITypeGemini - APITypeZhipu_v4 + APITypeZhipuV4 APITypeOllama APITypePerplexity APITypeAws @@ -48,7 +48,7 @@ func ChannelType2APIType(channelType int) (int, bool) { case common.ChannelTypeGemini: apiType = APITypeGemini case common.ChannelTypeZhipu_v4: - apiType = APITypeZhipu_v4 + apiType = APITypeZhipuV4 case common.ChannelTypeOllama: apiType = APITypeOllama case common.ChannelTypePerplexity: diff --git a/relay/relay_adaptor.go b/relay/relay_adaptor.go index 01e9cec..cf63054 100644 --- a/relay/relay_adaptor.go +++ b/relay/relay_adaptor.go @@ -41,7 +41,7 @@ func GetAdaptor(apiType int) channel.Adaptor { return &xunfei.Adaptor{} case constant.APITypeZhipu: return &zhipu.Adaptor{} - case constant.APITypeZhipu_v4: + case constant.APITypeZhipuV4: return &zhipu_4v.Adaptor{} case constant.APITypeOllama: return &ollama.Adaptor{} diff --git a/web/src/components/ChannelsTable.js b/web/src/components/ChannelsTable.js index 452309c..ad53999 100644 --- a/web/src/components/ChannelsTable.js +++ b/web/src/components/ChannelsTable.js @@ -6,6 +6,7 @@ import { showError, showInfo, showSuccess, + showWarning, timestamp2string, } from '../helpers'; @@ -309,6 +310,12 @@ const ChannelsTable = () => { const setChannelFormat = (channels) => { for (let i = 0; i < channels.length; i++) { + if (channels[i].type === 8) { + showWarning( + '检测到您使用了“自定义渠道”类型,请更换为“OpenAI”渠道类型!', + ); + showWarning('下个版本将不再支持“自定义渠道”类型!'); + } channels[i].key = '' + channels[i].id; let test_models = []; channels[i].models.split(',').forEach((item, index) => {