Spaces:
Sleeping
Sleeping
Commit History
-
Add round-robin provider rotation across 9 API keys
MahaultEach LLM call cycles to the next provider/key so no single key gets consecutive requests. Pools keys from Groq, Cerebras, SambaNova, Gemini, and Mistral env vars. Full session drops from 499s to 31s with zero rate-limit waits.90acace -
Batch emotion + profile extraction into single LLM call per coaching turn
MahaultReduces coaching phase from 3 LLM calls/turn to 2 by merging emotion classification and profile fact extraction into one request. Reworks client retry logic to treat 429 as soft signal with wait-and-retry for both streaming and non-streaming paths. Adds live conversation integration test covering full session flow.e3562aa
-
Remove LLM status badge from frontend
MahaultUsers don't need to see internal LLM connection state.9561ab7 -
Add automatic provider fallback on rate limiting
MahaultWhen primary provider (Groq) returns 429, automatically retry on the fallback provider (Mistral) using MISTRAL_API_KEY. Works for both regular and streaming requests.ff9dc3b -
Support GROQ_API_KEY env var and strip whitespace from config
MahaultCheck GROQ_API_KEY in addition to LLM_API_KEY and MISTRAL_API_KEY. Strip whitespace from base_url and model to prevent URL construction errors from trailing spaces in environment variables.aeb3ce6 -
Make LLM provider configurable via env vars (switch to Groq)
MahaultSupport any OpenAI-compatible API (Groq, Mistral, Together, etc.) via LLM_API_KEY, LLM_BASE_URL, and LLM_MODEL environment variables. Fail fast on 429 rate limits so callers use their fallbacks instantly.30d0b74 -
Fix emotion detection: center arousal in backend, fix LLM classifier fallback, add 57 emotion accuracy tests
Mahault- Center arousal in EmotionEngine.observe() and update() so all 4 circumplex quadrants are reachable - Fix classify_emotion() to fall back to heuristic instead of neutral defaults when LLM fails - Add 429 rate limit handling with Retry-After support in MistralClient - Add logging to classifier for error visibility - Expand heuristic keyword lists for better fallback accuracy - Fix streaming message ordering in frontend - Remove redundant frontend arousal centering (now handled in backend) - New test_emotion_accuracy.py: 57 tests across 7 classes covering classifier accuracy, pipeline inference, coherent/incoherent sequences, circumplex coverage, and belief dynamics22521f9 -
Add SSE streaming for token-by-token LLM responses and fix circumplex display
Mahault- Stream through full stack: MistralClient → CoachGenerator → Agent → API → Frontend - Agent step_stream() captures LLM context via flag, yields metadata then tokens - SSE endpoint with event types: metadata, token, done - Frontend renders tokens as they arrive with fallback to non-streaming - Fix circumplex arousal mapping: center [0.1,0.9] to [-0.8,0.8] for display - Update ROADMAP with profile visualization, companion gate, streaming features06e3c51 -
Add companion gate to planning/update phases and improve profile extraction
Mahault- Add emotional inference + companion gate to _step_planning and _step_update so "i am so sad" during planning triggers companion mode instead of proposing exercises - Add broader heuristic patterns for habits, emotions, and social activities to catch "watch too much youtube", "i am so sad", "stayed out with friends" - Upgrade profile extraction error logging from debug to warning level - Add info-level logging for LLM extraction results to trace empty extractions - Remove duplicate _update_user_model_from_text call in _respond_to_planning_chat5a644e7 -
Fix emotional detection, eliminate duplicate cognitive load calls, and add Bayes net visualization
Mahault- Fix current_emotion None handling in _assess_cognitive_load (emotional_data.get or {} pattern) - Add observation-level valence backup check for companion gate - Remove duplicate EFE call in _propose_next_coaching_step, use LLM to present exercises - Pass cognitive_load through to _propose_next_coaching_step to avoid redundant assessment - Add Bayesian network graph visualization (renderBayesNet/renderBayesGraph) to profile panel - Add CSS for bayes-graph container and fact probability displays - Make visualization test assertion more resilient to LLM response variationcbbd416 -
Add user profile visualization panel with Plotly charts
MahaultNew profile-data API endpoint and 5 collapsible visualization sections on the right panel: - Skill belief distributions (horizontal stacked bars with directional arrows showing score changes) - Emotional circumplex (2D valence x arousal with trajectory) - ToM user type dimensions (horizontal bars with reliability badge) - Causal dependency graph (network with bottleneck markers) - Profile facts (observed and inferred with probability bars) All charts auto-refresh after each coaching step.aec707f
-
Fix double LLM call at calibration-to-visualization transition and add behavioral test suite
MahaultRemove separate calibration ack for final question — sphere commentary now acknowledges the last answer as part of one cohesive response. Add test_behavioral.py with 11 tests covering: no stitched responses, emotional inference affects actions, companion gate activation, and cognitive load assessed once per turn.b184c9c -
Fix double LLM call in visualization-to-planning transition
MahaultRestructured _step_visualization to decide action BEFORE making LLM calls (one action per turn, one LLM call per action). Previously it generated a companion response, then generated a second planning response, and concatenated both — causing the "double response" problem. Also added companion gate to visualization phase so emotional distress triggers companion mode instead of EFE-driven planning transition.d76950c -
Fix double cognitive load assessment causing LLM repetition
Mahault_llm_generate was calling _assess_cognitive_load internally, duplicating the call already made in _step_coaching/_step_visualization. This doubled sentiment tracking and meant the LLM never saw emotional state data. Now accepts pre-computed cognitive_load and passes it through all paths.36e59ed -
Integrate emotional inference into EFE action selection
MahaultThread Circumplex POMDP outputs (valence beliefs, prediction error) into coaching readiness, lambda_epist, and EFE action selection so the agent responds to emotional state rather than just keywords.89bc1b1 -
Improve conversation naturalness and reduce number recitation
Mahault- Sphere commentary: talk about patterns not scores, don't repeat the last calibration acknowledgment - Core prompt: never recite scores like "53/100", speak in patterns instead ("your follow-through is one of your strengths") - Visualization: don't repeat sphere scores the user can see on chart - Sphere system instruction: share like a friend noticing patterns, not a clinical reporta663d0f -
Fix choice buttons showing without proposal, fix duplicate message history
Mahault- Only show accept/too-hard/not-relevant buttons when there's an actual intervention in the response, not on every planning/update message - Fix duplicate assistant message in conversation history: last calibration ack was tracked twice (once in _step_calibration, once in _transition_to_visualization), causing LLM to see it twice and repeat - Add duplicate detection guard in _track_conversation to prevent consecutive identical same-role messages2f7daf2 -
Fix duplicate user message bug causing LLM repetition, add debug logging
Mahault- Fix: companion gate was tracking user message BEFORE calling LLM, causing it to appear twice in the message list (once in history, once as current message). LLM responded to it twice. - Add duplicate message detection warning in generator - Add conversation flow logging: last 4 messages sent to LLM, companion mode triggers, EFE action selection results23ea500 -
Fix LLM response rambling and topic hijacking
Mahault- Strengthen brevity instruction: say ONE thing, ask ONE question, stop - Add explicit rule: when user changes subject, fully change subject without sneaking coaching back in - Reduce max_tokens from 500 to 300 to prevent mid-sentence truncation - Add coaching phase reminder to keep responses short and stay on the user's topic75fb061 -
Add companion mode and LLM status indicator
Mahault- Add /api/status endpoint and frontend badge showing LLM availability (green "Connected" or amber "Template mode") - Fix rigid coaching: detect off-topic/deflection before EFE runs and route to companion mode (LLM or template) instead of pushing exercises - Add _generate_companion_response() fallback for template-only mode05671b4 -
Add EFE-driven action selection, learning feedback loop, and Docker deployment
Mahault- Wire up Expected Free Energy (EFE) for action selection across all phases - Action-discriminative B matrices: propose_intervention, reframe, adjust_difficulty and safety_check now have distinct transition dynamics - New action_dispatcher module with dynamic lambda_epist scheduling (epistemic vs pragmatic drive balance evolves through session) - EFE drives decisions in visualization, coaching, planning, and update phases with keyword overrides preserved for explicit user intent - Profile Bayesian network now detects progress signals and feeds back into POMDP skill beliefs (learning feedback loop) - Dockerfile for Hugging Face Spaces deployment (port 7860) - 21 new tests for EFE (123 total, all passing)9cbd0dd -
Initial commit: MindSphere Coach — ToM-powered coaching agent
MahaultActive Inference coaching system with: - Factored POMDP over 8 skill dimensions + preference/friction factors - Theory of Mind via particle filter over user behavioral types - Empathic planning with reliability-gated G_social blending - Circumplex emotional inference (predict-observe-update loop) - Bayesian network user profile with causal reasoning - Dirichlet concentration parameter learning - Mistral LLM for natural conversation with dynamic context injection - FastAPI + WebSocket backend with vanilla JS frontend - Plotly radar chart visualization - 102 passing tests157b149