feat: 渠道新可选是否自动禁用功能
This commit is contained in:
1 parent
4199979c01
commit
cba411ee9e
6 files changed
+45
-4
No files matched your search
+2
-1
@@ -236,9 +236,10 @@ func Relay(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
channelId := c.GetInt("channel_id")
|
||||
autoBan := c.GetBool("auto_ban")
|
||||
common.LogError(c.Request.Context(), fmt.Sprintf("relay error (channel #%d): %s", channelId, err.Message))
|
||||
// https://platform.openai.com/docs/guides/error-codes/api-errors
|
||||
if shouldDisableChannel(&err.OpenAIError, err.StatusCode) {
|
||||
if shouldDisableChannel(&err.OpenAIError, err.StatusCode) && autoBan {
|
||||
channelId := c.GetInt("channel_id")
|
||||
channelName := c.GetString("channel_name")
|
||||
disableChannel(channelId, channelName, err.Message)
|
||||
|
||||
Reference in new issue
Block a user