fix: test all channel

This commit is contained in:
linzhaoming 2024-06-18 17:32:23 +08:00
parent c6ba325a1d
commit 64f9e5f560

View File

@ -219,13 +219,15 @@ func testAllChannels(notify bool) error {
if channel.AutoBan != nil && *channel.AutoBan == 0 {
ban = false
}
openAiErrWithStatus := dto.OpenAIErrorWithStatusCode{
StatusCode: -1,
Error: *openaiErr,
LocalError: false,
}
if isChannelEnabled && service.ShouldDisableChannel(&openAiErrWithStatus) && ban {
service.DisableChannel(channel.Id, channel.Name, err.Error())
if openaiErr != nil && isChannelEnabled && ban {
openAiErrWithStatus := dto.OpenAIErrorWithStatusCode{
StatusCode: -1,
Error: *openaiErr,
LocalError: false,
}
if service.ShouldDisableChannel(&openAiErrWithStatus) {
service.DisableChannel(channel.Id, channel.Name, err.Error())
}
}
if !isChannelEnabled && service.ShouldEnableChannel(err, openaiErr, channel.Status) {
service.EnableChannel(channel.Id, channel.Name)