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();