From 97676f114e4aa1d7bea06671374a9f7956344581 Mon Sep 17 00:00:00 2001 From: Gabe Date: Thu, 30 Oct 2025 20:07:01 +0800 Subject: [PATCH] fix: remove tink from ollama --- src/apis/trans.js | 20 ++++++++++---------- src/config/api.js | 4 ++-- src/views/Options/Apis.js | 10 +++++----- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/apis/trans.js b/src/apis/trans.js index a989881..d8128b1 100644 --- a/src/apis/trans.js +++ b/src/apis/trans.js @@ -497,7 +497,7 @@ const genOpenRouter = ({ }; const genOllama = ({ - think, + // think, url, key, systemPrompt, @@ -523,7 +523,7 @@ const genOllama = ({ ], temperature, max_tokens: maxTokens, - think, + // think, stream: false, }; @@ -717,7 +717,7 @@ export const parseTransRes = async ( toLang, langMap, resHook, - thinkIgnore, + // thinkIgnore, history, userMsg, apiType, @@ -811,7 +811,7 @@ export const parseTransRes = async ( content: modelMsg.content, }); } - return parseAIRes(res?.choices?.[0]?.message?.content ?? ""); + return parseAIRes(modelMsg?.content); case OPT_TRANS_GEMINI: modelMsg = res?.candidates?.[0]?.content; if (history && userMsg && modelMsg) { @@ -832,12 +832,12 @@ export const parseTransRes = async ( case OPT_TRANS_OLLAMA: modelMsg = res?.choices?.[0]?.message; - const deepModels = thinkIgnore - .split(",") - .filter((model) => model?.trim()); - if (deepModels.some((model) => res?.model?.startsWith(model))) { - modelMsg?.content.replace(/[\s\S]*<\/think>/i, ""); - } + // const deepModels = thinkIgnore + // .split(",") + // .filter((model) => model?.trim()); + // if (deepModels.some((model) => res?.model?.startsWith(model))) { + // modelMsg?.content.replace(/[\s\S]*<\/think>/i, ""); + // } if (history && userMsg && modelMsg) { history.add(userMsg, { diff --git a/src/config/api.js b/src/config/api.js index a60b869..a21c8c5 100644 --- a/src/config/api.js +++ b/src/config/api.js @@ -450,8 +450,8 @@ const defaultApi = { contextSize: DEFAULT_CONTEXT_SIZE, // 智能上下文保留会话数 temperature: 0.0, maxTokens: 20480, - think: false, - thinkIgnore: "qwen3,deepseek-r1", + // think: false, // (OpenAI 兼容接口未支持,暂时移除) + // thinkIgnore: "qwen3,deepseek-r1", // (OpenAI 兼容接口未支持,暂时移除) isDisabled: false, // 是否不显示, region: "", // Azure 专用 }; diff --git a/src/views/Options/Apis.js b/src/views/Options/Apis.js index 624e07a..ef7d9f4 100644 --- a/src/views/Options/Apis.js +++ b/src/views/Options/Apis.js @@ -27,7 +27,7 @@ import ReusableAutocomplete from "./ReusableAutocomplete"; import ShowMoreButton from "./ShowMoreButton"; import { OPT_TRANS_DEEPLX, - OPT_TRANS_OLLAMA, + // OPT_TRANS_OLLAMA, OPT_TRANS_CUSTOMIZE, OPT_TRANS_NIUTRANS, OPT_TRANS_BUILTINAI, @@ -168,8 +168,8 @@ function ApiFields({ apiSlug, isUserApi, deleteApi }) { // userPrompt = "", customHeader = "", customBody = "", - think = false, - thinkIgnore = "", + // think = false, + // thinkIgnore = "", fetchLimit = DEFAULT_FETCH_LIMIT, fetchInterval = DEFAULT_FETCH_INTERVAL, httpTimeout = DEFAULT_HTTP_TIMEOUT, @@ -337,7 +337,7 @@ function ApiFields({ apiSlug, isUserApi, deleteApi }) { )} - {apiType === OPT_TRANS_OLLAMA && ( + {/* {apiType === OPT_TRANS_OLLAMA && ( <> - )} + )} */} {apiType === OPT_TRANS_NIUTRANS && ( <>