From dd8f30f5a8d53e697189dcc9c36a00fb6bc834c5 Mon Sep 17 00:00:00 2001 From: hex2077 Date: Sun, 8 Mar 2026 21:19:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(openai):=20=E4=BF=AE=E5=A4=8Dfast=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=90=8E=E7=BC=80=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复模型名称处理逻辑,使其能够正确处理大小写不敏感的"-fast"后缀。使用正则表达式进行匹配,避免因大小写问题导致的模型识别错误。 --- VERSION | 2 +- src/providers/openai/codex-core.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index f90a737..eea29b8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.10.8.3 +2.10.8.4 diff --git a/src/providers/openai/codex-core.js b/src/providers/openai/codex-core.js index c1e0f6a..82e5cb9 100644 --- a/src/providers/openai/codex-core.js +++ b/src/providers/openai/codex-core.js @@ -342,7 +342,9 @@ export class CodexApiService { const sessionId = metadata.session_id || metadata.conversation_id || metadata.user_id || 'default'; // 判断是否为 fast 模型并确定默认值 - const isFastModel = model.endsWith('-fast'); + const normalizedModel = String(model || '').trim(); + const isFastModel = /-fast$/i.test(normalizedModel); + const upstreamModel = isFastModel ? normalizedModel.replace(/-fast$/i, '') : normalizedModel; const defaultServiceTier = isFastModel ? 'priority' : 'default'; const defaultReasoningEffort = isFastModel ? 'xhigh' : 'medium'; @@ -351,7 +353,7 @@ export class CodexApiService { // 如果是 fast 模型,移除后缀再传给上游 if (isFastModel) { - cleanedBody.model = model.replace('-fast', ''); + cleanedBody.model = upstreamModel; } // 生成会话缓存键