From cda73a2ec5be50c8b6723b8a84440845a4b30f45 Mon Sep 17 00:00:00 2001 From: Xyfacai Date: Wed, 10 Sep 2025 19:53:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20dalle=20log=20=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=BC=A0=E6=95=B0=20N?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/relay.go | 13 ++++++------- relay/image_handler.go | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/controller/relay.go b/controller/relay.go index d3d93192e..07c3aeaac 100644 --- a/controller/relay.go +++ b/controller/relay.go @@ -277,14 +277,13 @@ func shouldRetry(c *gin.Context, openaiErr *types.NewAPIError, retryTimes int) b func processChannelError(c *gin.Context, channelError types.ChannelError, err *types.NewAPIError) { logger.LogError(c, fmt.Sprintf("relay error (channel #%d, status code: %d): %s", channelError.ChannelId, err.StatusCode, err.Error())) - - gopool.Go(func() { - // 不要使用context获取渠道信息,异步处理时可能会出现渠道信息不一致的情况 - // do not use context to get channel info, there may be inconsistent channel info when processing asynchronously - if service.ShouldDisableChannel(channelError.ChannelId, err) && channelError.AutoBan { + // 不要使用context获取渠道信息,异步处理时可能会出现渠道信息不一致的情况 + // do not use context to get channel info, there may be inconsistent channel info when processing asynchronously + if service.ShouldDisableChannel(channelError.ChannelId, err) && channelError.AutoBan { + gopool.Go(func() { service.DisableChannel(channelError, err.Error()) - } - }) + }) + } if constant.ErrorLogEnabled && types.IsRecordErrorLog(err) { // 保存错误日志到mysql中 diff --git a/relay/image_handler.go b/relay/image_handler.go index e2789ae5e..9c873d47f 100644 --- a/relay/image_handler.go +++ b/relay/image_handler.go @@ -120,7 +120,7 @@ func ImageHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *type var logContent string if len(request.Size) > 0 { - logContent = fmt.Sprintf("大小 %s, 品质 %s", request.Size, quality) + logContent = fmt.Sprintf("大小 %s, 品质 %s, 张数 %d", request.Size, quality, request.N) } postConsumeQuota(c, info, usage.(*dto.Usage), logContent)