-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/2 apis integration #33
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
Merged
Merged
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Resolved conflicts by keeping both Workspace and Demos navigation items, and all page imports (TranslatorTestPage, PromptTestPage, and WorkspacePage). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…examples - Revised application overview to include interactive demos and practical implementations of Chrome's AI APIs. - Added detailed features section outlining integrations with Rewriter, Translator, and Prompt APIs. - Introduced new UI components and developer experience enhancements. - Included API usage examples for Rewriter, Translator, and Prompt services. - Updated browser requirements and next steps for future development.
Collaborator
|
@simandebvu Awesome stuff!!! I am having some issues with the setup locally, but it should be resolved soon 👍 Are you also able to update the |
- Added default language support ('en') in TextInputPanel and rewriter options.
- Updated ChromeAiDiagnostics to reflect prompt API availability status.
- Improved download progress handling in PromptTest, RewriterTest, and TranslatorTest to manage undefined values.
- Enhanced TranslatorTest with lazy initialization notes and improved error handling for service initialization.
- Updated translator API to require source and target language parameters for availability checks.
- Refined documentation for global AI API capabilities and added logging for debugging purposes.
…arget language parameters
- Modified the availability check for the Translator API to include specific source ('en') and target ('es') language parameters, enhancing accuracy in detecting service availability.
- Introduced a new env.example file containing placeholders for API keys, facilitating easier setup for development and testing environments.
seshxn
approved these changes
Oct 14, 2025
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.
Implement Core Utilities for Chrome's Built-in AI APIs
📋 Summary
Complete implementation of TypeScript wrappers for Chrome's three built-in AI APIs (Rewriter, Translator, Prompt/Language Model) with comprehensive error handling, browser compatibility detection, and interactive demo pages.
Closes: Backlog card - "Implement core utilities for Chrome's Built-in AI APIs with proper error handling"
✅ Acceptance Criteria Met
🎯 Tasks Completed
1. ✅ Create Chrome Rewriter API Wrapper
Implementation:
createRewriter(),rewriteText(),rewriteTextStreaming()RewriterServiceclass with reading level presetsFiles:
rewriter.ts,services/RewriterService.ts,test/RewriterTest.tsx2. ✅ Create Chrome Prompt API Wrapper
Implementation:
createSession(),sendPrompt(),sendPromptStreaming()PromptServiceclass with conversation managementFiles:
prompt.ts,services/PromptService.ts,test/PromptTest.tsx3. ✅ Create Chrome Translation API Wrapper
Implementation:
createTranslator(),translateText(),detectLanguage()TranslatorServiceclass with auto-detectionFiles:
translator.ts,services/TranslatorService.ts,test/TranslatorTest.tsx4. ✅ Implement API Availability Detection
Implementation:
capabilities.ts- Runtime availability checking for all APIsChromeAiDiagnosticscomponent - Visual diagnostics dashboardunavailable,available,downloadableFiles:
capabilities.ts,test/ChromeAiDiagnostics.tsx5. ✅ Add Graceful Fallback Messaging
Implementation:
browserCompatibility.ts- Browser detection and version checkingBrowserCompatibilityBannercomponent - Requirements displayFiles:
browserCompatibility.ts,common/BrowserCompatibilityBanner.tsx6. ✅ Add Loading States and Progress Indicators
Implementation:
ModelDownloadProgresscomponent - Download visualizationFiles:
ui/ModelDownloadProgress.tsx,ui/LoadingSpinner.tsx,ui/ProgressBar.tsx,ui/Skeleton.tsx🏗️ Architecture
Three-Layer Design
📊 Implementation Stats
🎨 Key Features
Error Handling
RewriterError- 8 error codes (NOT_AVAILABLE, NOT_SUPPORTED, etc.)TranslatorError- 9 error codes (UNSUPPORTED_LANGUAGE, etc.)PromptError- 8 error codes (PROMPT_FAILED, RESPONSE_ERROR, etc.)Browser Compatibility
Progress Tracking
Type Safety
anytypes used🧪 Testing
Build Status
✅ TypeScript compilation successful
✅ ESLint: 0 errors, 0 warnings
✅ Vite build successful
✅ Bundle: 371 kB (109 kB gzipped)
Manual Testing
✅ All three APIs tested in Chrome Canary
✅ Browser compatibility detection working
✅ Download progress visualization verified
✅ Error handling validated
✅ Fallback messages displayed correctly
✅ Loading states functioning properly
💡 Usage Examples
Rewriter API
Translator API
Prompt API
🎮 Demo Pages
Central Landing Page (
/demos)Interactive Test Pages
/demos/rewriter) - Text simplification with reading levels/demos/translator) - Translation with language detection/demos/prompt) - Conversational AI interfaceAll demos include:
📂 Files Added/Modified
New Core Files
New UI Components
Test Infrastructure
🚀 Technical Highlights
Performance
Reliability
Developer Experience
User Experience
🔗 Related
Branch:
feat/2-apis-integrationBase:
mainChrome Requirements:
optimization-guide-on-device-model,prompt-api-for-gemini-nano✅ Checklist
Ready for review! 🎉
This PR delivers a production-ready, type-safe implementation of Chrome's Built-in AI APIs with comprehensive error handling, browser compatibility detection, and excellent developer experience.