A modern, feature-rich Progressive Web App (PWA) for seamless AI conversations using Chrome's built-in Gemini Nano model. Built with zero dependencies and optimized for privacy and performance.
This is a rough prototype and may contain bugs. The code is not organized or optimized. I currently can't properly understand what I wrote before. However, it works for now, and I will improve it later. Sorry for the inconvenience. The README was written by AI.
- π― AI-Powered Chat - Real-time streaming responses using Chrome's Gemini Nano
- π¬ Multi-turn Conversations - Full conversation history and context management
- π¨ Modern Dark/Light Themes - Beautiful UI with automatic theme detection
- π± Fully Responsive - Optimized for desktop, tablet, and mobile devices
- π Real-time Streaming - Stream responses as they're generated for better UX
- π· Image Support - Upload and analyze images with thumbnail previews
- π Text Files - Upload and process text, JSON, CSV, and Markdown files
- π΅ Audio Support - Upload audio files (MP3, WAV, OGG, M4A, FLAC, AAC) β
- β Multiple Files - Attach multiple files in a single message
- π Live Previews - See file previews before sending messages
- πΎ Chat History - Persistent chat sessions stored locally
- π Search Functionality - Find previous conversations
- βοΈ Message Editing - Edit and regenerate responses
- π·οΈ Auto-naming - Automatic chat titles from first message
- π Copy Messages - Easily copy assistant responses
- β‘ Token Tracking - Monitor API quota usage in real-time
- π Privacy First - All data stays local, no external servers
- π΄ Offline Ready - PWA support with service worker
- βοΈ Zero Dependencies - Pure vanilla JavaScript
- π IndexedDB Storage - Efficient local data persistence
- π― Modular Architecture - Well-organized, maintainable codebase
-
Browser: Chrome/Chromium 139+
-
Operating System:
- Windows 10/11
- macOS 13+ (Ventura and later)
- Linux
- ChromeOS (Platform 16389.0.0+) on Chromebook Plus devices
β οΈ Chrome for Android, iOS, and non-Chromebook Plus ChromeOS devices are not yet supported
- Storage: Minimum 22 GB free space
- Memory & CPU:
- With GPU: 4GB+ VRAM
- CPU Only: 16GB+ RAM and 4+ CPU cores
- Network: Unlimited or unmetered connection recommended
- Open This url.
- Install as PWA:
- Click the install button in the address bar
- Or use Chrome menu β "Install app"
- Enable Chrome AI APIs (see Prerequisites)
- Open the app in Chrome
- Start chatting - your first message will trigger model download (~4GB)
- Chat history is automatically saved
Chrome_AI/
βββ index.html # Main application entry point
βββ pages/ # Static pages
β βββ auth/ # Authentication pages
β βββ error/ # Error pages
β βββ static/ # Static content pages
βββ assets/
β βββ css/
β β βββ base.css # Global styles
β β βββ chat_app/ # Chat application styles
β β βββ main.css
β β βββ modules/
β βββ js/
β β βββ base.js # Core utilities
β β βββ chat_app/ # Chat application logic
β β β βββ main.js # Main application class
β β β βββ core/ # Core business logic
β β β β βββ ChatConfig.js
β β β β βββ ChatService.js
β β β β βββ DatabaseManager.js
β β β β βββ HistoryManager.js
β β β β βββ ModelManager.js
β β β β βββ SearchManager.js
β β β β βββ SettingsManager.js
β β β βββ ui/ # UI components
β β β β βββ ChatUI.js
β β β βββ utils/ # Utility functions
β β β βββ utils.js # DOM, file, and common utilities
β β β βββ MarkdownUtils.js
β β β βββ TemplateUtils.js
β β βββ pages/ # Page-specific scripts
β βββ image/
β β βββ svg/ # SVG icons
β βββ font/ # Custom fonts
β βββ brand/ # Brand assets
βββ layx/ # UI Framework
β βββ main/ # Core framework components
β βββ components/ # Reusable UI components
β βββ utilities/ # CSS utility classes
β βββ helpers/ # Layout helpers
β βββ others/ # Advanced features
βββ README.md
βββ LICENSE
- Create New Chat: Click "New Chat" to start a fresh conversation
- Chat History: Sidebar shows recent chats (up to 10 items)
- Search Chats: Search previous conversations by content
- Rename Chats: Right-click a chat to rename it
- Delete Chats: Remove chats you no longer need
Supported file types:
βββ π· Images: JPEG, PNG, WebP, GIF, SVG
βββ π Documents: TXT, MD, JSON, CSV
βββ π΅ Audio: MP3, WAV, OGG, M4A, FLAC, AAC βUsage:
- Click the attachment button
- Select one or multiple files
- See live previews before sending
- Include your message and send
- Files are processed and sent with your query
- Edit: Click the edit button (β) on your message
- Regenerate: Click regenerate (β») on assistant responses
- Copy: Click copy (Β©) to copy assistant responses
- Like/Dislike: Rate responses for feedback
- Temperature Control: Adjust response creativity (0-1)
- Theme: Switch between Light/Dark modes
- API Settings: Configure custom endpoints if needed
MVC Pattern:
- Models:
DatabaseManager,ChatConfig - Views:
ChatUI,TemplateUtils - Controllers:
ChatApplication,ChatService
Key Classes:
| Class | Purpose |
|---|---|
ChatApplication |
Main application orchestrator |
ChatService |
Chrome AI API interface |
DatabaseManager |
IndexedDB data persistence |
ChatUI |
DOM rendering and events |
FileUtils |
File type detection and reading |
MarkdownUtils |
Markdown parsing and rendering |
/* Edit color variables */
layx/main/base/variable_color.css
/* Available color schemes: */
- --primary-color
- --surface-color
- --surface-2-color
- --bg-colorMain styles: assets/css/chat_app/main.css
Component styles: assets/css/chat_app/modules/// Edit ChatConfig in main.js
const config = {
ai: {
system: 'Your system prompt here'
},
ui: {
maxHistory: 10 // Max recent chats
}
}Example: Custom Command Handler
// In main.js registerEvents()
this.ui.root.addEventListener('custom-event', async (e) => {
// Your handler logic
});| Browser | Version | Status |
|---|---|---|
| Chrome | 139+ | β Full Support |
| Edge | 139+ | β Not Supported |
| Chromium | 139+ | β Not Supported |
| Firefox | - | β Not Supported |
| Safari | - | β Not Supported |
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/AmazingFeature
- Commit your changes:
git commit -m 'Add AmazingFeature with detailed description' - Push to the branch:
git push origin feature/AmazingFeature
- Open a Pull Request with description
- Follow existing code style
- Test your changes in Chrome 139+
- Update documentation if needed
- Include meaningful commit messages
This project is licensed under the MIT License - see the LICENSE file for details.
- Basic chat functionality
- File upload support (images, text, audio)
- Chat history management
- Dark/Light themes
- Multi-file attachments
- Voice input/output
- Advanced context management
- Plugin system
- Custom system prompts
- Export conversations
- Integration with other AI providers
"Chrome AI is not available"
- Enable the required APIs in
chrome://flags/ - Ensure you're using Chrome 139+
- Check your system meets hardware requirements
"Model download failed"
- Ensure 22GB+ free storage
- Check internet connection
- Restart Chrome and try again
"Chat history not loading"
- Clear IndexedDB: Chrome DevTools β Application β Storage
- Refresh the page
- π Chrome AI Documentation
- π Report Bugs
- π‘ Request Features
- π¬ Discussions
- First Load: < 500ms
- Chat Response: Real-time streaming
- Chat History: < 100ms load time
- Memory Usage: ~50-100MB (varies with conversation size)
- β All data stored locally (IndexedDB)
- β No external API calls except Chrome AI
- β No tracking or analytics
- β HTTPS recommended for deployment
- β PWA with offline capability
If you found this project helpful, please consider:
- β Starring the repository
- π Reporting issues
- π Contributing improvements
- π’ Sharing with other
