diff --git a/TASKS.md b/TASKS.md index 0998644..31cc450 100644 --- a/TASKS.md +++ b/TASKS.md @@ -949,3 +949,38 @@ Run full test suite. All 26+ existing tests must continue to pass. - Manual install docs remain alongside for bare-metal deployment **This task is only actionable after Tasks 8–15 (RAG eviction + AMQP cluster) are complete.** + +--- + +### B4 — RAG Corpus Management UI (Display, Edit, CRUD) + +**Goal:** Provide a management interface in the UI to browse, search, edit, and delete individual entries in the Qdrant-backed RAG corpus. + +**Backend — add to `routers/rag_admin.py`:** + +| Method | Endpoint | Description | Auth | +|--------|----------|-------------|------| +| GET | `/api/rag/points` | Return paginated list of RAG points with payload (text, source, date). Supports `?offset=0&limit=50&search=` query params | Admin | +| GET | `/api/rag/point/{point_id}` | Return a single point with full payload | Admin | +| DELETE | `/api/rag/point/{point_id}` | Delete a single point from Qdrant | Admin | +| PATCH | `/api/rag/point/{point_id}` | Update a point's text payload (re-embed the new text) | Admin | + +Helper functions for Qdrant scroll/delete/update go in `rag.py` or `eviction.py`. + +**Frontend — add to `templates/index.html`:** + +A "RAG" button in the admin UI (drawer or settings modal) that opens a management panel: +- **Stats bar**: vector count, max vectors, percent full, pinned sources +- **Search bar**: text input to search the RAG corpus by semantic similarity +- **Results table**: paginated list showing each vector's text snippet, source label, ingest date, retrieval count + - Click to expand full text + - Delete button per row (with confirmation) + - Edit button per row (inline text edit → re-embed on save) +- **Bulk actions**: flush all (existing `/api/rag/flush`) with confirmation + +**Tests:** + +- `tests/test_rag_admin.py` — cover new endpoints: list, get, delete, update, admin-enforcement +- Mock all Qdrant calls via monkeypatch + +Run full test suite. All existing tests must continue to pass.** diff --git a/docs/wiki/current-wip.md b/docs/wiki/current-wip.md index 937f99c..2afecdf 100644 --- a/docs/wiki/current-wip.md +++ b/docs/wiki/current-wip.md @@ -13,6 +13,7 @@ All 15 tasks are done. Final commit: `f0689ac feat: Roadmap N — AMQP cluster n - B1 — Context loss in follow-up questions (investigation) - B2 — Bang-prefixed (`!`) search routing - B3 — Docker distribution (planning doc at `docker.md`) +- **B4 — RAG Corpus Management UI (NEXT)** — browse, search, edit, delete individual RAG entries. Backend endpoints at `routers/rag_admin.py`, frontend panel in `templates/index.html` - HTTPS / reverse proxy (Caddy) - Conversation search/filter and export tooling - Keyboard shortcuts, retry button, source-link polish