gittech. site

for different kinds of informations and explorations.

Local Ollama Chat – Chrome Extension

Published at
Jan 16, 2025

Overlay

Watch the video

A Chrome extension that enhances your browsing experience with AI-powered assistance.

Features

Core Features

  • βœ… Chrome Manifest V3 compatible
  • βœ… Dark/Light theme support
  • βœ… Sidepanel integration for easy access
  • βœ… Responsive and modern UI design

AI Integration

  • βœ… Intelligent chat interface with multiple model support
    • Gemini Pro integration with API key
    • Local model execution via Ollama
    • Automatic model switching and persistence
  • βœ… Custom model configuration
    • Default model selection in options
    • Dynamic model discovery for both Gemini and Ollama
    • Automatic retry mechanism for API rate limits
  • βœ… Context-aware browsing assistance
    • Interactive and conversational modes
    • Context menu integration for quick actions
  • πŸ“ Chat history and conversation management

Content Features

  • βœ… Inspirational quotes on new tab
  • βœ… Quote categorization and attribution
  • 🚧 Customizable new tab layout
  • πŸ“ Task management

Privacy & Security

  • βœ… Local model execution via Ollama
  • βœ… No data collection or tracking

Getting Started

  1. Install dependencies:
pnpm install
  1. Configure AI Models:

    a. For Ollama (Local Models):

    # Install recommended models
    ollama pull mistral    # Great for general tasks
    ollama pull codellama  # Specialized for code
    ollama pull phi        # Fast and lightweight
    

    b. For Gemini (Cloud Models):

  2. Start Ollama service with Chrome extension permissions:

OLLAMA_ORIGINS=chrome-extension://* ollama serve

Note: The extension will automatically discover available models from both Ollama and Gemini.

  1. Start development:
pnpm dev
  1. Build for production:
pnpm build

Development

Project Structure

overlay2/
β”œβ”€β”€ chrome-extension/     # Chrome extension core
β”œβ”€β”€ packages/            # Shared packages
└── pages/              # Extension pages
    β”œβ”€β”€ content/        # Content scripts
    β”œβ”€β”€ popup/          # Popup UI
    └── side-panel/     # Sidepanel UI

Commands

  • pnpm dev - Start development server
  • pnpm build - Build for production
  • pnpm lint - Run linting
  • pnpm test - Run tests

Installation

  1. Open Chrome and navigate to chrome://extensions/
  2. Enable "Developer mode" in the top right
  3. Click "Load unpacked" and select the dist directory from this project

Requirements

  • Node.js >= 16
  • pnpm
  • Chrome browser

Based on

License

MIT