Back to projects

AI / Browser prototype

WebLMS

A browser extension that turns visible DOM text and OCR into extractive answers, with IndexedDB caching and a local request monitor.

TypeScriptWebExtensionsTesseract.jsIndexedDBComlink
View repository
WEBLMS
DOM + OCR → LOCAL CONTEXT → EXTRACTIVE Q&A

01 / COMPONENTS & DATA FLOW

Inside the system.

  1. 01DOM + images
  2. 02Text + table extraction
  3. 03Question classification
  4. 04Extractive answer

Structured page extraction

A DOM TreeWalker skips scripts, styles, and hidden elements while collecting text. Separate paths gather viewport-adjacent content, document metadata, and table rows.

OCR off the page thread

A Comlink-exposed OCR worker wraps Tesseract.js and returns recognized text with OCR confidence. IndexedDB stores page contexts and model-related cache records.

Extractive Q&A

QAEngine classifies questions as summary, extraction, specific, or general, then scores and selects sentences from the page context. Timing markers cover processing and answer generation.

02 / IMPLEMENTATION DECISIONS

Why it works this way.

Local context is the core

The implementation does not require a FastAPI or Redis service. Its privacy monitor wraps fetch and XMLHttpRequest, permits extension/blob URLs and local hosts, and rejects other absolute hosts in the monitored context.

Extraction before generation

The implemented answer path uses sentence-selection heuristics. The model loader includes an ONNX integration placeholder; the current worker signals the main Q&A engine rather than running a downloaded model.

03 / SCOPE & TRADEOFFS

The implementation boundary.

A prototype of local page understanding. The current heuristics are not a generative LLM, and the request monitor is not a complete extension-wide security sandbox.

04 / READ THE IMPLEMENTATION

Follow it into the code.