fix(openai): 修复fast模型后缀处理逻辑

修复模型名称处理逻辑,使其能够正确处理大小写不敏感的"-fast"后缀。使用正则表达式进行匹配,避免因大小写问题导致的模型识别错误。
This commit is contained in:
hex2077 2026-03-08 21:19:07 +08:00
parent 76e8a81b3d
commit dd8f30f5a8
2 changed files with 5 additions and 3 deletions

View file

@ -1 +1 @@
2.10.8.3
2.10.8.4

View file

@ -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;
}
// 生成会话缓存键