brainy/src/embeddings
David Snelling cca1cd8ce2 feat: add structured content extraction and batch embedding optimization to highlight()
Fix highlight() hanging on structured text input by addressing 3 root causes:

1. embedBatch() now uses native WASM batch API (single forward pass instead
   of N individual embed() calls via Promise.all)

2. highlight() auto-detects content type (plain text, rich-text JSON, HTML,
   Markdown) and extracts meaningful text segments. Supports TipTap, Slate.js,
   Lexical, Draft.js, and Quill Delta formats. New contentType hint and
   contentExtractor callback for custom parsers.

3. Semantic matching phase has 10s timeout - falls back to text-only matches
   instead of hanging indefinitely.

Also fixes extractTextContent() array check: uses type-based detection
(typeof data[0] === 'number') instead of length-based (data.length > 10)
so arrays of objects are properly indexed for text search.

New types: ContentType, ContentCategory, ExtractedSegment
New fields: HighlightParams.contentType, HighlightParams.contentExtractor,
            Highlight.contentCategory
2026-01-27 10:27:22 -08:00
..
candle-wasm perf: 580x faster embedding init - separate model from WASM 2026-01-06 17:18:58 -08:00
wasm fix: bun --compile model loading with fallback paths 2026-01-06 18:00:37 -08:00
CachedEmbeddings.ts feat: implement clean embedding architecture with Q8/FP32 precision control 2025-09-02 10:00:52 -07:00
EmbeddingManager.ts feat: add structured content extraction and batch embedding optimization to highlight() 2026-01-27 10:27:22 -08:00
index.ts feat: implement clean embedding architecture with Q8/FP32 precision control 2025-09-02 10:00:52 -07:00