Skip to content

Commit 55f4507

Browse files
authored
Merge pull request #36 from Shishir435/feature/file-upload-processing
Feature/file upload processing
2 parents 4b8b569 + 0e2f7cf commit 55f4507

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+6369
-86
lines changed

README.md

Lines changed: 109 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,11 @@
1111
<img src="https://img.shields.io/badge/Brave-Supported-orange?logo=brave&style=for-the-badge" alt="Brave Supported" />
1212
<img src="https://img.shields.io/badge/Edge-Supported-blue?logo=microsoftedge&style=for-the-badge" alt="Edge Supported" />
1313
<img src="https://img.shields.io/badge/Opera-Supported-red?logo=opera&style=for-the-badge" alt="Opera Supported" />
14-
<img src="https://img.shields.io/badge/Firefox-Experimental-lightgrey?logo=firefox-browser&style=for-the-badge" alt="Firefox Experimental" />
14+
<img src="https://img.shields.io/badge/Firefox-Supported-lightgrey?logo=firefox-browser&style=for-the-badge" alt="Firefox Supported" />
1515
</div>
1616

1717
---
1818

19-
> ✅ Works with any Chromium-based browser: **Chrome**, **Brave**, **Edge**, **Opera**, and **Chromium**
20-
> 🦊 **Firefox support** available via [temporary addon installation](https://extensionworkshop.com/documentation/develop/temporary-installation-in-firefox/) (manual permissions setup required).
21-
22-
---
23-
2419
## 🚀 Get Started — Install Now
2520

2621
<div align="center">
@@ -68,6 +63,22 @@
6863
- 📋 **Copy & Regenerate** – Quickly rerun or copy AI responses
6964
-**Streaming Responses** – Real-time streaming with typing indicators
7065

66+
### 🧠 Embeddings & Semantic Search (Beta v0.3.0)
67+
- 🔍 **Semantic Chat Search** – Search chat history by meaning, not just keywords
68+
- 📊 **Vector Database** – IndexedDB-based vector storage with optimized cosine similarity
69+
- 🎯 **Smart Chunking** – 3 strategies: fixed, semantic, hybrid (configurable)
70+
- 🚀 **Optimized Search** – Pre-normalized vectors, caching, early termination
71+
- 🔧 **Configurable** – Chunk size, overlap, similarity threshold, search limits
72+
- 📁 **Context-Aware** – Search across all chats or within current session
73+
74+
### 📎 File Upload & Processing (Beta v0.3.0)
75+
- 📄 **Text Files** – Support for .txt, .md and text based files
76+
- 📕 **PDF Support** – Full text extraction from PDF documents
77+
- 📘 **DOCX Support** – Extract text from Word documents
78+
- ⚙️ **Auto-Embedding** – Automatic embedding generation for uploaded files
79+
- 📊 **Progress Tracking** – Real-time progress indicators during processing
80+
- 🎛️ **Configurable Limits** – User-defined max file size in settings
81+
7182

7283
### 🌐 Webpage Integration
7384
- 🧠 **Enhanced Content Extraction** – Advanced extraction with multiple scroll strategies (none, instant, gradual, smart)
@@ -83,7 +94,7 @@
8394
- 🌓 **Dark Mode** – Beautiful dark theme with smooth transitions
8495
- 📝 **Prompt Templates** – Create, manage, and use custom prompt templates (Ctrl+/)
8596
- 🔊 **Advanced Text-to-Speech** – Searchable voice selector with adjustable speech rate & pitch
86-
- 🎚️ **Cross-Browser Compatibility** – Works with Chrome, Brave, Edge, Opera, Vivaldi, LibreWolf, and more
97+
- 🎚️ **Cross-Browser Compatibility** – Works with Chrome, Brave, Edge, Opera
8798
- 🧪 **Voice Testing** – Test voices before using them
8899

89100
### 🔒 Privacy & Performance
@@ -98,29 +109,36 @@
98109
## 🧩 Tech Stack
99110

100111
### Frontend
101-
- **TypeScript** – Type-safe development
102-
- **React 18** – Modern UI framework
103-
- **Vite** – Fast build tool
104-
- **Plasmo** – Chrome extension framework
105-
- **Shadcn UI** – Professional component library (Radix UI primitives)
106-
- **Tailwind CSS** – Utility-first styling
107-
- **Zustand** – Lightweight state management
108-
- **Dexie** – IndexedDB wrapper for chat storage
109-
110-
### Backend & APIs
111-
- **Ollama** – Local LLM backend
112-
- **Chrome Extension APIs**`declarativeNetRequest`, `storage`, `sidePanel`, `tabs`
112+
- **[TypeScript](https://www.typescriptlang.org/)** – Type‑safe development
113+
- **[React 18](https://reactjs.org/)** – Modern UI framework
114+
- **[Plasmo](https://docs.plasmo.com/)** – Chrome‑extension framework
115+
- **[Shadcn UI](https://ui.shadcn.com/)** – Professional component library (Radix UI primitives)
116+
- **[Radix UI](https://www.radix-ui.com/)** – Accessible UI primitives
117+
- **[Tailwind CSS](https://tailwindcss.com/)** – Utility‑first styling
118+
- **[Lucide React](https://lucide.dev/)** – Icon library
119+
- **[Zustand](https://github.com/pmndrs/zustand)** – Lightweight state management
120+
- **[Dexie](https://dexie.org/)** – IndexedDB wrapper for chat storage
121+
122+
- **[webextension‑polyfill](https://github.com/mozilla/webextension-polyfill)** – Promise‑based browser extension API wrapper
123+
124+
### Backend & APIs
125+
- **[Ollama](https://ollama.com/)** – Local LLM backend
126+
- **[Chrome Extension APIs](https://developer.chrome.com/docs/extensions/)**`declarativeNetRequest`, `storage`, `sidePanel`, `tabs`
113127

114128
### Content Processing
115-
- **Defuddle** – Advanced content extraction
116-
- **Mozilla Readability** – Content extraction fallback
117-
- **highlight.js** – Code syntax highlighting
118-
- **markdown-it** – Markdown rendering
129+
- **[Defuddle](https://github.com/kepano/defuddle)** – Advanced content extraction
130+
- **[Mozilla Readability](https://github.com/mozilla/readability)** – Content extraction fallback
131+
- **[highlight.js](https://highlightjs.org/)** – Code syntax highlighting
132+
- **[markdown-it](https://github.com/markdown-it/markdown-it)** – Markdown rendering
133+
- **[pdfjs‑dist](https://github.com/mozilla/pdfjs-dist)** – PDF parsing and rendering
134+
- **[dompurify](https://github.com/cure53/DOMPurify)** – HTML sanitization
135+
- **[html2pdf.js](https://github.com/eKoopmans/html2pdf.js)** – Convert HTML to PDF
136+
- **[mammoth](https://github.com/mwilliamson/mammoth.js)** – DOCX to HTML conversion
119137

120138
### Developer Tools
121-
- **Biome** – Fast formatter & linter
122-
- **TypeScript** – Strict type checking
123-
- **Husky** – Git hooks
139+
- **[Biome](https://biomejs.dev/)** – Fast formatter & linter
140+
- **[TypeScript](https://www.typescriptlang.org/)** – Strict type checking
141+
- **[Husky](https://typicode.github.io/husky/)** – Git hooks
124142

125143
---
126144

@@ -304,13 +322,24 @@ Load as a [temporary extension](https://extensionworkshop.com/documentation/deve
304322

305323
### 📁 Code Structure
306324

307-
- `src/`: Core logic and components
308-
- `background.ts`: API bridge + streaming
309-
- `sidepanel.tsx`: Main chat UI
310-
- `options.tsx`: Settings page
311-
- `content.ts`: Summarizer / Readability
312-
- `lib/`: Utility functions
313-
- `hooks/`, `features/`, `context/`: Modular structure for maintainability
325+
```
326+
src/
327+
├── background/ # Background service worker & API handlers
328+
├── sidepanel/ # Main chat UI
329+
├── options/ # Settings page
330+
├── features/ # Feature modules
331+
│ ├── chat/ # Chat components, hooks, semantic search
332+
│ ├── model/ # Model management & settings
333+
│ ├── sessions/ # Chat session management
334+
│ ├── prompt/ # Prompt templates
335+
│ └── tabs/ # Browser tab integration
336+
├── lib/ # Shared utilities
337+
│ └── embeddings/ # Vector embeddings & semantic search
338+
├── components/ # Shared UI components (Shadcn)
339+
└── hooks/ # Shared React hooks
340+
```
341+
342+
**Architecture**: Feature-based organization with separation of concerns (components, hooks, stores). Zustand for global state, React hooks for local state.
314343

315344
---
316345

@@ -334,7 +363,7 @@ Explore: [Ollama Model Library](https://ollama.com/library)
334363

335364
---
336365

337-
## 🧪 Firefox Support (Experimental)
366+
## 🧪 Firefox Support
338367

339368
Ollama Client is a Chrome Manifest V3 extension. To use in Firefox:
340369

@@ -368,12 +397,32 @@ Here’s what’s coming up next in **Ollama Client**—grouped by priority:
368397

369398
### Embeddings & Semantic Search
370399

371-
- [ ] Implement **Ollama Embedding Models**:
372-
- [ ] Integration with Ollama embedding models (e.g., `nomic-embed-text`, `all-minilm`)
373-
- [ ] Generate embeddings for chat messages and store in IndexedDB
374-
- [ ] Semantic search over chat history
375-
- [ ] Semantic filtering for chat sessions
376-
- [ ] Enable **Local RAG** over chats, PDFs, and image text
400+
- [x] Implement **Ollama Embedding Models**:
401+
- [x] Integration with Ollama embedding models (e.g., `nomic-embed-text`, `mxbai-embed-large`)
402+
- [x] Generate embeddings for chat messages and store in IndexedDB
403+
- [x] Semantic search over chat history (global and per-chat)
404+
- [x] Auto-embedding toggle and backfill functionality
405+
- [x] **Vector Search Optimization** (Phase 1 - Completed):
406+
- [x] Brute-force cosine similarity with optimized computation
407+
- [x] Pre-normalize embeddings on storage
408+
- [x] Use Float32Array for better memory locality
409+
- [x] Implement early termination for low similarity scores
410+
- [x] Add search result caching (configurable TTL & max size)
411+
- [x] Non-blocking computation (async chunking with yields)
412+
- [x] **Semantic Chat Search UI** (Beta v0.3.0 - Completed):
413+
- [x] Search dialog with debounced input
414+
- [x] Search scope toggle (all chats / current chat)
415+
- [x] Grouped results by session
416+
- [x] Similarity scores with % match display
417+
- [x] Click to navigate and highlight message
418+
- [x] Real-time loading indicators
419+
- [ ] **Advanced Vector Search** (Phase 2 - Future):
420+
- [ ] WASM-based HNSW indexing via `hnswlib-wasm`
421+
- [ ] Implement when dataset exceeds 10K vectors
422+
- [ ] Expected performance gain: 10-100x faster searches
423+
- [ ] Bundle size impact: ~200 KB (gzipped: ~100-200 KB)
424+
- [ ] See `VECTOR_SEARCH_LIBRARIES_REPORT.md` for detailed analysis
425+
- [ ] Enable **Local RAG** over chats, PDFs, and uploaded files
377426
- [ ] **Browser Search Feature**:
378427
- [ ] Contextual search within webpage content
379428
- [ ] Semantic search over extracted content
@@ -388,15 +437,30 @@ Here’s what’s coming up next in **Ollama Client**—grouped by priority:
388437
389438
### File Upload & Processing
390439

391-
- [ ] Plain text-based formats: `.txt`, `.md`, `.js`, `.ts` (direct read)
392-
- [ ] Support `.pdf` uploads via **pdf.js**
393-
- [ ] Image OCR via **Tesseract.js** (lazy-loaded)
394-
- [ ] Optional future support: `.docx` (via `mammoth.js`) etc.
440+
- [x] **Text File Support** (Beta v0.3.0 - Completed):
441+
- [x] Plain text-based formats: `.txt`, `.md` and more.
442+
- [x] Direct UTF-8 reading
443+
- [x] **PDF Support** (Beta v0.3.0 - Completed):
444+
- [x] Full text extraction via **pdf.js**
445+
- [x] Multi-page document support
446+
- [x] **DOCX Support** (Beta v0.3.0 - Completed):
447+
- [x] Extract text from Word documents via **mammoth.js**
448+
- [x] Handle formatting and structure
449+
- [x] **Auto-Embedding** (Beta v0.3.0 - Completed):
450+
- [x] Automatic chunking with configurable strategies
451+
- [x] Background embedding generation via port messaging
452+
- [x] Progress tracking with real-time updates
453+
- [x] Batch processing for performance
454+
- [x] **File Upload Settings** (Beta v0.3.0 - Completed):
455+
- [x] Configurable max file size
456+
- [x] Auto-embed toggle
457+
- [x] Embedding batch size configuration
458+
- [ ] Image OCR via **Tesseract.js** (Deferred - CSP issues in Manifest V3)
395459

396460
### UX & Metrics Enhancements
397461

398462
- [ ] Track **Per-Session Token Usage** and display in chat metadata (duration, token count)
399-
- [ ] Enable **Semantic Chat Search / Filter** once embeddings are in place
463+
- [x] Enable **Semantic Chat Search / Filter** once embeddings are in place
400464
- [x] Add **Export/Import UI Buttons** in chat selector ui
401465

402466
---

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ollama-client",
33
"displayName": "Ollama Client - Chat with Local LLM Models",
4-
"version": "0.2.6",
4+
"version": "0.3.1",
55
"description": "Privacy-first Ollama Chrome extension to chat with local AI models like LLaMA, Mistral, Gemma — fully offline.",
66
"author": "Shishir Chaurasiya",
77
"keywords": [
@@ -96,6 +96,7 @@
9696
"highlight.js": "^11.11.1",
9797
"html2pdf.js": "^0.11.1",
9898
"lucide-react": "0.474.0",
99+
"mammoth": "^1.6.0",
99100
"markdown-it": "^14.1.0",
100101
"markdown-it-container": "^4.0.0",
101102
"markdown-it-copy-code": "^0.1.3",
@@ -106,6 +107,7 @@
106107
"markdown-it-sub": "^2.0.0",
107108
"markdown-it-sup": "^2.0.0",
108109
"markdown-it-task-lists": "^2.1.1",
110+
"pdfjs-dist": "^4.0.379",
109111
"plasmo": "0.90.5",
110112
"react": "18.2.0",
111113
"react-dom": "18.2.0",

0 commit comments

Comments
 (0)