Commit graph

6 commits

Author SHA1 Message Date
e52bdb5128 feat: RAG retrieval quality, artifact cleaning, and ingestion progress UI
Retrieval:
- Add _fetch_adjacent() to retriever: fetches page ± 1 chunks from DB
  after ranking so mid-sentence EPUB chunk boundaries don't lose context
- Fix vec DB doc-filter: oversample to top_k*20 before Python filter
  instead of post-filtering an already-small global pool (fixes wrong-book
  results when searching within a single document)
- top_k default 5 → 10; context per chunk 500 → 1500 chars; citation
  snippet 200 → 400 chars

Artifact cleaning:
- Add scripts/text_clean.py: strips ABC Amber LIT Converter watermarks,
  processtext.com URLs, bare page numbers, piracy stamps from extracted text
- Wire clean_paragraph() into ingest_pdf.py and new ingest_epub.py

Startup validation:
- _check_vec_schema() at boot: detects embedding dimension mismatch,
  deletes stale vec DB, and queues sequential re-embed in background thread
- Sequential _reembed_docs() prevents SQLite lock races on startup re-embed

cf-orch integration:
- Wire CF_ORCH_URL / CF_LICENSE_KEY into LLMRouter backend config so
  allocate() fires and keeps the Ollama model warm between requests

Ingestion progress UI:
- GET /api/library/{doc_id}/status now returns vec_count from page_vecs_meta
- DocumentCard.vue polls status every 3 s while processing and shows
  two-phase progress: indeterminate animation during extraction,
  determinate "Embedding N/M pages" bar once vectors start landing

Other:
- Chat feedback endpoint + thumbs up/down UI (FeedbackButton.vue)
- EPUB ingest script (ingest_epub.py) with heading-based chunking
- migration 002: chat_feedback table
- README.md with setup and feature overview
2026-05-06 08:25:58 -07:00
42ae3bc39b fix: use generic 'documents' copy in ChatView instead of 'rulebooks' 2026-05-05 11:21:11 -07:00
6fc8e7faa6 fix: wire bm25_score through Citation so Natural 20 easter egg fires
Citation dataclass gains bm25_score field populated from the retrieved
chunk. chat.py serializes it. api.ts interface updated to include it.
ChatView passes :bm25-score to CitationPanel so the Nat20 threshold
check in onMounted actually has data to evaluate.
2026-05-04 20:01:20 -07:00
6bda1143cc feat(web): add ChatView, CitationPanel, and Natural 20 easter egg 2026-05-04 18:32:20 -07:00
e401cb5f48 fix(web): error handling in LibraryView, taskId watch in IngestProgress, type fixes 2026-05-04 18:02:36 -07:00
b4837163d5 feat(web): add Vue 3 frontend scaffold -- LibraryView, DocumentCard, IngestProgress
Vue 3 + Vite + TypeScript scaffold with theme-aware CSS variables, router,
LibraryView (PDF library grid), DocumentCard (per-doc status + actions),
IngestProgress (polling progress bar), and ChatView stub for Task 9.
2026-05-04 17:57:48 -07:00