diff --git a/background.js b/background.js index 55a5a01..16cf762 100644 --- a/background.js +++ b/background.js @@ -24,14 +24,6 @@ async function handleGeminiRequest({ apiKey, prompt, tab, action = 'generateText throw new Error('Daily limit reached (1,000 requests). Resets at midnight PT.'); } - // Check cache (keyed by tab + prompt hash) - const cacheStr = prompt || jobDescription; - const cacheKey = `cache_${tab}_${action}_${hashString(cacheStr)}`; - const cached = await getCached(cacheKey); - if (cached) { - return cached; // returns either text object or pdf object - } - // Truncate text const maxChars = 6000; const trimmedPrompt = prompt && prompt.length > maxChars @@ -63,9 +55,7 @@ async function handleGeminiRequest({ apiKey, prompt, tab, action = 'generateText if (action === 'generatePdf') { if (!data.pdf) throw new Error('Empty PDF response from server.'); await incrementUsage(); - const result = { pdf: data.pdf, filename: data.filename, fromCache: false }; - await setCached(cacheKey, result); - return result; + return { pdf: data.pdf, filename: data.filename, fromCache: false }; } else { const text = data.candidates?.[0]?.content?.parts?.[0]?.text; if (!text) { @@ -73,9 +63,7 @@ async function handleGeminiRequest({ apiKey, prompt, tab, action = 'generateText continue; } await incrementUsage(); - const result = { text, fromCache: false }; - await setCached(cacheKey, result); - return result; + return { text, fromCache: false }; } } diff --git a/content.js b/content.js index cb9094c..38c09f5 100644 --- a/content.js +++ b/content.js @@ -580,8 +580,11 @@ results[tab] = text; // Render markdown-like output + const isArabic = /[\u0600-\u06FF]/.test(text); + const rtlAttr = isArabic ? 'dir="rtl" style="text-align: right; padding-right: 15px;"' : ''; + pane.innerHTML = ` -