Extends #445 to other providers which many provides deepseek
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user