feat: translate FAQs and famous people insights via Chrome Translator API - #6
Open
sdass1918 wants to merge 31 commits into
Open
feat: translate FAQs and famous people insights via Chrome Translator API#6sdass1918 wants to merge 31 commits into
sdass1918 wants to merge 31 commits into
Conversation
…performance timing
The context-menu click handler must be async because subsequent logic awaits asynchronous checks (e.g. AI availability) before continuing. Without an async listener, await cannot be used and the workflow fails. Co-authored-by: Copilot Autofix powered by AI <[email protected]>
checkAIAvailability() is async, but it's currently used as a boolean without await, so the Promise is always truthy and this guard never blocks when AI is unavailable. Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
…errors Co-authored-by: Copilot Autofix powered by AI <[email protected]>
The parent context menu was registered for all pages, causing it to appear outside web.archive.org playback URLs. Clicking the menu on unsupported pages failed because no content script was injected there ("Receiving end does not exist"). Restrict the menu to Wayback playback URLs to prevent invalid usage.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
…rformance metrics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Gemini Nano cannot reliably generate structured insights (FAQs, famous people) in target languages it often outputs in Spanish or other languages even when Hindi is requested.
Solution
targetLanguageprompt injection fromgetStructuredInsights()—insights are now always generated in English (where Gemini Nano is reliable).
translateInsights()toAISession— uses the Chrome Translator APIto translate each FAQ question/answer and famous person name individually,
with a single translator session for efficiency.
background.jspasses English insights throughtranslateInsights()beforedispatching
STRUCTURED_INSIGHTSto the content script.dispatching
STRUCTURED_INSIGHTSto the content script.Files changed
ai/utility.js— revert language prompt, addtranslateInsights()methodbackground.js— translate insights before sending to content scriptREADME.md— addfeature/translate-faqs-insightsto branching diagram