Spaces:
Runtime error
Runtime error
Commit History
-
Fix language selector: wire user choice through to generator
webmuppet +1: Claude Sonnet 4.6Three-layer fix: - pipeline.py: run_query_retrieval accepts an explicit language param; uses it for the response language while still auto-detecting the source language for query translation (can't translate from 'mi' if the text is English) - generator.py: language instruction now says 'user has selected X as their response language' rather than 'user asked in another language', which was wrong when the query was typed in English; imports get_language_name for the human-readable label - server.py: passes body.language through to run_query_retrieval - prompts/generator_system.md: clarifies that an explicit language instruction in the messages takes precedence over the English default Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>016503a -
server.py: fix SSE streaming — run pipeline in thread to unblock event loop
webmuppet +1: Claude Sonnet 4.6The synchronous pipeline (run_query_retrieval + run_query_stream) was being called directly inside an async generator, which blocked the event loop for the full generation duration. FastAPI could not flush SSE token events to the client until the generator returned — all tokens arrived simultaneously at the end. Fix: run retrieval with asyncio.to_thread and bridge the sync streaming generator to the async context via an asyncio.Queue + daemon thread. The producer thread posts each chunk via loop.call_soon_threadsafe; the async consumer awaits each item and yields the SSE event, giving the event loop time to flush it to the browser between tokens. Verified: tokens now arrive ~0.4s apart matching the pipeline cadence, consistent with the Streamlit prototype's streaming behaviour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>8aca002 -
Refactor: replace Streamlit with React+Vite SPA + FastAPI server
webmuppet +1: Claude Sonnet 4.6Replaces app.py (Streamlit) with a React+Vite single-page application served as compiled static assets by a new FastAPI server (server.py). The Python backend (src/pipeline.py, retriever, generator, router) is untouched. All user-visible features are preserved: chat with streaming LLM responses, conversation history, saved responses, profession and language selectors, password gate, citation chips, Markdown export, and starter pill questions. Key changes: - server.py: FastAPI entry point — JWT auth, POST /api/query/stream SSE, static file serving of frontend/dist/ - frontend/: React+Vite+Tailwind SPA with full TypeScript, 66 passing tests including property-based tests (fast-check) for storage, export, citations, streaming, and fork isolation - Dockerfile: multi-stage build adding Node frontend compilation step; CMD switched from streamlit to uvicorn - pyproject.toml: streamlit/streamlit-js-eval removed; fastapi/uvicorn/ pyjwt added - CORS only enabled when ALLOWED_ORIGIN en…b5c0df4