Merge pull request #335 from HynoR/fix/v1

fix testAllChannels nil pointer panic
This commit is contained in:
Calcium-Ion 2024-06-27 16:23:47 +08:00 committed by GitHub
commit a9b978528e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -222,6 +222,7 @@ func testAllChannels(notify bool) error {
if channel.AutoBan != nil && *channel.AutoBan == 0 { if channel.AutoBan != nil && *channel.AutoBan == 0 {
ban = false ban = false
} }
if openaiErr != nil {
openAiErrWithStatus := dto.OpenAIErrorWithStatusCode{ openAiErrWithStatus := dto.OpenAIErrorWithStatusCode{
StatusCode: -1, StatusCode: -1,
Error: *openaiErr, Error: *openaiErr,
@ -233,6 +234,7 @@ func testAllChannels(notify bool) error {
if !isChannelEnabled && service.ShouldEnableChannel(err, openaiErr, channel.Status) { if !isChannelEnabled && service.ShouldEnableChannel(err, openaiErr, channel.Status) {
service.EnableChannel(channel.Id, channel.Name) service.EnableChannel(channel.Id, channel.Name)
} }
}
channel.UpdateResponseTime(milliseconds) channel.UpdateResponseTime(milliseconds)
time.Sleep(common.RequestInterval) time.Sleep(common.RequestInterval)
} }