From ab5dd82169e45a92a260ab654b6a7c0ea4022eaf Mon Sep 17 00:00:00 2001 From: mcz Date: Sun, 23 Feb 2025 11:54:48 +0800 Subject: [PATCH] When using the deepseek-r1 model in Ollama, remove the content between the tags. --- src/apis/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/apis/index.js b/src/apis/index.js index f95bd09..ed222fa 100644 --- a/src/apis/index.js +++ b/src/apis/index.js @@ -323,7 +323,11 @@ export const apiTranslate = async ({ case OPT_TRANS_OLLAMA: case OPT_TRANS_OLLAMA_2: case OPT_TRANS_OLLAMA_3: - trText = res?.response; + if (res?.model.startsWith('deepseek-r1')) { + trText = res?.response.replace(/[\s\S]*<\/think>/i, ''); + }else{ + trText = res?.response; + } isSame = text === trText; break; case OPT_TRANS_CUSTOMIZE: