Skip to content

Commit

Permalink
修复非预期模型名处理
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinlic committed Dec 31, 2024
1 parent 719e3b6 commit 2ce738b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api/controllers/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2ce738b

Please sign in to comment.