Extends #445 to other providers which many provides deepseek

This commit is contained in:
Tiger Kaovilai
2025-04-11 12:50:16 -04:00
parent 60a7650e1c
commit f5c6c313fc
8 changed files with 62 additions and 24 deletions
+6 -1
View File
@@ -45,8 +45,13 @@ export class OpenAiEngine implements AiEngine {
const completion = await this.client.chat.completions.create(params);
const message = completion.choices[0].message;
let content = message?.content;
return message?.content;
if (content && content.includes('<think>')) {
return content.replace(/<think>[\s\S]*?<\/think>/g, '').trim();
}
return content;
} catch (error) {
const err = error as Error;
if (