diff --git a/controller/channel-test.go b/controller/channel-test.go index f66e0d6..f37f309 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -208,7 +208,7 @@ func testAllChannels(notify bool) error { if isChannelEnabled && service.ShouldDisableChannel(openaiErr, -1) && ban { service.DisableChannel(channel.Id, channel.Name, err.Error()) } - if !isChannelEnabled && service.ShouldEnableChannel(err, openaiErr) { + if !isChannelEnabled && service.ShouldEnableChannel(err, openaiErr, channel.Status) { service.EnableChannel(channel.Id, channel.Name) } channel.UpdateResponseTime(milliseconds) diff --git a/service/channel.go b/service/channel.go index 82ffd77..41ca6b7 100644 --- a/service/channel.go +++ b/service/channel.go @@ -63,7 +63,7 @@ func ShouldDisableChannel(err *relaymodel.OpenAIError, statusCode int) bool { return false } -func ShouldEnableChannel(err error, openAIErr *relaymodel.OpenAIError) bool { +func ShouldEnableChannel(err error, openAIErr *relaymodel.OpenAIError, status int) bool { if !common.AutomaticEnableChannelEnabled { return false } @@ -73,5 +73,8 @@ func ShouldEnableChannel(err error, openAIErr *relaymodel.OpenAIError) bool { if openAIErr != nil { return false } + if status != common.ChannelStatusAutoDisabled { + return false + } return true }