benroshan commited on
Commit
3f7febe
Β·
1 Parent(s): dcac13e

docs: log Stage 13 async embed upload

Browse files
Files changed (1) hide show
  1. docs/evolution.md +21 -0
docs/evolution.md CHANGED
@@ -525,6 +525,27 @@ Render free tier (512MB RAM) caused repeated OOM crashes under contextual retrie
525
 
526
  ---
527
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
528
  ## Roadmap β€” Retrieval & Answer Quality
529
 
530
  ### Phase 1 β€” Quick wins (no infra change, measurable RAGAS lift)
 
525
 
526
  ---
527
 
528
+ ## Stage 13 β€” Async Embed Upload (2026-06-23)
529
+
530
+ ### What was wrong
531
+ `embed_and_store()` blocked `POST /api/upload` for ~150s (30 chunks Γ— ~5s/chunk via Euron API). User saw spinner, could not query, could not cancel. Upload timeout was 300s.
532
+
533
+ ### What we built
534
+
535
+ | File | Change |
536
+ |------|--------|
537
+ | `server/main.py` | `app.state.upload_jobs = {}` initialized in lifespan |
538
+ | `server/routes/upload.py` | `POST /api/upload` returns 202 + `job_id` in <1s. Parse+chunk sync; embed+contextual in `_embed_and_contextualize_bg()` BackgroundTask. New `GET /api/upload/status/{job_id}` endpoint. |
539
+ | `frontend/src/api.js` | Added `getUploadStatus(jobId)`; reduced `uploadFiles` timeout 300s β†’ 30s |
540
+ | `frontend/src/components/FileUpload.jsx` | Polls status every 2s; shows stage label under spinner; fires callbacks on ready. Defensive `|| []` guard on documents. |
541
+
542
+ ### Key discoveries
543
+ - Old Vercel frontend receiving new 202 response before redeploy β†’ `data.documents` undefined β†’ React crash. Fix: defensive `docs?.documents || []` guard.
544
+ - Groq TPM 429s at `max_concurrent=3` still hit (~5/30 chunks fall back to original text) β€” some chunks are larger than average. Retry logic handles gracefully.
545
+ - Briefing fails with JSON parse error (pre-existing bug in `generate_briefing` β€” separate fix).
546
+
547
+ ---
548
+
549
  ## Roadmap β€” Retrieval & Answer Quality
550
 
551
  ### Phase 1 β€” Quick wins (no infra change, measurable RAGAS lift)