Skip to content

sucharitha1812/context-aware-browser-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  Context-Aware Browser Assistant


๐Ÿš€ Building a Privacy-First AI Browser Assistant

This project presents a context-aware AI browser assistant that brings local LLM intelligence directly into the browser using Chrome Extension APIs, Ollama, and Llama 3.2.

The extension can summarize webpages, answer questions about live page content, and explain highlighted text directly inside webpages using a floating contextual AI panel.

Unlike cloud-based browser assistants that require external APIs and data transfer, this system performs all inference locally through Ollama, enabling privacy-first AI interactions with zero external API calls.

The architecture combines:

  • Chrome Manifest V3
  • Context-aware DOM extraction
  • Local LLM inference using Ollama
  • Background service worker orchestration
  • Content script integration
  • Floating AI explanation panels
  • Popup-based contextual Q&A workflows

๐ŸŽฏ Why This Project Matters

Most browser AI assistants rely heavily on cloud APIs and external inference services.

This creates problems such as:

  • Privacy concerns
  • API costs
  • Latency
  • Data transmission risks
  • Dependency on hosted AI providers

This project demonstrates how modern browser extensions can integrate local LLMs directly into user workflows.

The system enables:

  • Fully local AI inference
  • Context-aware browsing assistance
  • Real-time webpage summarization
  • AI-powered contextual explanations
  • Zero cloud dependency
  • Privacy-preserving AI interactions

๐Ÿ“Š Project Snapshot

  • Project Type: AI Browser Assistant
  • Architecture: Chrome Extension (Manifest V3)
  • Frontend: React + TypeScript
  • LLM Runtime: Ollama
  • Model: Llama 3.2
  • Inference Type: Local LLM Inference
  • Key Capability: Context-Aware AI Assistance
  • Core Features: Summarization, contextual Q&A, floating explanations
  • Privacy Model: Zero external API calls

๐ŸŽฌ Demo Workflow

Example Usage Flow

  1. Open any webpage
  2. Highlight a paragraph
  3. Right-click โ†’ Explain with Context-Aware Browser Assistant
  4. AI explanation appears in a floating panel directly on the page

The extension can also:

  • summarize entire webpages
  • answer questions about live content
  • provide contextual explanations using page DOM information

โœจ Core Features

1. Context-Aware AI Assistance

  • Extracts live webpage content using DOM access
  • Uses page context for grounded AI responses
  • Improves contextual relevance

2. Local LLM Inference

  • Runs fully through Ollama
  • Uses Llama 3.2 locally
  • No OpenAI or cloud API dependency

3. Page Summarization

  • One-click webpage summarization
  • Context-aware summaries using live content

4. Contextual Q&A

  • Ask questions about currently opened webpages
  • Responses generated using extracted page context

5. Right-Click Explain Workflow

  • Highlight text on webpages
  • Right-click contextual explanation support
  • Fast inline AI assistance

6. Floating AI Panel

  • Non-intrusive UI overlay
  • Dynamic explanation rendering
  • Contextual inline assistance

7. Background Service Worker

  • Handles extension orchestration
  • Sends prompts to Ollama
  • Manages AI request lifecycle

8. Content Script Integration

  • Extracts webpage DOM content
  • Injects contextual floating panel
  • Enables real-time interaction with webpages

๐Ÿ—๏ธ System Architecture

Webpage
   โ”‚
   โ”‚ (DOM extraction)
   โ–ผ
Content Script
   โ”‚
   โ”‚ (page context + selected text)
   โ–ผ
Background Service Worker      โ†โ”€โ”€โ”€โ”€ Context Menu API
   โ”‚                                  (right-click trigger)
   โ”‚ (AI request)
   โ–ผ
Ollama Local API (localhost:11434)
   โ”‚
   โ”‚ (AI response)
   โ–ผ
Popup UI / Floating Panel

โš™๏ธ Component Responsibilities

Component Role
Content Script Extracts page text and injects floating explanation panel
Background Service Worker Handles orchestration, prompts, and AI request routing
Popup UI React-based extension interface for summaries and contextual Q&A
Context Menu API Right-click AI explanation trigger
Ollama REST API Local LLM inference using localhost:11434

๐Ÿง  Tech Stack

  • React
  • TypeScript
  • Chrome Extension APIs
  • Manifest V3
  • Ollama
  • Llama 3.2
  • Vite
  • Tailwind CSS
  • DOM APIs
  • Content Scripts

๐Ÿ“‚ Repository Structure

context-aware-browser-assistant/
โ”‚
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ vite.config.ts
โ”œโ”€โ”€ tsconfig.json
โ”œโ”€โ”€ tsconfig.app.json
โ”œโ”€โ”€ tsconfig.node.json
โ”œโ”€โ”€ eslint.config.js
โ”œโ”€โ”€ postcss.config.js
โ”œโ”€โ”€ tailwind.config.js
โ”œโ”€โ”€ index.html
โ”‚
โ”œโ”€โ”€ public/
โ”‚   โ”œโ”€โ”€ background.js
โ”‚   โ”œโ”€โ”€ contentScript.js
โ”‚   โ”œโ”€โ”€ manifest.json
โ”‚   โ”œโ”€โ”€ icon-128.jpg
โ”‚   โ””โ”€โ”€ vite.svg
โ”‚
โ””โ”€โ”€ src/
    โ”œโ”€โ”€ App.tsx
    โ”œโ”€โ”€ App.css
    โ”œโ”€โ”€ index.css
    โ”œโ”€โ”€ main.tsx
    โ”œโ”€โ”€ vite-env.d.ts
    โ”‚
    โ””โ”€โ”€ assets/
        โ””โ”€โ”€ react.svg

โ–ถ๏ธ How to Run

1. Clone Repository

git clone https://github.com/sucharitha1812/context-aware-browser-assistant.git
cd context-aware-browser-assistant

2. Install Dependencies

npm install

3. Build Extension

npm run build

4. Install Ollama

Install Ollama locally and pull Llama 3.2:

ollama pull llama3.2

5. Load Extension in Chrome

  1. Open:
chrome://extensions/
  1. Enable Developer Mode

  2. Click Load unpacked

  3. Select the:

dist/

folder


๐ŸŽฎ Usage

Summarize Current Page

  1. Open any webpage
  2. Click extension popup
  3. Select Summarize Current Page

Ask Questions About Page Content

  1. Open popup UI
  2. Ask contextual questions
  3. Receive AI-generated answers using live page content

Example:

What are the key points of this article?

Explain Highlighted Text

  1. Highlight any webpage text
  2. Right-click selected content
  3. Choose:
Explain with Context-Aware Browser Assistant
  1. Floating explanation panel appears on the webpage

๐Ÿ”’ Privacy & Security

This project is designed privacy-first.

Privacy Features

  • Zero external API calls
  • No telemetry
  • No analytics tracking
  • Fully local inference
  • No cloud dependency
  • No persistent page-content storage

Security Benefits

  • Sensitive browsing data remains local
  • No third-party AI inference providers
  • No external transmission of webpage content

๐Ÿ’ผ Business Impact

  • Demonstrates privacy-preserving AI workflows
  • Enables local AI-powered productivity tooling
  • Reduces dependency on cloud inference APIs
  • Improves contextual browsing assistance
  • Demonstrates modern browser extension engineering
  • Shows practical integration of LLMs into real-world workflows

๐Ÿ› ๏ธ Skills Demonstrated

  • Browser Extension Development
  • Chrome Manifest V3
  • React
  • TypeScript
  • Ollama
  • Local LLM Integration
  • Context-Aware AI Systems
  • DOM Manipulation
  • Content Script Development
  • Background Service Workers
  • Frontend Engineering
  • AI Workflow Integration

โš ๏ธ Limitations

  • Requires Ollama installed locally
  • Depends on browser extension permissions
  • Large webpages may increase processing time
  • Local inference performance depends on system hardware
  • Currently optimized for Chrome-based browsers

๐Ÿ”ฎ Future Improvements

  • Draggable floating AI panel
  • Persistent AI sidebar
  • Multi-model support
  • Multi-tab contextual understanding
  • Citation-based responses
  • Source highlighting
  • Streaming AI responses
  • Cross-browser support

๐Ÿ“„ License

MIT License


๐Ÿ‘จโ€๐Ÿ’ป Author

Built by Sucharitha Reddy Gaddam


โœ… Conclusion

This project demonstrates how modern browser extensions can integrate local LLMs directly into browsing workflows using Chrome Extension APIs, Ollama, and context-aware DOM interaction.

By combining local inference, contextual AI assistance, floating UI panels, and privacy-first architecture, the system provides a strong example of practical AI-powered browser productivity tooling without relying on external APIs.

About

Production-grade context-aware AI browser assistant built with React, TypeScript, Chrome Manifest V3, Ollama, and Llama 3.2 for privacy-first webpage summarization, contextual Q&A, and local LLM-powered browsing workflows.

Topics

Resources

Stars

Watchers

Forks

Contributors