修复非预期模型名处理

This commit is contained in:
Vinlic 2024-12-31 12:47:16 +08:00
parent 719e3b682f
commit 2ce738b1fc

View File

@ -191,7 +191,7 @@ async function createCompletion(
// 如果引用对话ID不正确则重置引用
if (!/[0-9a-zA-Z]{24}/.test(refConvId)) refConvId = "";
let assistantId = /^[a-z0-9]{24,}$/.test(model) ? model : undefined;
let assistantId = /^[a-z0-9]{24,}$/.test(model) ? model : DEFAULT_ASSISTANT_ID;
if(model.indexOf('think') != -1 || model.indexOf('zero') != -1) {
assistantId = ZERO_ASSISTANT_ID;
@ -302,7 +302,7 @@ async function createCompletionStream(
// 如果引用对话ID不正确则重置引用
if (!/[0-9a-zA-Z]{24}/.test(refConvId)) refConvId = "";
let assistantId = /^[a-z0-9]{24,}$/.test(model) ? model : undefined;
let assistantId = /^[a-z0-9]{24,}$/.test(model) ? model : DEFAULT_ASSISTANT_ID;
if(model.indexOf('think') != -1 || model.indexOf('zero') != -1) {
assistantId = ZERO_ASSISTANT_ID;