Four valid review comments from gemini-code-assist[bot] on #5759: 1. core/rag/bm25.py:_load — wrap bm25s.BM25.load + json.loads with specific exception handlers (FileNotFoundError, OSError, JSONDecodeError, ValueError) and log a warning instead of propagating a 500. Corrupt/partial bm25 dirs now degrade to empty-search rather than crashing the request. 2. core/rag/tool.py was importing _resolve_scope_embedder from routes/rag.py — a layering violation (core depending on routes). Move the resolver into a new core/rag/scope.py module along with the chat-settings key constants; routes/rag.py now re-imports it under the same name. Same behaviour, no cycle, one source of truth for the resolution logic. 3. core/rag/bm25.py:rebuild_index — call delete_scope before saving the new index so stale files from a previous build (or a bm25s naming change) never coexist with current files. The library's save() doesn't unlink files it doesn't write. 4. routes/rag.py:_save_upload was running f.write() synchronously inside an async def. Switch to anyio.open_file() so each chunk write runs in a worker thread instead of blocking the event loop on multi-MB uploads. Cleanup unlink happens after the async-with closes the handle so Windows is happy. Skipped one (vector_store.py:133 'hasattr query_points' redundancy) — that comment was on the pre-rewrite Qdrant code; the file is now sqlite-vec backed and the hasattr check is gone. |
||
|---|---|---|
| .. | ||
| assets | ||
| auth | ||
| core | ||
| loggers | ||
| models | ||
| plugins | ||
| requirements | ||
| routes | ||
| state | ||
| storage | ||
| tests | ||
| utils | ||
| __init__.py | ||
| _platform_compat.py | ||
| colab.py | ||
| main.py | ||
| run.py | ||
| startup_banner.py | ||