Merge pull request #235 from unclemcz/dev

feat:基本设置增加请求超时参数&ollama接口配置增加<think>块忽略参数
This commit is contained in:
Gabe
2025-05-09 14:09:18 +08:00
committed by GitHub
6 changed files with 53 additions and 5 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";
/**
* 同步数据
@@ -332,7 +333,9 @@ export const apiTranslate = async ({
case OPT_TRANS_OLLAMA:
case OPT_TRANS_OLLAMA_2:
case OPT_TRANS_OLLAMA_3:
if (res?.model.startsWith('deepseek-r1')) {
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{
trText = res?.response;