Spaces:
Sleeping
Sleeping
Commit History
-
Speed up chat + emit >=10 figures/tables per Phase-2 model run
Two user-visible fixes from the post-deployment feedback: 1. Chat felt slower than before the fallback chain landed. Root cause was not the chain itself (it exits on the first parseable response), but three pile-on effects that compound on a cold HF worker: a. max_tokens was 900 for a JSON output that is well under 200. The Gemini free tier generates up to the cap. Lowered to 400. b. Every chat call re-built the provider object, paying the GeminiProvider/_http setup cost on a cold worker. Now cached at module level (_provider_cache). c. LLMConfig.timeout_s was 30s, so a stalled provider cost the full 30 before the chain rolled over. Lowered to 12 with a CDPR_LLM_TIMEOUT_S env override for slow links. gradio_app.py also pre-warms the chain at module load time so the FIRST chat after a Space restart doesn't pay construction cost --- it pays it once, before the user even sees the page. simulation_builder gains…0c4152d
-
LLM fallback chain + Reset button + Accordion UI + per-run audit
Three independent fixes, all driven by the user's report after the last deployment: 1. LLM fallback chain (Gemini 429 -> OpenRouter -> echo). Gemini's free tier rate-limits aggressively (HTTP 429). When the 429 fires the chat used to die with a 'low confidence' note and the user had no fallback. cdpr.llm.config.resolve_fallback_chain now returns an ordered provider list driven by CDPR_LLM_FALLBACK_ CHAIN or, when unset, by which keys are configured. simulation_ builder.describe_to_request walks the chain and uses whichever provider returns parseable JSON first; the echo stub is appended unconditionally so the call never raises. BuilderResult.notes reports which providers were tried and which won. docs/llm- providers.md gains a 'Automatic fallback chain' section. 2. Reset button + collapsible accordion sections. Robot & dynamics / Trajectory / Time / Controller are now wrapped in gr.Accordion (default open=False, like file-tree folders). The Traj…a89fdfb -
Gemini: switch to gemini-2.0-flash; move key to header; redact errors
Three issues surfaced in the live chat box on the HF Space, all from the same Gemini call: LLM provider 'gemini' is unavailable: Gemini call failed: Client error '404 Not Found' for url 'https://generativelanguage.googleapis.com/v1beta/models/ gemini-1.5-flash:generateContent?key=AQ.Ab8RN6Ic8-CB7kqKS1-... (1) Google retired the gemini-1.5 family in mid-2025; the endpoint now returns 404 with a misleading 'model not found' wording. Switching the DEFAULT_MODELS['gemini'] entry to the current free-tier successor 'gemini-2.0-flash' (1M context, same JSON structured-output behaviour) restores parsing. (2) The provider was passing the key in the URL query string, so httpx's HTTPStatusError quoted the FULL request URL including ?key=... into the exception message --- which surfaced verbatim in the chat box and the build log. The key is now sent via the 'x-goog-api-key' HTTP header instead, so even when the next 4xx fires the URL no longer carrie…0f51210 -
LLM provider abstraction + conversational simulation builder + token leak fix
Implements the directive's LLM integration layer cleanly: five providers, zero hard SDK dependencies, never crashes when no key is configured. Also fixes the immediate security issue: the previous deploy attempt embedded a write-scope HF token directly in the git remote URL (visible to anyone running git remote -v). Security fix The token-embedded remote URL was sanitised: git remote set-url space https://huggingface.co/spaces/JoeTach/cdpr-simulator The leaked token MUST also be revoked manually at https://huggingface.co/settings/tokens . See the runbook in docs/hf-auth-troubleshoot.md for the full rotation procedure. src/cdpr/llm/ --- provider-agnostic LLM layer base.py LLMProvider Protocol + LLMMessage / LLMResponse dataclasses + LLMUnavailableError. config.py LLMConfig.from_env() that reads .env via dotenv (optional dep), with canonical env-var names (GEMINI_API_KEY, OPENROUTER_API_KEY, OLLAMA…1f10b7b