From b3f1b5953c72d5a41b067d0b0477f83401e14317 Mon Sep 17 00:00:00 2001 From: MartialBE Date: Sat, 6 Jan 2024 16:22:49 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20custom=20channel=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- providers/azure/base.go | 3 ++- providers/openai/base.go | 2 +- providers/providers.go | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/providers/azure/base.go b/providers/azure/base.go index 6e560e6b..597dd2a8 100644 --- a/providers/azure/base.go +++ b/providers/azure/base.go @@ -26,7 +26,8 @@ func (f AzureProviderFactory) Create(c *gin.Context) base.ProviderInterface { Context: c, // AudioSpeech: "/audio/speech", }, - IsAzure: true, + IsAzure: true, + BalanceAction: false, }, } } diff --git a/providers/openai/base.go b/providers/openai/base.go index f37546f7..5536871e 100644 --- a/providers/openai/base.go +++ b/providers/openai/base.go @@ -54,7 +54,7 @@ func CreateOpenAIProvider(c *gin.Context, baseURL string) *OpenAIProvider { Context: c, }, IsAzure: false, - BalanceAction: false, + BalanceAction: true, } } diff --git a/providers/providers.go b/providers/providers.go index 01043ce3..c5de8094 100644 --- a/providers/providers.go +++ b/providers/providers.go @@ -72,8 +72,9 @@ func GetProvider(channel *model.Channel, c *gin.Context) base.ProviderInterface } provider = openai.CreateOpenAIProvider(c, baseURL) + } else { + provider = factory.Create(c) } - provider = factory.Create(c) provider.SetChannel(channel) return provider