Skip to content

Feat/m1 rag free path - #1

Merged
vrana055 merged 7 commits into
mainfrom
feat/m1-rag-free-path
Jun 21, 2026
Merged

vrana055 merged 7 commits into
mainfrom
feat/m1-rag-free-path

Conversation

@vrana055

Copy link
Copy Markdown
Contributor

No description provided.

vrana055 and others added 7 commits June 21, 2026 10:29
Free AI path:
- Embeddings via local fastembed (BAAI/bge-small-en-v1.5, dim 384),
  provider-switchable (local|openai); model baked into images at build
- Generation/vision via OpenRouter (OpenAI-compatible base_url), free models
- Migration 0002: resize chunks.embedding 1536 -> 384, recreate HNSW index
- Config + .env.example: OPENROUTER_*, GENERATION/VISION_MODEL, EMBEDDING_PROVIDER

M1 ingest (worker): fetch(S3) -> parse(txt/pdf/docx) -> chunk(sentence-aware
+ overlap) -> embed -> upsert into pgvector; status transitions + retries.
API upload now stores to MinIO and enqueues the Celery task; list_documents real.

M1 query (api): workspace-scoped pgvector retrieval -> grounded-by-default
generation with citations or "not found"; conversation/message persistence;
SSE token streaming. Generation failures degrade to retrieved context.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- apiClient: correct response types (document_id/task_id, conversation_id,
  DocumentInfo); add streamQuery() — POST SSE parser (EventSource is GET-only)
- ChatPage: token-by-token streaming, threads conversation_id across turns,
  live citations
- UploadPage: list documents from API, poll status while pending/processing,
  color-coded indexed/failed
- query/stream: persist user+assistant messages, emit conversation_id in meta
  so streaming supports multi-turn
- override: fix VITE_API_URL to http://api:8000 (Vite dev proxy runs inside the
  web container, so localhost is wrong)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Free ":free" models are often rate-limited upstream (429) or temporarily
unavailable (404). chat() and stream_chat() now try a configured list of
10 free models in order, skipping on 404/429/502/503 to the next, so a
grounded answer still returns. Streaming falls back only before the first
token. Default primary switched to qwen3-next-80b (llama-3.3-70b was
saturated upstream).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- query: log start/context/decision/done; retrieval logs embed + hit counts,
  top similarity, kept sources; llm logs each model try/ok/fallback and
  stream_start/done — full trace of a request in dev logs
- ingest worker: log fetched/parsed/chunked/embedded/upserted steps
- override: PYTHONUNBUFFERED=1 (api+worker) so logs flush in real time/order
- llm client: max_retries=0 so a rate-limited model falls back in ~1s instead
  of the SDK stalling ~50s on its own 429 retries (surfaced by the new logs)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- ingest: add GET /documents/:id/download and DELETE /documents/:id endpoints
- storage: add download_bytes() and delete_object() helpers
- query: done event now carries grounded+citations; ChatPage patches msg on receipt
- apiClient: fix SSE parser for CRLF, expose deleteDocument + downloadDocument
- UploadPage: status dot, download/delete buttons with confirm modal
- vite.config: set hmr.port=3000 so WebSocket works through Docker's exposed port

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vrana055
vrana055 merged commit 4a0b65e into main Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant