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
- 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
