From eb7933af4c02be9caa62efd8bcbedc399787c052 Mon Sep 17 00:00:00 2001 From: shaw Date: Wed, 15 Jul 2026 10:01:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(openai):=20=E7=A7=BB=E9=99=A4=20#4269=20?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E6=97=B6=E5=A4=8D=E6=B4=BB=E7=9A=84=E6=97=A7?= =?UTF-8?q?=E7=89=88=20Grok=20=E9=94=99=E8=AF=AF=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #4269 分支基于 #4212 之前的 main(merge-base da85cc7e),合并后把 ForwardAsAnthropic 错误路径上已被 #4212 重构移除的 Grok 块带了回来: - xai.ParseQuotaHeaders 的 import 已被 main 删除,导致 main 编译失败; - 该块与 failoverOpenAIUpstreamHTTPError 内部的 handleGrokAccountUpstreamError 重复(后者第一步就用新解析器 parseGrokQuotaSnapshot 更新配额快照), 保留会造成 Grok 错误双重处置。 删除整块,恢复 #4212 语义;#4269 的 agent identity 恢复逻辑保留不动。 --- backend/internal/service/openai_gateway_messages.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/backend/internal/service/openai_gateway_messages.go b/backend/internal/service/openai_gateway_messages.go index 68f16027fb..cbfd218a22 100644 --- a/backend/internal/service/openai_gateway_messages.go +++ b/backend/internal/service/openai_gateway_messages.go @@ -330,10 +330,6 @@ func (s *OpenAIGatewayService) ForwardAsAnthropic( } return s.ForwardAsAnthropic(markAgentIdentityTaskRecoveryTried(ctx), c, account, body, promptCacheKey, defaultMappedModel) } - if account.Platform == PlatformGrok { - s.updateGrokUsageSnapshot(ctx, account, xai.ParseQuotaHeaders(resp.Header, resp.StatusCode)) - s.handleGrokAccountUpstreamError(ctx, account, resp.StatusCode, resp.Header, respBody) - } if previousResponseID != "" && (isOpenAICompatPreviousResponseNotFound(resp.StatusCode, upstreamMsg, respBody) || isOpenAICompatPreviousResponseUnsupported(resp.StatusCode, upstreamMsg, respBody)) { if isOpenAICompatPreviousResponseUnsupported(resp.StatusCode, upstreamMsg, respBody) { s.disableOpenAICompatSessionContinuation(ctx, c, account, promptCacheKey)