ollama接口设置增加<think>块忽略参数

This commit is contained in:
mcz
2025-05-01 23:41:08 +08:00
parent 7a772d2459
commit 471dc05897
4 changed files with 21 additions and 1 deletions

View File

@@ -39,6 +39,7 @@ import {
import { sha256 } from "../libs/utils";
import interpreter from "../libs/interpreter";
import { msAuth } from "../libs/auth";
import {getSettingWithDefault } from "../libs/storage";
/**
* 同步数据
@@ -323,7 +324,8 @@ export const apiTranslate = async ({
case OPT_TRANS_OLLAMA:
case OPT_TRANS_OLLAMA_2:
case OPT_TRANS_OLLAMA_3:
const deepModels = ['deepseek-r1', 'qwen3'];
let deepModels = (await getSettingWithDefault()).transApis[translator]?.thinkIgnore || '';
deepModels = deepModels.split(',').filter(model => model.trim() !== '');
if (deepModels.some(model => res?.model?.startsWith(model))) {
trText = res?.response.replace(/<think>[\s\S]*<\/think>/i, '');
}else{