fix: disable channel with a whitelist

This commit is contained in:
JustSong
2023-05-21 20:58:00 +08:00
parent 17b7646c12
commit d9e39f5906
2 changed files with 3 additions and 3 deletions

View File

@@ -89,8 +89,8 @@ func Relay(c *gin.Context) {
})
channelId := c.GetInt("channel_id")
common.SysError(fmt.Sprintf("Relay error (channel #%d): %s", channelId, err.Message))
if err.Type != "invalid_request_error" && err.StatusCode != http.StatusTooManyRequests &&
common.AutomaticDisableChannelEnabled {
// https://platform.openai.com/docs/guides/error-codes/api-errors
if common.AutomaticDisableChannelEnabled && (err.Type == "insufficient_quota" || err.Code == "invalid_api_key") {
channelId := c.GetInt("channel_id")
channelName := c.GetString("channel_name")
disableChannel(channelId, channelName, err.Message)