Skip to content

A modern, feature-rich Progressive Web App (PWA) for seamless AI conversations using Chrome built-in AI model. Built with zero dependencies and optimized for privacy and performance.

License

Notifications You must be signed in to change notification settings

arif891/chrome_ai_ui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

192 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Chrome Built-in AI Chat UI

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.

App Screenshot

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.

✨ Key Features

Core Functionality

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

File Management

  • πŸ“· 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

User Experience

  • πŸ’Ύ 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

Technical Excellence

  • πŸ”’ 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

πŸ“‹ Prerequisites

System Requirements

  • 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

Hardware Requirements

  • 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

πŸš€ Quick Start

Installation

  1. Open This url.
  2. Install as PWA:
    • Click the install button in the address bar
    • Or use Chrome menu β†’ "Install app"

First Use

  1. Enable Chrome AI APIs (see Prerequisites)
  2. Open the app in Chrome
  3. Start chatting - your first message will trigger model download (~4GB)
  4. Chat history is automatically saved

πŸ“ Project Structure

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

🎯 Core Features Deep Dive

Chat Management

  • 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

File Attachments

Supported file types:
β”œβ”€β”€ πŸ“· Images: JPEG, PNG, WebP, GIF, SVG
β”œβ”€β”€ πŸ“„ Documents: TXT, MD, JSON, CSV
└── 🎡 Audio: MP3, WAV, OGG, M4A, FLAC, AAC ❌

Usage:

  1. Click the attachment button
  2. Select one or multiple files
  3. See live previews before sending
  4. Include your message and send
  5. Files are processed and sent with your query

Message Operations

  • 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

Settings

  • Temperature Control: Adjust response creativity (0-1)
  • Theme: Switch between Light/Dark modes
  • API Settings: Configure custom endpoints if needed

πŸ› οΈ Development

Architecture Overview

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

Customization

1. Theme Customization

/* Edit color variables */
layx/main/base/variable_color.css

/* Available color schemes: */
- --primary-color
- --surface-color
- --surface-2-color
- --bg-color

2. UI Styling

Main styles:     assets/css/chat_app/main.css
Component styles: assets/css/chat_app/modules/

3. Configuration

// Edit ChatConfig in main.js
const config = {
  ai: {
    system: 'Your system prompt here'
  },
  ui: {
    maxHistory: 10  // Max recent chats
  }
}

Adding New Features

Example: Custom Command Handler

// In main.js registerEvents()
this.ui.root.addEventListener('custom-event', async (e) => {
  // Your handler logic
});

πŸ“¦ Browser Support

Browser Version Status
Chrome 139+ βœ… Full Support
Edge 139+ ❌ Not Supported
Chromium 139+ ❌ Not Supported
Firefox - ❌ Not Supported
Safari - ❌ Not Supported

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch:
    git checkout -b feature/AmazingFeature
  3. Commit your changes:
    git commit -m 'Add AmazingFeature with detailed description'
  4. Push to the branch:
    git push origin feature/AmazingFeature
  5. Open a Pull Request with description

Contribution Guidelines

  • Follow existing code style
  • Test your changes in Chrome 139+
  • Update documentation if needed
  • Include meaningful commit messages

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ—ΊοΈ Roadmap

  • 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

πŸ†˜ Support & Troubleshooting

Common Issues

"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

Getting Help

πŸ“Š Performance

  • First Load: < 500ms
  • Chat Response: Real-time streaming
  • Chat History: < 100ms load time
  • Memory Usage: ~50-100MB (varies with conversation size)

πŸ” Security & Privacy

  • βœ… All data stored locally (IndexedDB)
  • βœ… No external API calls except Chrome AI
  • βœ… No tracking or analytics
  • βœ… HTTPS recommended for deployment
  • βœ… PWA with offline capability

⭐ Show Your Support

If you found this project helpful, please consider:

  • ⭐ Starring the repository
  • πŸ› Reporting issues
  • πŸ“ Contributing improvements
  • πŸ“’ Sharing with other

About

A modern, feature-rich Progressive Web App (PWA) for seamless AI conversations using Chrome built-in AI model. Built with zero dependencies and optimized for privacy and performance.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published