From 9550fb8e94e507e54bb56a2ff7794bb0c0e53fc3 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Fri, 11 Jul 2025 20:54:56 -0400 Subject: [PATCH] re-enable relative to absolute URL conversion for remote translations --- src/translation.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/translation.js b/src/translation.js index 6993f09..675bb8e 100644 --- a/src/translation.js +++ b/src/translation.js @@ -503,10 +503,12 @@ export async function translateHTML(htmlContent, targetLanguage, sourceUrl = nul throw new Error("Unable to extract meaningful content from provided HTML."); } - // Skip URL conversion during chunking to avoid performance overhead - // We'll add base tag instead which is more efficient + // Convert relative URLs to absolute if sourceUrl is provided let processedContent = htmlContent; - console.log('Skipping URL conversion for chunked translation - will use base tag instead'); + if (sourceUrl) { + processedContent = convertRelativeToAbsolute(htmlContent, sourceUrl); + console.log('Converted relative URLs using base URL:', sourceUrl); + } // Use actual token limits instead of character limits const maxTokens = getSelectedModelMaxTokens();