-
Notifications
You must be signed in to change notification settings - Fork 852
Claude/review src files 011 c uv uy qzzb4 x4 v pk ze g4f m #903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Claude/review src files 011 c uv uy qzzb4 x4 v pk ze g4f m #903
Conversation
…iled instructions Upgraded all AI prompts throughout the extension to use a hybrid markdown + XML structure with explicit role definitions, task descriptions, instructions, output formats, and constraints. This provides better clarity and more consistent, high-quality responses from AI models. Changes: - YouTube/Bilibili video summarizers: Added structured output format with overview, main topics, key takeaways, and important details sections - GitHub analyzer: Separate improved prompts for issues/PRs and commits with conventional commit message format support - arXiv paper analyzer: Added research domain classification, methodology breakdown, and relevance keywords - Search engine handler: Enhanced with search intent classification and structured answer format - Selection tools (Explain, Translate, Summary, Polish, Code, Sentiment): Complete rewrite with detailed instructions and structured outputs - Menu tools: Improved page summarization with content type identification - System prompts: Enhanced base prompts for Chat/Completion/Custom APIs with explicit capabilities, guidelines, and constraints All prompts now include: - Clear role and task definitions - Step-by-step instructions - Structured output format templates - Explicit constraints to prevent hallucination - Multi-language support where appropriate This addresses the need for more reliable, structured AI responses across all extension features.
…locale Streamlined the build configuration to reduce complexity and build time: Build Simplification: - Removed Firefox build output (kept Chrome/Chromium only) - Disabled webpack concatenateModules for better debugging - Removed minimal build variants (without-katex-and-tiktoken) - Removed Safari build script from package.json - Build now produces single chromium/ output directory with full features Locale Simplification: - Removed all non-English locales (de, es, fr, in, it, ja, ko, pt, ru, tr, zh-hans, zh-hant) - Kept only English (en) locale - Updated languageList to only include auto and en - Simplified getNavigatorLanguage() to always return 'en' - Removed language-specific model defaults (Chinese → Moonshot) - Updated resources.mjs to import only English translations Documentation: - Removed non-English README files (README_IN.md, README_JA.md, README_TR.md, README_ZH.md) - Kept only main README.md Benefits: - Faster build times (single target, no variants) - Smaller codebase (~13 locale directories removed) - Easier maintenance (one browser target) - Better debuggability (no concatenation) - Clearer output structure Build output: build/chromium/ and build/chromium.zip
Complete platform cleanup to streamline development for Chrome/Chromium only: **Deleted Safari-related files:** - safari/ directory (build scripts, patches, app-dmg config) **Deleted Firefox-related files:** - src/manifest.v2.json (Firefox manifest) **Modified browser detection:** - src/utils/is-safari.mjs - now always returns false - src/utils/is-firefox.mjs - now always returns false **Updated CI/CD workflows:** - .github/workflows/pre-release-build.yml - removed Firefox build artifacts - .github/workflows/tagged-release.yml - removed Safari and Firefox release uploads **Updated documentation:** - AGENTS.md - reflected Chrome-only build structure This cleanup builds upon the previous localization and build simplification, creating a focused Chrome-only development environment with faster builds and reduced maintenance overhead.
|
Caution Review failedThe pull request is closed. WalkthroughThe PR consolidates the project to Chrome-only support by removing Firefox, Safari, and Chromium-without-KaTeX build variants, simplifying CI/CD workflows. All non-English localization files and localized README documents are deleted. Configuration is updated to hardcoded English language support and Chrome-specific behavior. Prompt templates across content-script modules are restructured into formal multi-section formats with explicit Role, Task, Instructions, and Output Format blocks. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Areas requiring extra attention:
Possibly related PRs
Suggested labels
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (41)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
Summary of ChangesHello @USERNAME-STOCK, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on simplifying the project's build process by targeting Chrome exclusively and modernizing the codebase. It also enhances the AI's output quality through improved prompt engineering and reduces the project's complexity by removing multi-language support. Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a significant and valuable refactoring. The AI prompts have been completely restructured into a more detailed and consistent markdown/XML format, which should greatly improve the quality and reliability of AI responses. The build process has also been simplified by focusing on a Chrome-only, English-only distribution, which reduces complexity and speeds up development. The removal of support for other browsers and languages is a major change, but it's well-documented and aligns with the stated goals. My review includes one suggestion for improving maintainability by reducing code duplication in the new prompt templates.
| translateToEn: { | ||
| icon: <Globe />, | ||
| label: 'Translate (To English)', | ||
| genPrompt: createGenPrompt({ | ||
| isTranslation: true, | ||
| targetLanguage: 'English', | ||
| }), | ||
| genPrompt: async (selection) => { | ||
| const targetLanguage = 'English' | ||
| return `## Role | ||
| <role> | ||
| You are a professional translator with expertise in maintaining semantic accuracy, cultural nuance, and stylistic tone across languages. | ||
| </role> | ||
| ## Task | ||
| <task> | ||
| Translate the selected text into ${targetLanguage} while preserving the original meaning, tone, style, and formatting. | ||
| </task> | ||
| ## Instructions | ||
| <instructions> | ||
| 1. **Analyze source text**: Identify tone and cultural elements | ||
| 2. **Translate accurately**: Preserve semantic meaning and style | ||
| 3. **Preserve formatting**: Maintain markdown and structure | ||
| 4. **Cultural adaptation**: Use appropriate cultural equivalents | ||
| </instructions> | ||
| ## Output Format | ||
| <output_format> | ||
| [Translated text with original formatting preserved] | ||
| </output_format> | ||
| ## Input Data | ||
| <input_data> | ||
| Target Language: ${targetLanguage} | ||
| Source Text: | ||
| ${selection} | ||
| </input_data> | ||
| ## Constraints | ||
| <constraints> | ||
| - Provide ONLY the translated text | ||
| - Preserve all formatting exactly as in source | ||
| - If text is already in ${targetLanguage}, state "Text is already in ${targetLanguage}" | ||
| </constraints>` | ||
| }, | ||
| }, | ||
| translateToZh: { | ||
| icon: <Globe />, | ||
| label: 'Translate (To Chinese)', | ||
| genPrompt: createGenPrompt({ | ||
| isTranslation: true, | ||
| targetLanguage: 'Chinese', | ||
| }), | ||
| genPrompt: async (selection) => { | ||
| const targetLanguage = 'Chinese' | ||
| return `## Role | ||
| <role> | ||
| You are a professional translator with expertise in maintaining semantic accuracy, cultural nuance, and stylistic tone across languages. | ||
| </role> | ||
| ## Task | ||
| <task> | ||
| Translate the selected text into ${targetLanguage} while preserving the original meaning, tone, style, and formatting. | ||
| </task> | ||
| ## Instructions | ||
| <instructions> | ||
| 1. **Analyze source text**: Identify tone and cultural elements | ||
| 2. **Translate accurately**: Preserve semantic meaning and style | ||
| 3. **Preserve formatting**: Maintain markdown and structure | ||
| 4. **Cultural adaptation**: Use appropriate cultural equivalents | ||
| </instructions> | ||
| ## Output Format | ||
| <output_format> | ||
| [Translated text with original formatting preserved] | ||
| </output_format> | ||
| ## Input Data | ||
| <input_data> | ||
| Target Language: ${targetLanguage} | ||
| Source Text: | ||
| ${selection} | ||
| </input_data> | ||
| ## Constraints | ||
| <constraints> | ||
| - Provide ONLY the translated text | ||
| - Preserve all formatting exactly as in source | ||
| - If text is already in ${targetLanguage}, state "Text is already in ${targetLanguage}" | ||
| </constraints>` | ||
| }, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prompts for translateToEn and translateToZh are nearly identical, leading to significant code duplication. To improve maintainability, you can extract the common logic into a helper function.
You could define a createTranslationPrompt helper at the top of the file:
const createTranslationPrompt = (targetLanguage) => async (selection) => {
return `## Role
<role>
You are a professional translator with expertise in maintaining semantic accuracy, cultural nuance, and stylistic tone across languages.
</role>
## Task
<task>
Translate the selected text into ${targetLanguage} while preserving the original meaning, tone, style, and formatting.
</task>
## Instructions
<instructions>
1. **Analyze source text**: Identify tone and cultural elements
2. **Translate accurately**: Preserve semantic meaning and style
3. **Preserve formatting**: Maintain markdown and structure
4. **Cultural adaptation**: Use appropriate cultural equivalents
</instructions>
## Output Format
<output_format>
[Translated text with original formatting preserved]
</output_format>
## Input Data
<input_data>
Target Language: ${targetLanguage}
Source Text:
${selection}
</input_data>
## Constraints
<constraints>
- Provide ONLY the translated text
- Preserve all formatting exactly as in source
- If text is already in ${targetLanguage}, state "Text is already in ${targetLanguage}"
</constraints>`
}Then, you can simplify the translateToEn and translateToZh definitions like this:
translateToEn: {
icon: <Globe />,
label: 'Translate (To English)',
genPrompt: createTranslationPrompt('English'),
},
translateToZh: {
icon: <Globe />,
label: 'Translate (To Chinese)',
genPrompt: createTranslationPrompt('Chinese'),
},
PR Type
Enhancement, Documentation
Description
Restructured all AI prompts with hybrid markdown + XML format for consistency
Simplified build process to Chrome-only with single output variant
Streamlined locale support to English only
Diagram Walkthrough
File Walkthrough
8 files
Rewrite selection tool prompts with structured formatEnhance GitHub issue/PR analyzer prompts with structureUpgrade system prompts with detailed capabilities and guidelinesRestructure search engine handler prompt with instructionsAdd structured academic paper analysis prompt formatImplement structured page summarization promptEnhance video summarizer with structured output formatEnhance Bilibili video summarizer with structured format5 files
Simplify build to Chrome-only with single outputSet default model to English and simplify language detectionReduce language list to English onlyHardcode Firefox detection to false for Chrome-only buildHardcode Safari detection to false for Chrome-only build1 files
Update documentation for Chrome-only, English-only build27 files
Summary by CodeRabbit
Chores
Refactor