Просмотр исходного кода

feat: disable channel when account_deactivated received (close #271)

JustSong 2 лет назад
Родитель
Сommit
abc53cb208
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      controller/relay.go

+ 1 - 1
controller/relay.go

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