fix(openai): 修复fast模型上游请求中模型名称错误问题

确保传给上游的模型名称正确移除-fast后缀,避免因模型名称不匹配导致的API调用失败。当检测到fast模型时,会记录转换日志以便追踪。
This commit is contained in:
hex2077 2026-03-08 22:11:38 +08:00
parent d9396ef56c
commit 7726ca1f38
2 changed files with 6 additions and 3 deletions

View file

@ -1 +1 @@
2.10.9
2.10.9.1

View file

@ -351,9 +351,12 @@ export class CodexApiService {
const cleanedBody = { ...requestBody };
delete cleanedBody.metadata;
// 如果是 fast 模型,移除后缀再传给上游
// 【关键修复】确保传给上游的模型名称不带 -fast 后缀
// 即使 originalRequestBody 中已经带了 model这里也必须覆盖
cleanedBody.model = upstreamModel;
if (isFastModel) {
cleanedBody.model = upstreamModel;
logger.info(`[Codex] Detected -fast model: ${normalizedModel} -> ${upstreamModel}, service_tier: ${cleanedBody.service_tier || defaultServiceTier}`);
}
// 生成会话缓存键