From 293b5ae264fa5a9bef476901fa53fabceba3c995 Mon Sep 17 00:00:00 2001 From: Bo26fhmC5M <88071760+Bo26fhmC5M@users.noreply.github.com> Date: Sun, 2 Feb 2025 16:17:32 +0900 Subject: [PATCH] fix: add legacy translation support in Auto Translate Cached Only option --- src/lang/en.ts | 2 +- src/lib/ChatScreens/Chat.svelte | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lang/en.ts b/src/lang/en.ts index a0a1abbc..a034db13 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -170,7 +170,7 @@ export const languageEnglish = { summarizationPrompt: "The prompt that is used for summarization. if it is blank, it will use the default prompt. you can also use ChatML formating with {{slot}} for the chat data.", translatorPrompt: "The prompt that is used for translation. if it is blank, it will use the default prompt. you can also use ChatML formating with {{slot}} for the dest language, {{solt::content}} for the content, and {{slot::tnote}} for the translator note.", translateBeforeHTMLFormatting: "If enabled, it will translate the text before Regex scripts and HTML formatting. this could make the token lesser but could break the formatting.", - autoTranslateCachedOnly: "If enabled, it will automatically translate only the text that the user has translated previously.", + autoTranslateCachedOnly: "If enabled with Auto Translation option on, it will automatically translate only the text that the user has translated previously.", presetChain: "If it is not blank, the preset will be changed and applied randomly every time when user sends a message in the preset list in this input. preset list should be seperated by comma, for example, `preset1,preset2`.", legacyMediaFindings: "If enabled, it will use the old method to find media assets, without using the additional search algorithm.", comfyWorkflow: "Put the API workflow of comfy UI. you can get your API workflow in comfy UI by pressing the 'Workflow > Export (API)' button. you must also put {{risu_prompt}} in you workflow text. the {{risu_prompt}} will be replaced with the prompt provided by the Risu.", diff --git a/src/lib/ChatScreens/Chat.svelte b/src/lib/ChatScreens/Chat.svelte index cf15196c..004e437d 100644 --- a/src/lib/ChatScreens/Chat.svelte +++ b/src/lib/ChatScreens/Chat.svelte @@ -143,7 +143,9 @@ if(DBState.db.autoTranslateCachedOnly && DBState.db.translatorType === 'llm'){ const cache = DBState.db.translateBeforeHTMLFormatting ? await getLLMCache(data) - : await getLLMCache(await ParseMarkdown(data, charArg, 'pretranslate', chatID, getCbsCondition())) + : !DBState.db.legacyTranslation + ? await getLLMCache(await ParseMarkdown(data, charArg, 'pretranslate', chatID, getCbsCondition())) + : await getLLMCache(await ParseMarkdown(data, charArg, mode, chatID, getCbsCondition())) translateText = cache !== null }