Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
philffm committed Nov 19, 2024
1 parent c18d69f commit 1754e0b
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 9 deletions.
11 changes: 11 additions & 0 deletions chrome-extension/background.js
Original file line number Diff line number Diff line change
@@ -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' });
});
}
});
8 changes: 5 additions & 3 deletions chrome-extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 <p> 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
});
Expand Down Expand Up @@ -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 <a href="https://app.formbricks.com/s/cm3kn4nmg00032dmy85vlbjzp" target="_blank">give feedback</a> or <a href="https://philwornath.com/?ref=aish#contact" target="_blank">contact me</a>.';
reject(error);
}
});
Expand Down
18 changes: 17 additions & 1 deletion chrome-extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
}
}
9 changes: 5 additions & 4 deletions chrome-extension/translations.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.2",
"version": "1.0.8",
"languages": [
{
"code": "en",
Expand Down Expand Up @@ -103,7 +103,7 @@
},
{
"code": "bg",
"name": "Ъългарски",
"name": "Ъливки",
"emoji": "🇧🇬"
},
{
Expand All @@ -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": "<h2>AI Summary 🪄 of this page:</h2><h3>AI Summary Helper - Your Secret Weapon Around The Web</h3> <p>Turn overwhelming articles into bite-sized brilliance. Summarize, translate, and conquer the web with style! 🌍</p> <h3>Standup Comedy:</h3> <p>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.</p> <h3>Striking Quotes:</h3> <ul><li>‘Clocks closer to black holes run slower.’ Thanks, Einstein—and AI Summary Helper—for making me smarter at dinner parties.</li><li>‘Say goodbye to cluttered tabs and missed reads.’ Finally, my browser looks less like a hoarder’s attic!</li><li>‘Summarize articles with a personal touch.’ Because who doesn't want Shakespeare with a bit of sass?</li></ul> <h3>#AIHelper 🚀</h3> <p>Makes TL;DR an art form. 🌍 From science papers to Shakespeare—summarized, personalized, & translated! Try it now 👉 <a href='https://philwornath.gumroad.com/l/ai-summary-helper'>Gumroad</a></p>",
"features": "Features 🔍 ",
"featureList": [
"Summarize articles with a personal touch ✨",
Expand All @@ -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": "<p>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 <strong>AI Summary Helper</strong>, you can dive straight into the essence of any article, summarized just for you in English.</p><p>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:</p><blockquote>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.</blockquote><p>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.</p><h3>How does this work in practice?</h3><ul><li>A food blogger's in-depth recipe? Summarized into quick prep instructions.</li><li>A lengthy editorial on the economy? Key takeaways extracted for your busy schedule.</li><li>Curious about Shakespeare? Get the plot of Macbeth in three lines.</li></ul><p>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.</p><p>Say goodbye to cluttered tabs and missed reads. Start a smarter way to browse the web with AI Summary Helper today! 🚀</p>"
"headline": "Translate and Understand Texts Better in English 🌍",
"text": "<p>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 <strong>AI Summary Helper</strong>, you can dive straight into the essence of any article, summarized just for you in English.</p><p>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:</p><blockquote>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.</blockquote><p>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.</p><h3>How does this work in practice?</h3><ul><li>A food blogger's in-depth recipe? Summarized into quick prep instructions.</li><li>A lengthy editorial on the economy? Key takeaways extracted for your busy schedule.</li><li>Curious about Shakespeare? Get the plot of Macbeth in three lines.</li></ul><p>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.</p><p>Say goodbye to cluttered tabs and missed reads. Start a smarter way to browse the web with AI Summary Helper today! 🚀</p><h2>Learn a New Language 🌎: Comprehend Articles in Any Supported Language</h2><p>Want to read articles in <strong>Spanish</strong>, <strong>Japanese</strong>, or <strong>Arabic</strong> 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.</p><p>Here’s how it works:</p><ul><li><strong>Reading Local News Anywhere:</strong> Interested in French politics or German technology? AI Summary Helper offers summaries in their native languages with context to match your understanding.</li><li><strong>Studying Foreign Literature:</strong> Want to appreciate <em>Gabriel García Márquez</em> in Spanish or <em>Haruki Murakami</em> in Japanese? Highlight key phrases while getting context-rich summaries in English for a seamless learning experience.</li></ul><p>Languages supported: 🇬🇧 English, 🇪🇸 Spanish, 🇩🇪 German, 🇫🇷 French, 🇮🇹 Italian, 🇵🇹 Portuguese, 🇳🇱 Dutch, 🇷🇺 Russian, 🇺🇦 Ukrainian, 🇵🇱 Polish, 🇸🇪 Swedish, 🇩🇰 Danish, 🇯🇵 Japanese, 🇨🇳 Chinese, 🇰🇷 Korean, 🇮🇳 Hindi, 🇹🇭 Thai, 🇮🇩 Indonesian, 🇦🇪 Arabic, 🇹🇷 Turkish, 🇧🇬 Bulgarian, 🇷🇴 Romanian.</p><p>By blending translation with comprehension, AI Summary Helper is your guide to mastering new languages effortlessly!</p>"
},
"proposeFeature": "Propose a Feature 💡",
"proposeFeatureText": "Got a brilliant idea? Share it with us <a href=\"https://app.formbricks.com/s/cm3kn4nmg00032dmy85vlbjzp\">here</a> and shape the future of AI Summary Helper! 💬",
Expand Down
3 changes: 2 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 1754e0b

Please sign in to comment.