From cfc6dec1f434eeb05a9344dc0ed407d6bf19b0a2 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Fri, 11 Jul 2025 21:18:59 -0400 Subject: [PATCH] remove unnecessary preservation in progress calculation that was creating placeholder confusion --- src/translate-modal.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/translate-modal.js b/src/translate-modal.js index ec9d9a0..946e5f7 100644 --- a/src/translate-modal.js +++ b/src/translate-modal.js @@ -333,14 +333,8 @@ export function openTranslateModal() { ? `${rawContent.substring(0, maxLength)}...` : rawContent; - const { preservedText } = preserveSpecialContent(contentToProcess); - - // Build the actual prompt that will be sent to the AI - const prompt = `Translate the following HTML content into ${SUPPORTED_LANGUAGES[targetLanguage]}. The input is in English and formatted as HTML, which includes formatting, code blocks, and technical content. Ensure the output preserves the structure, syntax, and formatting of the original. Do not translate or modify placeholders like __CODE_0__, __URI_0__, __HTML_0__, etc., as they represent code blocks, URLs, or HTML elements that should remain unchanged. Only translate the surrounding text. Here is the text to translate: - -${preservedText}`; - - const tokenInfo = await countTokensWithUpstream(prompt, getSelectedModel()); + // Just estimate tokens without preservation for progress calculation + const tokenInfo = await countTokensWithUpstream(contentToProcess, getSelectedModel()); const estimatedSeconds = estimateProcessingTime(tokenInfo.totalTokens); // Create progress indicator