When using the deepseek-r1 model in Ollama, remove the content between the <think></think> tags.

This commit is contained in:
mcz
2025-02-23 11:54:48 +08:00
parent 23e7b69dc5
commit ab5dd82169

View File

@@ -323,7 +323,11 @@ export const apiTranslate = async ({
case OPT_TRANS_OLLAMA: case OPT_TRANS_OLLAMA:
case OPT_TRANS_OLLAMA_2: case OPT_TRANS_OLLAMA_2:
case OPT_TRANS_OLLAMA_3: case OPT_TRANS_OLLAMA_3:
trText = res?.response; if (res?.model.startsWith('deepseek-r1')) {
trText = res?.response.replace(/<think>[\s\S]*<\/think>/i, '');
}else{
trText = res?.response;
}
isSame = text === trText; isSame = text === trText;
break; break;
case OPT_TRANS_CUSTOMIZE: case OPT_TRANS_CUSTOMIZE: