diff --git a/chrome-extension/background.js b/chrome-extension/background.js index fee69a4..abb53d5 100644 --- a/chrome-extension/background.js +++ b/chrome-extension/background.js @@ -1 +1,12 @@ // Currently, we don't have background tasks + +chrome.commands.onCommand.addListener((command) => { + console.log(`Command received: ${command}`); + if (command === 'toggle-popup') { + chrome.action.openPopup(); + } else if (command === 'fetch-summary') { + chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { + chrome.tabs.sendMessage(tabs[0].id, { action: 'fetchSummary' }); + }); + } +}); diff --git a/chrome-extension/content.js b/chrome-extension/content.js index 419ee9d..78720d0 100644 --- a/chrome-extension/content.js +++ b/chrome-extension/content.js @@ -99,7 +99,9 @@ async function fetchSummary(additionalQuestions, selectedLanguage, prompt, summa prompt += `\n\nImportant: Summarize in ${selectedLanguage} language.`; } - prompt += `\n\nPlease limit the summary to approximately ${summaryLength} words.`; + + // Convert word limit to token limit + const tokenLimit = summaryLength * 1.5; // Assuming 1 word ≈ 1.5 tokens on average const truncatedContent = truncateToTokenLimit(content, MAX_TOKENS); @@ -121,7 +123,7 @@ async function fetchSummary(additionalQuestions, selectedLanguage, prompt, summa model: modelIdentifier, messages: [ { role: 'system', content: 'You summarize content and return a html div with h2 headings and
paragraphs. When you quote, keep it literal and in the input language.' }, - { role: 'user', content: 'Stick to word limit of ' + summaryLength + ' words. ' + 'Output Language: ' + selectedLanguage + '. ' + prompt + truncatedContent }, + { role: 'user', content: 'Strictly stick to word limit of ' + summaryLength + ' words or ' + tokenLimit + ' tokens' + 'Output Language: ' + selectedLanguage + '. ' + prompt + truncatedContent }, ], stream: false // Ensure streaming is off for local models }); @@ -180,7 +182,7 @@ async function fetchSummary(additionalQuestions, selectedLanguage, prompt, summa } catch (error) { console.error('❌ Error fetching summary:', error); - targetElement.querySelector('.placeholder').innerHTML = 'Error fetching summary. Please try again later.'; + targetElement.querySelector('.placeholder').innerHTML = 'Error fetching summary. Please try again later. Make sure your API key is set and internet connection is stable. If the problem persists, please give feedback or contact me.'; reject(error); } }); diff --git a/chrome-extension/manifest.json b/chrome-extension/manifest.json index 663591d..b44b25e 100644 --- a/chrome-extension/manifest.json +++ b/chrome-extension/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 3, "name": "__MSG_extensionName__", "default_locale": "en", - "version": "1.5.18", + "version": "1.5.19", "description": "__MSG_extensionDescription__", "permissions": [ "tabs", @@ -37,5 +37,21 @@ }, "content_security_policy": { "extension_pages": "script-src 'self'; object-src 'self'" + }, + "commands": { + "toggle-popup": { + "suggested_key": { + "default": "Ctrl+Shift+Y", + "mac": "Command+Shift+Y" + }, + "description": "Toggle the extension popup" + }, + "fetch-summary": { + "suggested_key": { + "default": "Ctrl+Shift+S", + "mac": "Command+Shift+S" + }, + "description": "Fetch a summary of the current page" + } } } \ No newline at end of file diff --git a/chrome-extension/translations.json b/chrome-extension/translations.json index 1a35956..507e0c2 100644 --- a/chrome-extension/translations.json +++ b/chrome-extension/translations.json @@ -1,5 +1,5 @@ { - "version": "1.0.2", + "version": "1.0.8", "languages": [ { "code": "en", @@ -103,7 +103,7 @@ }, { "code": "bg", - "name": "Ъългарски", + "name": "Ъливки", "emoji": "🇧🇬" }, { @@ -116,6 +116,7 @@ "title": "AI Summary Helper 🚀", "about": "About 📖", "aboutText": "Transform your browsing into a powerhouse of productivity with AI Summary Helper. Never let another article slip through the cracks! 🌟", + "aisummary": "
Turn overwhelming articles into bite-sized brilliance. Summarize, translate, and conquer the web with style! 🌍
Ever felt like reading a 10-page article for one nugget of info? It's like buying a watermelon for a single seed. AI Summary Helper says, 'Hold up, I got you!' Why sweat through astrophysics when we can whisper Einstein’s secrets to you in 3 sentences? Or transform Shakespeare into 'Macbeth: TL;DR - Dude goes mad, everyone dies.' Oh, and it translates too! Learning Japanese now feels like karaoke with subtitles.
Makes TL;DR an art form. 🌍 From science papers to Shakespeare—summarized, personalized, & translated! Try it now 👉 Gumroad
", "features": "Features 🔍 ", "featureList": [ "Summarize articles with a personal touch ✨", @@ -125,8 +126,8 @@ "Cross-Platform: Bookmarklet Generator for all browsers and OS, including iOS/Android" ], "localizedFeature": { - "headline": "Read and Understand Articles in English – Effortlessly! 🌍", - "text": "Imagine browsing through a sea of articles online, trying to keep up with your favorite blogs, news outlets, or research papers. It’s a challenge, right? Not anymore. With AI Summary Helper, you can dive straight into the essence of any article, summarized just for you in English.
Whether you're tackling a 10-page research paper or the latest trending blog, AI Summary Helper is here to save the day. For example, imagine a science article explaining how black holes affect time. Instead of wading through pages of astrophysics jargon, you get a concise, easy-to-digest summary:
Black holes warp time through intense gravitational pull. Clocks closer to the black hole run slower compared to those farther away, a phenomenon explained by Einstein's theory of relativity.
Simple, isn’t it? And not just summaries! Tailor them to suit your needs – want a business angle, an academic focus, or a casual breakdown? You’re in control.
AI Summary Helper doesn’t just help you understand; it enhances how you absorb information. Whether you’re a professional, student, or curious learner, English content now flows into your brain effortlessly.
Say goodbye to cluttered tabs and missed reads. Start a smarter way to browse the web with AI Summary Helper today! 🚀
" + "headline": "Translate and Understand Texts Better in English 🌍", + "text": "Imagine browsing through a sea of articles online, trying to keep up with your favorite blogs, news outlets, or research papers. It’s a challenge, right? Not anymore. With AI Summary Helper, you can dive straight into the essence of any article, summarized just for you in English.
Whether you're tackling a 10-page research paper or the latest trending blog, AI Summary Helper is here to save the day. For example, imagine a science article explaining how black holes affect time. Instead of wading through pages of astrophysics jargon, you get a concise, easy-to-digest summary:
Black holes warp time through intense gravitational pull. Clocks closer to the black hole run slower compared to those farther away, a phenomenon explained by Einstein's theory of relativity.
Simple, isn’t it? And not just summaries! Tailor them to suit your needs – want a business angle, an academic focus, or a casual breakdown? You’re in control.
AI Summary Helper doesn’t just help you understand; it enhances how you absorb information. Whether you’re a professional, student, or curious learner, English content now flows into your brain effortlessly.
Say goodbye to cluttered tabs and missed reads. Start a smarter way to browse the web with AI Summary Helper today! 🚀
Want to read articles in Spanish, Japanese, or Arabic but struggling with comprehension? AI Summary Helper is your multilingual assistant! Simply select your desired language, and let the app translate, summarize, and help you learn while reading.
Here’s how it works:
Languages supported: 🇬🇧 English, 🇪🇸 Spanish, 🇩🇪 German, 🇫🇷 French, 🇮🇹 Italian, 🇵🇹 Portuguese, 🇳🇱 Dutch, 🇷🇺 Russian, 🇺🇦 Ukrainian, 🇵🇱 Polish, 🇸🇪 Swedish, 🇩🇰 Danish, 🇯🇵 Japanese, 🇨🇳 Chinese, 🇰🇷 Korean, 🇮🇳 Hindi, 🇹🇭 Thai, 🇮🇩 Indonesian, 🇦🇪 Arabic, 🇹🇷 Turkish, 🇧🇬 Bulgarian, 🇷🇴 Romanian.
By blending translation with comprehension, AI Summary Helper is your guide to mastering new languages effortlessly!
" }, "proposeFeature": "Propose a Feature 💡", "proposeFeatureText": "Got a brilliant idea? Share it with us here and shape the future of AI Summary Helper! 💬", diff --git a/style.css b/style.css index c12b960..e954ad4 100644 --- a/style.css +++ b/style.css @@ -2,7 +2,7 @@ body { font-family: 'Roboto', 'Lato', 'Arial', sans-serif; font-size: 18px; padding: 0; - background-color: #f4f4f9; + background-color: #ffff; color: #333; margin: 0; } @@ -56,6 +56,7 @@ blockquote::before { border-radius: 8px; overflow: hidden; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + background-color: #fff; } .window-row {