From 4c4e0870607c77e900be9b3324598641dc737b0f Mon Sep 17 00:00:00 2001 From: CaIon <1808837298@qq.com> Date: Mon, 18 Mar 2024 19:55:19 +0800 Subject: [PATCH] fix: api type error --- relay/constant/api_type.go | 3 +++ relay/relay_adaptor.go | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/relay/constant/api_type.go b/relay/constant/api_type.go index 79d06da..8e6f67e 100644 --- a/relay/constant/api_type.go +++ b/relay/constant/api_type.go @@ -16,6 +16,7 @@ const ( APITypeTencent APITypeGemini APITypeZhipu_v4 + APITypeOllama APITypePerplexity APITypeDummy // this one is only for count, do not add any channel after this @@ -44,6 +45,8 @@ func ChannelType2APIType(channelType int) int { apiType = APITypeGemini case common.ChannelTypeZhipu_v4: apiType = APITypeZhipu_v4 + case common.ChannelTypeOllama: + apiType = APITypeOllama case common.ChannelTypePerplexity: apiType = APITypePerplexity } diff --git a/relay/relay_adaptor.go b/relay/relay_adaptor.go index cc76270..e6afab5 100644 --- a/relay/relay_adaptor.go +++ b/relay/relay_adaptor.go @@ -6,8 +6,10 @@ import ( "one-api/relay/channel/baidu" "one-api/relay/channel/claude" "one-api/relay/channel/gemini" + "one-api/relay/channel/ollama" "one-api/relay/channel/openai" "one-api/relay/channel/palm" + "one-api/relay/channel/perplexity" "one-api/relay/channel/tencent" "one-api/relay/channel/xunfei" "one-api/relay/channel/zhipu" @@ -39,6 +41,10 @@ func GetAdaptor(apiType int) channel.Adaptor { return &zhipu.Adaptor{} case constant.APITypeZhipu_v4: return &zhipu_4v.Adaptor{} + case constant.APITypeOllama: + return &ollama.Adaptor{} + case constant.APITypePerplexity: + return &perplexity.Adaptor{} } return nil }