From 3402acb6067a911308f1555ce0588e60728dca4a Mon Sep 17 00:00:00 2001 From: ianshaw Date: Mon, 12 Jan 2026 13:23:05 -0800 Subject: [PATCH] =?UTF-8?q?feat(gateway):=20=E5=AF=B9=E6=89=80=E6=9C=89?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=EF=BC=88=E5=8C=85=E6=8B=AC=20Codex=20CLI?= =?UTF-8?q?=EF=BC=89=E5=BA=94=E7=94=A8=E6=A8=A1=E5=9E=8B=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 Codex CLI 的模型映射跳过逻辑 - 添加详细的模型映射日志,包含账号名称和请求类型 - 确保所有 OpenAI 请求都能正确应用账号配置的模型映射 --- backend/internal/service/openai_gateway_service.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/backend/internal/service/openai_gateway_service.go b/backend/internal/service/openai_gateway_service.go index 0e228fb1..1104a3a5 100644 --- a/backend/internal/service/openai_gateway_service.go +++ b/backend/internal/service/openai_gateway_service.go @@ -545,14 +545,12 @@ func (s *OpenAIGatewayService) Forward(ctx context.Context, c *gin.Context, acco isCodexCLI := openai.IsCodexCLIRequest(c.GetHeader("User-Agent")) - // Apply model mapping (skip for Codex CLI for transparent forwarding) - mappedModel := reqModel - if !isCodexCLI { - mappedModel = account.GetMappedModel(reqModel) - if mappedModel != reqModel { - reqBody["model"] = mappedModel - bodyModified = true - } + // Apply model mapping for all requests (including Codex CLI) + mappedModel := account.GetMappedModel(reqModel) + if mappedModel != reqModel { + log.Printf("[OpenAI] Model mapping applied: %s -> %s (account: %s, isCodexCLI: %v)", reqModel, mappedModel, account.Name, isCodexCLI) + reqBody["model"] = mappedModel + bodyModified = true } if account.Type == AccountTypeOAuth && !isCodexCLI {