Spaces:
Sleeping
Sleeping
Commit History
-
docs: final sync β backend/README post-KI-070 + ADR-032 cross-links in README Β§4.3 + ENTERPRISE_AUDIT KI-080 rowβ
Three small completeness fixes surfaced by the end-of-session audit: - backend/README.md β `needs_finder.py` row now correctly described as "safeguard fallback only" post-KI-070 (was still labelled the primary fact-find driver, pointing to ADR-027). Added new row for `fact_find_brain.py` (the actual KI-070 driver). Marked `question_paraphraser.py` as deleted. - README.md Β§4.3 β opening sentence reframed from "fallback chain" to "candidate pool with probe-driven sticky primary election"; ADR-031 + ADR-032 cross-links added inline so a reviewer can jump straight to the architecture reference. - ENTERPRISE_AUDIT.md KI-080 row β added inline link to ADR-032 so the audit table's KI-080 entry routes through to the end-to-end architecture spec (was already linking ADR-031, now both). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>088ff0b -
docs: KI-088 + KI-089 + KI-090 β audit rows + CLAUDE.md sync (semaphore / test-fix / lenient parser)
2e5de93 -
fix(fact-find): KI-090 β lenient FF-block parser; accept JSON tail without <FF> tagsβ
Post-KI-088 live probe at commit 14ee008 showed brain success climbed from 20% to 30% as the NIM concurrency semaphore fixed queue saturation β BUT 70% of turns now fell to `fallback:no_trailer` at 4-10s latency (not 41s). The brain IS responding successfully; the parser was rejecting good replies because the LLM dropped the literal `<FF>...</FF>` tags and emitted a bare JSON tail instead. KI-090 makes `_parse_ff_block` try three strategies in order: 1. Strict `<FF>{...}</FF>` (the contract β still preferred) 2. Fenced `\`\`\`json {...} \`\`\`` (common LLM habit) 3. Bare `{...}` at the end of the reply Each candidate must parse as a dict AND contain at least one of the contract keys (`captured` / `slot_driving` / `complete`) to count. Otherwise stray inline JSON in the prose would be falsely accepted. `_strip_ff_block` mirrors the new strategies in reverse so prose-only reply never leaks the tail JSON to the user. 7/7 parse test cases pass: strict, fenced, bare-tail, strict-wβ¦11cf4b3 -
test(llm-chain): KI-089 β update credits-election test for KI-087 NIM-first preferenceβ
The pre-KI-087 `test_groq_above_water_picked_in_election` asserted that Groq wins election when both candidates are healthy and Groq has more credits + faster latency. KI-087 (`d90f8c0`) inverted this: NIM is always preferred when eligible, regardless of latency. The test has been failing on main since KI-087 landed. Replaced with two paired tests that lock in both halves of the new contract: 1. `test_nim_preferred_over_faster_groq_when_eligible` β asserts NIM is elected as PRIMARY even when Groq is 3x faster AND has credits. The strategic point: NIM is the free, $0, no-daily-cap provider; Groq + OpenRouter are emergency fallback only. 2. `test_groq_picked_when_nim_pool_empty` β fallthrough invariant. When NO eligible NIM candidate exists (chain has only non-NIM models, or all NIM models down/quota-exhausted), election picks the highest-scored non-NIM candidate as PRIMARY. Locks in the safety net so a full NIM regional outage still produces a working brain caβ¦8a87526 -
feat(llm-chain): KI-088 β cap NIM outbound concurrency at 2 + serialise probe + drop inner retryβ
Live probe at 6a47549 measured only 2/10 brain turns succeeding despite KI-080 election + KI-085 credit gating + KI-087 NIM-first + KI-079 escalation all live. The chain architecture is correct; the binding constraint is NIM's free-tier per-key concurrency (~3-5 slots). Root cause: 5 sources of NIM traffic stack on the same key with no global throttle. 1. Probe loop (every 300s) fired ~6 candidates in parallel via asyncio.gather β 6-slot burst. 2. Admin tab polls /api/admin/llm-health every 30s. 3. Per-user chat turn: 1-2 NIM calls. 4. N concurrent users β N simultaneous calls. 5. Inner 4-attempt 429/5xx retry held one slot for up to ~15s on exponential backoff sleeps. 6+ in-flight β queue β 15-25s response times β bot's 12s outer cap fires β user sees fallback. 20% brain success rate measured. Three coordinated fixes: FIX 1 β Module-level asyncio.Semaphore(2) at backend/providers/ nvidia_nim_llm.py shared across every NvidiaNimLLM instance. Wraps ONLY thβ¦14ee008 -
docs: ADR-032 LLM chain architecture reference + KI-080..KI-087 doc syncβ
Adds new architecture reference ADR consolidating KI-079..KI-087: - 70-docs/60-decisions/ADR-032-llm-chain-architecture.md (NEW, 435 lines) - TL;DR + ASCII data flow diagram - Component reference (every ModelHealth field) - Election algorithm pseudo-code + score formula - Probe loop cadence + OpenRouter credits polling - Per-provider credit signal table (Groq headers / OR endpoint / NIM rate-meter) - Per-phase httpx timeout justification - Failure classification table - KI-079 escalation path - Telemetry surface (brain_used variants) - Performance characteristics + operational runbook Updated docs: - CLAUDE.md "LLM stack" section: KI-080..KI-087 full coverage + NIM-first preference (KI-087), credit gating (KI-085), per-phase timeouts (KI-084), admin tab (KI-086), HF Space secrets (KI-081) - 80-audit/ENTERPRISE_AUDIT.md: 5 new rows (KI-081, KI-084, KI-085, KI-086, KI-087) appended to "Fixes shipped today" table - backend/proviβ¦6a47549 -
feat(llm-chain): KI-087 β NIM-first election preference; non-NIM only when NIM pool emptyβ
User architectural decision: NIM is the strategic free provider (ADR-019: single-key, $0 cost, 110+ models, no daily token cap). Groq has a hard 100K tokens/day free-tier cap that we burned through today. OpenRouter charges a real USD balance. Both should serve as **emergency fallback only**, not as primary just because their probe latency is lower. Pre-KI-087: election scored by `latency Γ success_rate`. Groq's 161ms LPU TTFT consistently beat NIM's 500ms-1s, so every probe round elected Groq as PRIMARY across all 3 chains. Result: every chat call hit Groq first, ate Groq's daily TPD inside 50 turns, then started returning 429s. KI-087: election now prefers ANY eligible NIM candidate over ALL non-NIM candidates. Within the NIM pool, the standard latency Γ success_rate score still picks the fastest healthy NIM model. Only when the NIM pool is empty (every NIM model is down, degraded, or quota-exhausted via KI-085 credit gating) does election fall through to Groq/OpenRouter as primaryβ¦d90f8c0 -
feat(llm-chain): KI-085 β proactive credit tracking; election gates by quota not just livenessβ
WHY: KI-084 (commit 119e0fd) demotes a candidate for 1h AFTER the first HTTP 429 β that's REACTIVE. Cost: one user-facing failure per dead quota before the elector knows to skip it. KI-085 is PROACTIVE: every probe + every real call updates our view of remaining quota from response headers + provider endpoints; election filters by `is_alive AND has_credits` BEFORE suggesting a primary, so a quota-exhausted Groq is sidelined the moment headers say `remaining_tokens_day < 5000`, not after a 429 hits. SIGNAL SOURCES (priority order): 1) GROQ β response headers on every successful call. Parse `x-ratelimit-remaining-tokens-day` (the one that bit us today; free-tier daily TPD cap) + `x-ratelimit-reset-tokens-day` (duration string `"1h2m"` / bare seconds / unix epoch β all three shapes handled). Low-water 5000 tokens (β₯ one fact-find ~2K-input + ~400- output round-trip with margin). 2) OPENROUTER β dedicated GET /api/v1/credits endpoint, polled every ~10 minβ¦8fc7979 -
feat(llm-chain): KI-084 β cut probe token consumption 50Γ + 429-demote for 1h + per-phase httpx timeoutsβ
Live diagnosis (2026-05-15): Groq returned HTTP 429 β body "Rate limit reached for model llama-3.3-70b-versatile on tokens per day (TPD): Limit 100000, Used 99454". ~30-50K of that quota was the probe loop alone (60s Γ 25 candidates Γ ~50 tokens/probe). Election kept picking Groq because its probe latency stayed best, so every chat call hit 429, fell to NIM Qwen which was also under load, hit the 25s outer timeout, and even the KI-079 escalation failed. Three coordinated fixes in one commit: 1. Probe overhead cut ~250Γ (backend/llm_health.py): - PROBE_INTERVAL_SEC 60 β 300 (5 min cadence) - PROBE_MAX_TOKENS 5 β 1 (same 200 envelope, content unused) - HEALTHY_PROBE_AGE_SEC 90 β 600 (tracks new cadence + headroom) Expected probe-driven Groq token spend drops from ~30-50K/day to ~3K/day baseline β well within the 100K free-tier daily quota. Election still adapts within ~5min of any provider degradation, which is more than fast enough at our chat volume. 2. 4β¦119e0fd -
docs: KI-080 β sync CLAUDE.md + ENTERPRISE_AUDIT + new ADR-031 + 11 stale KI-025/50-50 surface sweepβ
Documents the KI-080 architectural shift from "iterate every chain candidate per call" (ADR-026 / KI-025 50/50 NIM β Groq rotation) to "probe-elected sticky primary with cross-provider backup" (ADR-031). Files updated: - CLAUDE.md β "LLM stack" section rewritten for KI-080 election; KI-025 rotation marked deprecated. - 80-audit/ENTERPRISE_AUDIT.md β KI-078/KI-079/KI-080 rows added to "Fixes shipped today" table; executive-scorecard UX-latency + test- coverage rows updated to cite KI-080 (supersedes KI-025). - 70-docs/60-decisions/ADR-031-sticky-primary-election.md β NEW. Full ADR following ADR-030 shape: Context, Decision, Alternatives, Consequences, Files touched, Revisit at scale. - 70-docs/60-decisions/ADR-026-provider-load-balancing.md β header updated to "Superseded by ADR-031"; body retained as historical record per ADR convention. - 70-docs/60-decisions/ADR-030-llm-driven-fact-find.md β pointer to ADR-026 swapped for ADR-031. - READMEβ¦c592055 -
feat(llm-chain): KI-080 β sticky primary election; 1-2 LLM calls per turn instead of 5-6β
Architectural refactor: the chain list is now the CANDIDATE POOL for probe-driven election, not a per-call sequence. Pre-KI-080, NimChainLLM.chat iterated the full chain sequentially every turn. Under NIM per-key concurrency throttling, the first 5 NIM-hosted candidates queued together inside ONE turn, burning the 22s budget before any cross-provider fallback (Groq / OpenRouter) was ever reached. The 10-turn live probe at commit 078ff45 showed 7/10 fact-find turns timing out at exactly 26.6s β every failure a timeout, never a parse error. ELECTION ======== backend/llm_health.py: - Probe cadence tightened 5min β 60s so election reflects pool health fast enough that a NIM brownout rotates out within a minute. - Each candidate carries probe_history (last 5 ok/latency pairs) and a degraded_until_monotonic sin-bin window. - score = (1/max(50, latency_ms)) * success_rate_last_5 - get_primary(chain_name) β highest scorer with a probe within 90s. - get_backup(chain_name) β β¦6159c54 -
feat(llm-chain): KI-079 β Groq earlier in FAST_BRAIN_CHAIN + escalate to BRAIN_CHAIN on timeout before canonical fallbackβ
Live 10-turn probe (commit 078ff45) showed 7/10 fact-find turns timing out at exactly 26.6s with _fallback_reason="timeout" β ALL failures are real timeouts, not parse errors. Root cause: FAST_BRAIN_CHAIN's first 5 candidates were all NIM-hosted; under NIM per-key concurrency limits they queued together and the chain burned its 22s total_budget_s inside NIM before reaching Groq Llama-3.3 70B at the chain bottom. FIX 1 (nvidia_nim_llm.py) - Move groq:llama-3.3-70b-versatile from FAST_BRAIN_CHAIN[5] (last) to FAST_BRAIN_CHAIN[1] (right after Nemotron primary). All other candidates kept. Nemotron remains primary (KI-035 latency win). - New worst-case time-to-cross-provider on a NIM hang: ~6-7s (per-link 6s timeout Γ 1 link) vs the prior ~22s. FIX 2 (fact_find_brain.py) - Add _TIMEOUT_S_ESCALATION = 15.0 alongside existing _TIMEOUT_S = 25.0. - On asyncio.TimeoutError from FAST_BRAIN_CHAIN, escalate ONCE to get_brain_llm() (BRAIN_CHAIN β Qwen 80B primary + 8 fallbacks incl. Openβ¦87ee522 -
feat(llm-chain): KI-078 β tighten per-link timeout + narrow exception catch + stamp fallback reason for telemetryβ
Three related LLM-chain hardening fixes that together close the loop on KI-075's fact-find brain failure root cause: 1. nvidia_nim_llm.py β per-link timeout 12s β 6s in get_fast_brain_llm(). With a 22s total chain budget, a 12s per-link meant only 1 candidate could complete before the budget expired β i.e. the entire fallback chain was effectively dead. Healthy paths (Groq LPU, NIM Nemotron Nano, NIM Qwen) all TTFT in <2s, so 6s catches a degraded link fast and lets the chain try 3-4 candidates inside the 22s budget. NIM cold-start still has Groq's cross-provider link (no NIM cold-start exposure) + the outer fact_find_brain wait_for=25s. 2. nvidia_nim_llm.py β narrow the broad `except Exception` in NimChainLLM.chat() loop to re-raise asyncio.CancelledError, KeyboardInterrupt, SystemExit. The previous broad catch was swallowing CancelledError, so when fact_find_brain's outer asyncio.wait_for(_TIMEOUT_S=25s) fired, this loop kept burning the full chaβ¦078ff45 -
docs: sync KI-071..KI-077 to ENTERPRISE_AUDIT + CLAUDE.md (post-KI-070 safeguards + Name field)β
After KI-070 shipped the single-LLM-call fact-find, six follow-up KIs landed to make the experience robust under real-world LLM degradation and to surface the captured profile in the UI. Recording them in canonical docs so they're traceable across the repo. ENTERPRISE_AUDIT.md "Fixes shipped today" β added 7 rows: - KI-071 β 12-file docs reconciliation against actual code reality - KI-072 β P0 fallback captures user's answer to last-asked slot - KI-073 β Clear chat resets profile-completeness chip synchronously - KI-074 β P0 greedy multi-slot capture + slot-trigger guards - KI-075 β Brain timeout 12s β 25s (root cause of "still robotic") - KI-076 β HF Dataset viewer disabled (CastError gone) - KI-077 β Name field + profile-panel pre-fill from chat state CLAUDE.md "Fact-find loop" section extended with two new bullets documenting the safeguards added since KI-070: - KI-072/074 β fallback path no longer dead-ends; greedy multi-slot capture with trigger guards - KIβ¦dd6172a -
feat(profile): KI-077 β Name field + show current captured profile in Build-your-profile panelβ
User screenshot: the "Build your profile" sheet showed empty defaults (Just me / None / etc) even when the chat had captured the user's name, age, dependents, city, etc. Also no name input β user can't introduce themselves through the UI, only through chat. Fix: - backend/main.py β added `name` to `profile_dict` in BOTH /api/profile/ completeness AND /api/profile (POST) so the captured name flows to the UI + the panel can save a new name. Added `name` to ProfileUpdateRequest + in the loop that applies request fields. On name set, also persists to the named-profile JSON store (40-data/profiles/<persona_id>.json) so a returning visitor's profile auto-loads next time. - frontend/src/lib/api.ts β added `name` to UserProfile type. - frontend/src/app/page.tsx β ProfileBuilderPanel: β’ New `name` state + text input at top of the form with "captured from chat" badge when initialProfile.name is set. β’ useEffect to keep state in sync if initialProfilβ¦2bb3898 -
fix(fact-find): KI-075 β bump brain timeout 12s β 25s so NIM cold-start doesn't kill the callβ
Live probe on production (5 sequential turns, fresh sessions): Turn 1 13.2s fact_find_brain::fallback β cold start, timed out Turn 2 13.2s fact_find_brain::fallback β still cold, timed out Turn 3 23.3s fact_find_brain::fallback β still cold, timed out Turn 4 14.5s fact_find_brain::fallback β still cold, timed out Turn 5 6.4s fact_find_brain::continue β WARM, natural reply All 4 fallback turns hit ~13s latency β exactly at the `_TIMEOUT_S = 12s` asyncio.wait_for cap. The fast-brain chain has `total_budget_s = 22s` internally for cumulative chain failover, but the outer wait_for was killing the entire call before any cross-provider fallback link (Groq, OpenRouter) ever got tried. Bumped `_TIMEOUT_S = 25.0` to give: - NIM cold-start headroom (10-15s observed on first call after Space rebuild) - Room for one chain fallback hop (NIM β Groq) if the primary times out - Still bounded so we don't leak infinite latency This is the root cause of "language is stiβ¦5fc01a7 -
fix(fact-find): KI-074 β greedy multi-slot capture in fallback + stricter name parse + strip ** markdown leakβ
User screenshots showed two persistent issues after KI-072: 1. **Multi-fact utterance dropped to floor.** User said "I am 29 years old and looking for cover just for me" β should capture age=29 and dependents=self. KI-072 only checked `awaiting_question_id` (the LLM was driving the name slot from turn 1), tried to extract a name from the age phrase, failed, dropped both age + dependents. 2. **`**Be straight with me.**` markdown asterisks leaking** in the chat panel + read by TTS as "asterisk asterisk Be straight with me asterisk asterisk" β same class of bug as KI-068 but in a different GRAPH entry (health_conditions slot, needs_finder.py line 149-150). βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ KI-074 fixes (backend/fact_find_brain.py) βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ GREEDY multi-slot capture in `_canonical_fallback`: - Iterates 9 slots in prioritised order (age β dependents β income_band β existing_coβ¦4516e87 -
docs: KI-071 β reconcile docs with code reality (Qwen 80B / Nemotron 30B / Mistral 675B as current primaries)β
Source-of-truth audit found the production code on `main` runs Qwen 3-Next 80B (brain primary) + Nemotron Nano 30B (fast brain primary) + Mistral Large 3 675B (judge primary) per the D-022 inline brain swap on 2026-05-14 (NIM DeepSeek + Llama-4 Maverick pools were timing out for hours). The ADR-019 decision text + multiple docs still referenced DeepSeek V4-Pro / V4-Flash + Llama-4 Maverick as primaries. This commit aligns 12 files with the actual chain definitions in `backend/providers/nvidia_nim_llm.py`. DeepSeek V4-Pro / V4-Flash + Llama-4 Maverick are correctly documented now as **fallback chain entries** that re-enter rotation when NIM's pools recover. Files reconciled (+64 / -45): - `README.md` β Β§1.2 "Honest model picks" paragraph + Β§4.3 Model stack table rewritten. Heavy brain row now: "Qwen 3-Next 80B *or* Groq Llama-3.3-70B (50/50 rotation)". Fast brain: "Nemotron Nano 30B". Judge: "Mistral Large 3 675B". Full fallback chains documented. - `70-docs/60-decisioβ¦2e60476 -
fix(ux): KI-073 β Clear chat now resets profile-completeness chip immediately (stops stale "55% DONE" leaking to new user)β
User report (with screenshot): the header chip "YOU Your profile Β· 55% DONE" persisted after Clear chat when a different user was using the bot β so the new visitor saw the old visitor's profile completeness state in the UI even though chat history + backend session were cleared. Root cause: the `clearChat` handler in `frontend/src/app/page.tsx` was clearing `messages`, `input`, `localStorage`, and the server-side session (via `postSessionReset(drop_profile=true)`) β but never resetting the local `profileCompleteness` state. The useEffect on `sessionId` should have refetched once the new session_id arrived, but if the network call hiccups OR there's any latency, the stale chip lingers visibly. Fix: explicit `setProfileCompleteness(null)` immediately at the top of the `clearChat` handler, before any network call. The chip clears synchronously; the new fetch repopulates it (to 0% for the fresh session) when the backend responds. Architecture clarification (per user's question): - Baβ¦c53381c -
fix(fact-find): KI-072 β canonical fallback now captures user's answer + doc sync (CLAUDE.md / ADR-030 / ENTERPRISE_AUDIT)β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ KI-072 β P0 fallback wedge fix (backend/fact_find_brain.py) βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ Live user screenshot showed the bot stuck asking "First β what should I call you? I'll save your profile so the next time you visit, you won't have to answer all this again." FOUR times in a row while the user answered "I am Don" / "Don" / "Don Jon". Every answer dropped on the floor. Root cause: when KI-070's `drive_fact_find()` brain call fails (timeout, malformed JSON trailer, chain exhaustion), it falls back to a canonical question via `next_question(profile).prompt_en`. But the original fallback just returned the question text β it never tried to APPLY the user's current message to whichever slot was last being asked. So under any sustained LLM degradation (NIM rate limit / pool timeout), fact-find wedges into an infinite re-ask. Fix: `_canonical_fallback` now takes `session` + `user_text`, reβ¦e098e1b -
feat(fact-find): KI-070 β single-LLM-call fact-find replaces 3-layer template stitchingβ
Real-user feedback on 2026-05-15 flagged the fact-find flow as robotic and templated because it WAS three stitched layers: hardcoded canonical prompts in needs_finder.GRAPH, per-turn paraphrase in question_paraphraser.py, and acknowledger rotation (_pick_opener / _family_aware_opener) in the orchestrator. Replace all three with ONE LLM call per turn that produces a natural conversational reply plus a machine-readable <FF>...</FF> trailer declaring captured fields, the slot it's driving toward, and whether fact-find is complete. New: backend/fact_find_brain.py - drive_fact_find(user_text, session, chat_history, session_id) -> FactFindOutcome(reply_text, captured_updates, slot_driving, fact_find_complete, ambiguous) - System prompt encodes the 9-slot schema, conversation rules, and strict trailer-block format with 5 worked examples. - _parse_ff_block + _strip_ff_block split the trailer from the reply. - _validate_capture runs each LLM-emitted valueβ¦364591b -
fix(profile + ux): KI-068 humanize readback / strip markdown / async log; KI-069 fix name-capture false-positiveβ
KI-068 β Humanize readback summary + strip markdown leak (needs_finder.py, orchestrator.py) βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ User screenshot showed the readback rendering raw enum strings: "primary goal: first_buy; metro; budget 30k_60k. **If anything's wrong, just tell me** (e.g., ...)" - Added label tables (_PRIMARY_GOAL_LABELS, _LOCATION_TIER_LABELS, _BUDGET_BAND_LABELS, _INCOME_BAND_LABELS, _DEPENDENTS_LABELS) and use them in `readback_summary`. New output for the same profile: "29 years old; covering just yourself; income βΉ25L+; no existing cover; goal: first health policy; metro city; budget βΉ30,000β60,000/year" - Stripped the `**...**` markdown wrapper around "If anything's wrong, just tell me" β was leaking as literal asterisks in the chat panel + being read by TTS as "asterisk asterisk". Also made KI-063 shown-policy logging fire-and-forget via `asyncio.create_task(asyncio.to_thread(...))` so N disk β¦26023b8 -
fix(fact-find): KI-067 β recognize "first policy" / "new to insurance" as zero existing coverβ
User screenshot: bot asked "Already have any health insurance ...?", user replied "This is my first policy.", bot rejected with "Sorry, I didn't catch that. Let me ask again β". User had to repeat as "No, this is my first policy." to make it through. Root cause: `_parse_existing_cover()` only matched the negative-word path (`no|none|haven't|don't|...`) but not the semantically-equivalent first-time-buyer phrasings that are common in natural speech. Fix: added a second pattern bank to the function. Recognises any of: - first policy / first insurance / first one / first time / first buy - buying my first - new to insurance / new to health insurance - never bought/had/got/taken - haven't bought/had/got/taken - don't have any / a policy / insurance / cover Also added bare "never" to the original negative-word pattern. Verified 17/17 inline cases (8 new first-time variants + 9 existing positive + negative cases). No regression on numeric amount parsing ("5 lakhs" / "βΉ5L" / "β¦28f795b -
fix(voice): KI-066 β TTS normalizes βΉ/L/Cr shorthand to spoken languageβ
User report (with screenshot of fact-find Q): TTS is reading "βΉ5L, βΉ5-10L, βΉ10-25L, or βΉ25L+" as "two five L plus" β letter-by-letter β instead of spoken-language "5 lakhs, 5 to 10 lakhs, 10 to 25 lakhs, or 25 lakhs or more". The robotic delivery breaks the voice UX of the entire fact-find flow. Root cause: backend/voice_format.py was already stripping markdown and expanding a few BFSI acronyms (PED, OPD, NCB...) but had no handling for the rupee/lakh/crore shorthand that's everywhere in this domain. Fix: new `_normalize_money(text)` step in tts_preprocess. Order-sensitive regex chain β ranges first ("5-10L" β "5 to 10 lakhs"), then plus-suffix ("25L+" β "25 lakhs or more"), then bare units, then "Rs."/"βΉ" prefix replacement. Patterns now spoken correctly (verified 6/6 inline cases): βΉ5L β "5 lakhs" βΉ5-10L β "5 to 10 lakhs" βΉ25L+ β "25 lakhs or more" βΉ1Cr / βΉ2Cr+ β "1 crores" / "2 crores or more" Rs. 50,000 β "rupees 50,000" βΉ15,000 β "rupeesβ¦7d021cf -
fix(voice): KI-064 β silence-end window 90 β 120 (~1.5 s β ~2 s)β
User: "cut off and submitted before the last word" after saying "Hi, I'm looking to buy a new insurance ...". KI-060's 1.5 s was still tight enough to swallow the natural thinking pause before "policy" / "plan". Bump to 120 frames (~2 s). Trade: ~0.5 s extra tail latency before the bot starts responding, but no more dropped tail words. Single config change in DEFAULTS; opt-overridable via opts.silenceEndFrames. History of this knob: v1 (KI-057, 2026-05-15): 40 frames (~640 ms) β too tight. v2 (KI-060, 2026-05-15): 90 frames (~1.5 s) β still cut "insurance .. policy". v3 (KI-064, 2026-05-15): 120 frames (~2 s) β covers normal thinking pauses. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>4c6215a -
feat(profile): KI-063 β shown / selected / rejected policy tracking on profileβ
Adds per-user, persistent policy interaction tracking so the bot remembers across sessions which policies were shown to a user, which they shortlisted, and which they rejected. Schema (backend/needs_finder.py) β’ Profile gains three list fields: shown_policies, selected_policies, rejected_policies. Each entry: {policy_slug, insurer, event_at (ISO Z), session_id, reason}. Storage helpers (backend/profile_store.py) β’ record_policy_event(persona_id_or_name, profile, event_type, policy_slug, insurer, session_id, reason) β appends or dedup-updates on (policy_slug, event_type); persists via existing save_profile so persona-id keying stays consistent. β’ get_shortlist(profile) β convenience wrapper around selected_policies. Orchestrator wiring (backend/orchestrator.py) β’ After every recommendation / comparison turn that passes faithfulness and was issued by a named profile, iterate citations and log event_type='shown' / reason='shown_in_recommendation'. Wrβ¦d89a871 -
feat(profile + voice): KI-059 / KI-060 / KI-061 / KI-062 β opening-turn name capture, looser VAD silence, personalized welcome-back, unique persona IDβ
Four user-testing fixes landed in one commit. KI-059 β Catch name disclosed in opening message βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ User typed "Hi this is Rohit" as the very first message; bot still asked "what should I call you?". Now an opening turn that contains a self- introduction routes straight into the name-slot handler. - New `_contains_self_introduction(text)` helper. Strips leading greetings ("hi", "hello", "hey", "namaste", "yo") then matches "I'm X" / "I am X" / "this is X" / "my name is X" / "name is X" / "call me X" / "name's X". - Tested 10/10 (positive + negative cases pass). - When detected on turn 0, orchestrator synthesises `session.awaiting_question_id = "name"` so the existing name-slot pipeline (extract, save, welcome-back lookup) runs. - Name-handler prefix loop widened: now strips leading "hi[,]? " / "hello[,]? " / "hey[,]? " / etc. BEFORE the "this is " / "i'm " / etc. loop, so "Hi, this is Rohitβ¦e610ee9 -
feat(voice): KI-057 β noise-robust Live VAD + flush-on-stop; KI-058 β scope lib/ ignore to venvsβ
KI-057 β Live mode VAD hardening (useLiveConversation.ts) βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ User report: "Background noise continues to play a big issue, even random noise without people speaking or just ambient noise keeps the live listening on, and it keeps processing on something and not moving on. Also, if an entire series of things have been said and I turn off the live chat, should that not auto submit?" Root causes: - Static rmsThreshold: 18 triggered on HVAC / fan / traffic noise. - Once triggered, silenceEndFrames: 40 never accumulated because ambient kept the meter above threshold β segment never closed. - tearDown() silently dropped speechBufferRef when Live was toggled off mid-utterance. Six layered fixes (all overridable via opts; tuned defaults shipped): A. Adaptive noise floor β EMA of ambient avg while idle. Effective threshold = max(rmsThreshold, noise_floor * 2 + 4). HVAC keeps the bar high. B. Voice-band spectraβ¦23a6d29 -
feat(ux): KI-056 β natural-language acknowledgers + spouse capture + Q3 paren consistencyβ
Three fixes for robotic-feeling fact-find UX surfaced by 2026-05-15 user testing. 1. Dynamic acknowledger opener (orchestrator.py) _pick_opener() rotates 8 natural openers ("Thanks for that. ", "Noted. ", "Helpful β ", "Right, ", "OK. ", "Got it. ", "Makes sense. ", "") deterministically keyed by (session_id, turn_idx, slot). Applied to both the continuation opener and the readback summary. 2. Family-aware opener (orchestrator.py) _family_aware_opener() detects spouse/kids/parents mentions and swaps in an explicit acknowledgement ("Understood β for you and your spouse, then. ") so the user feels heard when volunteering family info mid-flow. 3. Opportunistic dependents capture (needs_finder.py + orchestrator.py) infer_dependents_from_text() pre-fills profile.dependents from any slot's answer so the dedicated dependents slot gets skipped. Does not conflict with INSURANCE_BOT_SKIP_PROFILE_EXTRACTOR (KI-053) β regex-only, no LLM. 4. Q3 paren consistency (nβ¦2fbd062 -
fix(deploy): KI-055 β drop rag/vectors symlink from repo (HF Space BUILD_ERROR)β
Live symptom: HF Space stage = BUILD_ERROR with exit code 1 after the recent push cascade. Smoke confirmed the symlink was the culprit. Background: rag/vectors was committed as a Git symlink (file mode 120000) pointing to ../_hf_dataset_backup/rag/vectors β a local-dev convenience so backend can read the cloned HF dataset without copying. In the Docker build context, _hf_dataset_backup/ doesn't exist (it's local-only + ~136 GB and explicitly gitignored), so the symlink is BROKEN inside the container. When the final stage runs: RUN useradd -m -u 1000 user && chown -R user:user /app chown walks the entire /app tree, follows the dangling symlink, and fails with "no such file or directory" β exit 1 β BUILD_ERROR. Fix: β’ `git rm --cached rag/vectors` β remove the symlink from the repo. β’ Add `rag/vectors` to .gitignore so it can't be re-committed. In production, the Dockerfile's snapshot_download step (line 65-78) pulls the canonical vectors from the HF dataset directly into /appβ¦8ff05ba -
refactor + feat: KI-050b/053/054 β rename completeness + eval speed + tax questionsβ
Combines three logically-related changes into one push-clean commit (rewrites the prior 67bdd3a + 866fb24 to drop accidentally-swept-in binaries + runtime state that tripped HF Space's pre-receive hook). KI-050b β data/ β 40-data/ rename completeness across docs: β’ 40-data/ internal docs (README, corpus_urls.md, info_source_map, illustrative_premiums.json, llm_health.json, profiles/README, reviews/icici-lombard.json) β’ kb/ β AUDIT_TRAIL, INDEX, all 218 kb/policies/*.md mirror sheets, kb/research/corpus_acquisition.md, kb/reviews/* leaderboards β’ tools/ β info_source_map.py, build_kb_mirror.py, full_pipeline.sh, README, ~12 other scripts touching data/ paths in prose β’ eval/info_source_map.json (2772 source-provenance entries) + README entrypoint.sh preserved β its `/data/` paths are absolute HF Space persistent-disk mounts, NOT references to the repo folder. KI-053 β eval/run.py --no-extract flag. Skips the orchestrator's free-form profile_extractor LLM call β¦57ef382 -
feat(admin): KI-052 β 3-tab admin panel (Profiles, Performance, LLM Chain)β
Restructures the iframe-embedded admin panel into three tabs, each lazy-loaded on first activation. The existing LLM Chain functionality is preserved verbatim β original markup wrapped in <section id="tab-chain">, all the original behaviour (chain reorder + save/reload, health probe, recent usage) intact. Tab 1 β Profile + Visitor Log: β’ Fetches GET /api/admin/profiles (KI-048). β’ Sortable table β Name Β· Slug Β· First seen Β· Last seen Β· Sessions Β· Fields (with completeness mini-bar). Default sort: last_seen desc. Click column headers to toggle. β’ Tolerant of {profiles:[...]} wrapper OR bare array. β’ Empty state: "No named profiles yet β users haven't told the bot their name." Tab 2 β Performance: β’ Fetches GET /api/admin/performance (KI-048). β’ Three sub-cards, each collapses gracefully when its slice is null: - Gold eval: factual / citation / refusal / n_questions metric tiles + by_brain + by_type breakdown tables. - Persona audit: personas_complβ¦c53d167 -
fix(docker): KI-051 β update COPY paths after bucket reorg (data β 40-data, docs β 70-docs). Previous attempts hit Edit's read-first rule and didn't actually persist. Live HF Space rebuild was about to fail on COPY data and COPY docs since both source dirs no longer exist at the renamed paths.β
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>2eae364 -
refactor: KI-050 β complete data/ β 40-data/ rename across all Python refsβ
The data/ β 40-data/ git mv landed in the previous commit (c8bf1a1) but the corresponding string-path updates in Python code did not β Python was still resolving _DATA_ROOT, _PROFILES_DIR, PREMIUM_DATA, HEALTH_FILE, etc. to the now-non-existent data/ path. The HF Space rebuild would have shipped a broken backend. This commit sweeps the 23 files that referenced data/ as a string path: β’ `"data/*` β `"40-data/*` β’ `/data/*` β `/40-data/*` β’ `(data/` β `(40-data/` β’ `Path("data" ...)` β `Path("40-data" ...)` β’ `ROOT / "data"` β `ROOT / "40-data"` Touched: backend/{session_state, profile_store, premium_calculator, llm_health, admin, main, scorecard, providers/nvidia_nim_llm}, rag/build_kb, tools/{check_link_rot, info_source_map, refresh_premiums, generate_policy_facts, curate_*, ingest_reviews, ingest_kb_summaries}, backend's per-folder docs, etc. Dockerfile: `COPY data ./data` β `COPY 40-data ./40-data` β container path mirrors host. Verified by: β’ Python smoke: _DATA_ROOβ¦52c6351 -
perf(retrieval): KI-049 β wider top-k for table-cell questionsβ
Post-fix 96-Q eval (54.8% factual) surfaced 8 failures on room-rent / sub-limit / cap questions where the bot's reply omitted the specific room category ("Single Private", "Twin Sharing", "General Ward"). That's 19% of remaining failures. Root cause: the policy table with the structured cap is ONE chunk in Chroma, but at top_k=5 it loses to other relevant prose chunks (definitions, sub-limit prose elsewhere in the doc) β the LLM never sees the table β can only paraphrase from looser context β misses the row categories. Fix: when the query matches a table-cell trigger pattern, raise effective_top_k to 10 for that query only. Trigger regex covers: β’ room rent / sub-limit / sub-limits β’ copay / co-pay β’ cap on / capped at / sum insured limit β’ single private / twin sharing / general ward β’ no-claim bonus / NCB Verified the regex fires on the eval's failing questions and ignores generic waiting-period queries (which retrieve fine at top_k=5). Combined with KI-046 (refusal prβ¦c8bf1a1 -
feat(admin): KI-048 β /api/admin/profiles + /api/admin/performanceβ
Backend side of the admin-panel 3-tab restructure. Adds two endpoints that feed the Profile + Visitor Log and Performance tabs (the LLM Chain tab continues to use the existing /health, /probe, /chain, /usage). GET /api/admin/profiles β wraps profile_store.list_profiles(). β returns { profiles: [...], total: N, snapshot_ts: "..." } β empty list when data/profiles/ has no entries yet. GET /api/admin/performance β composite from three sources: β’ eval/results.json summary block (factual / citation / refusal, by_brain, by_type, n_questions, ran_at, elapsed_seconds) β’ latest 80-audit/full_<ts>/ (most-recently-modified) β merges the launcher's summary.json with regex-parsed report.md (turns_total, errors, refusals, p50/p95/p99 ms, brain_routing) β’ data/llm_usage.jsonl tail (1000 lines) β per-role count, success_rate, avg_latency_ms β each sub-block independently nullable so a missing data source doesn't 500 the whole endpoint. Both endpointβ¦13a1cf4 -
refactor: KI-047 β bucket reorg (Option A safe subset)β
User picked numbered-bucket layout. Executing the SAFE subset that does NOT touch Python imports or string path refs: β’ docs/ β 70-docs/ β’ audit_results/ β 80-audit/ Kept as-is (renaming would need ~25 Python files of string-path updates β deferred to follow-up): β’ data/ β code-referenced (backend/{premium_calculator, session_state, profile_store, scorecard, admin, llm_health, main}, rag/build_kb, tools/{check_link_rot, info_source_map, curate_*, refresh_premiums, generate_policy_facts}). β’ backend/, frontend/, rag/, tools/, eval/, tests/, kb/ β Python directly forbids leading-digit / hyphen package names. All references to the moved folders updated in one sed pass across *.md, *.py, *.sh, *.ts, *.tsx, *.json, Dockerfile. Verified by: β’ tests/test_routing_regression.py β 15/15 still pass. β’ No residual (docs/ or [docs/ or /docs/ or ^docs/ refs. β’ Same for audit_results/. Docβ¦e2d09f9 -
fix: KI-046 β explicit refusal on adversarial/fanciful out-of-corpus questionsβ
The 93-of-96 post-fix eval surfaced refusal precision as the single biggest failure mode: 11 of the 42 failures (26%) were "did not refuse when expected" β mostly variants of: β’ "Does X cover injuries from space tourism?" β’ "What is the maximum claim amount for diamond-tipped surgical equipment?" β’ "What is the IRDAI mandate on dental coverage that X must follow?" These are intentional adversarial tests of refusal hygiene. The bot was treating them as ordinary coverage questions, retrieving the closest- related policy text, and answering with mis-selling-shaped reasoning like "the policy doesn't explicitly exclude this, so it might be covered." Fix: new rule 1a in `ADVISOR_SYSTEM_PROMPT_V1`. The bot is now instructed to refuse cleanly when the question asks about a fanciful or obviously-out-of-corpus scenario, with the exact refusal phrasing: "I don't have grounded evidence for that in any of the policy documents I've indexed β I'd rather not speculate. Is there a β¦28b6114 -
feat: KI-045 β natural-conversation classifier in fact-findβ
Previously every user message during fact-find got parsed as an answer to the awaiting slot. The bot couldn't gracefully handle off-topic asides ("by the way, what's a co-payment?"), mid-flow questions, or explicit intent change ("never mind, just suggest a policy"). New (heuristic, zero LLM call): before the existing normalizer flow runs, classify the user's message: β’ intent_change β matches one of: "never mind", "forget the profile", "actually let me ask", "wait, can you", "skip this", "let's switch", "stop asking", "i have a question", "just tell me". β’ off_topic_question β ends with "?", β₯4 words, AND none of the obvious slot-answer keywords (yes, no, self, spouse, kids, parents, diabetes, bp, thyroid, lakh, lac). β’ otherwise β direct_answer, existing flow. On intent_change OR off_topic_question: β’ Set `session.free_form_session = True` and flush. β’ Set `treat_as_fact_find = False` so we fall through to the QA / retrieval / brain path for the rest β¦930e11e -
feat: KI-044 PCM pre-roll via AudioWorklet + 11 folder READMEsβ
KI-044 β Proper first-word capture in Live mode. Previous MediaRecorder approach started recording only AFTER VAD declared speech-start, missing the first 50-100 ms of the opening word. User report: "ensure that the first word uttered is also captured, especially in live." New approach (frontend/src/lib/useLiveConversation.ts): β’ Inline AudioWorkletProcessor (Blob-URL registered, no static asset routing) taps the raw PCM from the mic source. Every render quantum (128 samples) is posted to the main thread as Float32. β’ Main thread maintains a circular preroll buffer (~300 ms at the AudioContext sample rate) while no utterance is in progress. β’ When VAD fires speech-start: snapshot the preroll into the active utterance buffer; continue accumulating subsequent samples. β’ When VAD fires silence-end: encode utterance as 16-bit PCM WAV (Sarvam Saarika native format) and post to onUtterance. β’ Worklet stays running via source β workletNode β silentSink (zeroβ¦86fcc31 -
fix(voice): KI-041/042 β VAD sensitivity + Live OFF by default + dots on first turnβ
KI-041 β VAD threshold tuned for real-world barge-in. User reported "speaking over the bot doesn't interrupt" despite KI-030's in-DOM audio fix. Root cause was VAD insensitivity: rmsThreshold 28 (0-255 byte scale) was too high for typical conversational volume β VAD didn't fire, so interruptBotAudio() never ran. Lowered to 18 (catches normal speech, still rejects breathing / keyboard / room hum) and speechStartFrames from 5 β 3 (~48ms vs ~80ms; cuts barge-in latency). KI-042 β Live is OFF by default. User feedback: always-on mic was "a huge problem β user can't control when to speak, can't control background noise." Initial state is now grey pill "Voice off β click to enable always-on". Preference still persists in localStorage("insurance_live_pref") so returning users who DID opt in see Live on. Only "on" persists explicitly; default and "off" both render grey. Updated copy: β’ Pill: "Voice off β click to enable always-on" (was "click to turn on, or use π€") β’ Empty-state herβ¦748ce54 -
feat: KI-039 + KI-040 β single Clear-chat (keep profile) + named profilesβ
KI-039 β Single Clear-chat button. The previous two-button setup ("Clear chat" / "Start fresh") confused users. Now one button labeled "Clear chat" wipes the visible conversation but KEEPS the server-side profile, so the bot doesn't lose context β next turn picks up with the existing profile loaded. The user-stated rationale: "the LLM still knows what conversations, what questions have already been answered, and it can speak in a natural manner." KI-040 β Named profiles for cross-session identity. Backend changes: β’ backend/profile_store.py (NEW) β JSON-keyed by normalised name. save_profile / load_profile / list_profiles + is_valid_name. Files at data/profiles/<slug>.json. Display name preserved inside each file. Atomic write via .tmp + replace. β’ backend/needs_finder.py β Profile dataclass gains `name: Optional[str]`. GRAPH gets a new slot 0 ("name") that asks "First β what should I call you?" before age. Free-text, validated 1-50 chars 50%+ alpha. β’ backeβ¦4449d44 -
fix(voice): KI-039 β single Clear-chat button (full reset)β
User feedback on the two-button setup ("Clear chat" + "Start fresh"): "these 2 options adds confusion. let there just be one. to clear the chat fully." Then a clarifier on the LLM-burden tradeoff, then explicit direction: "Clearing chat should also clear profile." Resolved by collapsing to ONE button: β’ Label: "Clear chat" β’ Action: handleClearChat(true) β wipes visible messages, calls POST /api/session/reset with drop_profile=true, clears localStorage chat + session id, adopts the fresh server-issued session id. β’ No confirm dialog β user wants one-click simplicity. β’ Rose hover tint to signal the destructive intent without forcing a dialog. β’ Tooltip: "Wipe this conversation β clears chat history, profile, and starts a fresh session". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>a774b91 -
fix: KI-036/037/038 β greeting flow, strict paraphrase verifier, waiting dotsβ
Three user-reported UX bugs from voice-mode testing, all fixed together. KI-036 (orchestrator + paraphraser) β Strict paraphrase end-of-string check. Previous verifier checked `"?" in paraphrase` (anywhere), letting the dependents-slot paraphrase emit "...have their own insurance options.?" β period AND question mark at end. Now require `paraphrase.rstrip().endswith("?")` AND reject malformed sequences: ".?", "?.", "??", "!?", "?!", ",?". On rejection, fall back to canonical question text (no UX regression). KI-037 (orchestrator) β Greeting + intent-restart detection. Previous behavior: ANY message arriving while `session.awaiting_question_id` was set got parsed as an attempted answer. User opening the bot with "Hi, I am looking to buy an insurance policy." after a prior partial fact-find got "Sorry, I didn't catch that. Let me ask again β Who else needs cover..." β which feels broken because the user intended a fresh start. Fix: β’ Pure-greeting detector β input that, after strippβ¦36ef017 -
docs: full sweep β fix stale model names + 48β62 fields + merge SUBMISSIONβ
User flagged stale references throughout the docs. Per the pattern- extrapolate prime directive, enumerated every instance before fixing. Stale-reference fixes: β’ "48-field" / "48 fields" / "24 of 48 fields" β 62-field everywhere. Verified ground truth: HealthPolicy in rag/schema.py has 62 fields (PolicySchema model). The "48-field" claim was a relic from an older version of the schema and never got updated across docs. β’ "NIM V4-Pro" β "the fast-brain chain (Nemotron 30B / Qwen 80B fallback)" β’ "NIM DeepSeek-V4-Pro" β "the brain chain (Qwen 80B primary, 50/50 with Groq Llama-3.3)" β’ "DeepSeek-V4-Flash" β "Nemotron Nano 30B (current fast-brain primary)" β’ "NIM Llama-4 Maverick" β "the judge chain (Mistral Large 3 675B primary)" β’ "Llama-4 Maverick" (as judge) β "Mistral Large 3 675B" β’ Model IDs (deepseek-ai/deepseek-v4-pro etc.) β current chain primary IDs β’ "285 structured extractions" β 203 (actual count of extracted JSONs) β’ "~12,000 vector chβ¦050823a -
perf: KI-034 retrieval cache + KI-035 reorder FAST_BRAIN_CHAINβ
KI-034 β Retrieval cache. In-process LRU keyed by (query_text_normalized, top_k, sorted policy_ids, sorted insurer_slugs). Cap 256 entries; FIFO/LRU eviction so memory stays bounded across long sessions. Skips both the Voyage embed call AND the Chroma query + regulatory/review boost passes on cache hit. Typical chat session has lots of near-identical follow-ups ("waiting period?" β "PED waiting period?" β "diabetes waiting period?"). Cache key is lowercased + stripped so trivial reformatting hits the cache too. Cache invalidates implicitly on process restart (HF Space rebuild). Smoke: _cache_key("what is the waiting period?", 5, None, None) == _cache_key("WHAT IS the Waiting Period? ", 5, None, None) β True _cache_get returns ['mock_chunk'] for either form. KI-035 β FAST_BRAIN_CHAIN reorder. Fast brain serves the latency-sensitive roles: fact-find, QA, paraphrase, normalize, extract. Throughput-wise they're all sub-second by content size, so TTFT dominates perβ¦844ed03 -
fix: KI-033 β move fact-find normalizer + profile extractor to NIM chainβ
Both modules were calling NvidiaNimLLM(model="meta/llama-3.3-70b-instruct") as a hardcoded single-model client. When that specific NIM pool got rate-limited (the 40 req/min cap is shared across all models on the same key), the call raised, our except-Exception swallowed it, and the caller got None β which: β’ In fact_find_normalizer: caused the bot to mark the answer "ambiguous" and reask. Two consecutive reasks β give up + move on with no slot captured. This is the cascade pattern that produced D-005 (only 12/100 personas got age captured even though every persona was canonically asked for age on turn 1). β’ In profile_extractor: returned {} β no free-form profile updates applied β recommendation flow gets a stale or empty profile. Fix: replace single-model client with NimChainLLM(FAST_BRAIN_CHAIN, ...). FAST_BRAIN_CHAIN already includes Qwen 80B, Nemotron Nano 30B, GPT-OSS, Qwen 122B, DeepSeek V4-Flash, and Groq Llama-3.3-70B β so when NIM's Llama pool is satuβ¦9a977de -
feat(voice): KI-032 β LLM-paraphrase fact-find questions (Option B + verifier)β
User report: the bot's 9 fact-find questions are asked in the same fixed order with the same fixed wording every session β "mechanical and robotic". Root cause: backend/needs_finder.py::GRAPH is hardcoded strings; no LLM runs in the question-asking loop, only in the answer-normalizing loop. New backend/question_paraphraser.py: β’ paraphrase_question(canonical, slot_id, session_id, recent_user_text) β LLM-rewrite the canonical with warmer, more conversational tone while preserving the educational/parenthetical "why we ask" context. β’ Uses NimChainLLM(FAST_BRAIN_CHAIN, timeout=4s, total_budget=6s) so the 50/50 NIM/Groq rotation applies β average latency ~1-2s, capped at 6s. β’ Verifier: parses JSON {paraphrase, asks_about_slot}, rejects if asks_about_slot drifts from the requested slot_id, if no question mark, or if length is out of [30, 500] chars. On any rejection, returns None so the caller falls back to the canonical text β no UX regression possible. β¦6f495c1 -
fix(voice): KI-030 β bot TTS now plays via in-DOM audio so barge-in worksβ
User report: "I can't speak and cut off the bot, it goes through its full read out without stopping." Root cause: bot replies were played via `new Audio(audioUrl).play()` (page.tsx:329, :401) β those create HTMLAudioElement instances that are NOT attached to the DOM tree. useLiveConversation's barge-in handler does `document.querySelectorAll("audio").forEach(a => a.pause())` β and querySelectorAll only returns DOM-attached elements. So when the user spoke over the bot, the VAD-driven barge-in dutifully pausedβ¦ nothing. The detached audio kept reading the full TTS through to the end. Fix: β’ Removed both detached `new Audio(audioUrl).play()` sites. β’ Message component now owns the playback via a ref'd `<audio controls>` element + a mount-only useEffect that calls `.play()` on it. Same element is what the user sees (so the play-bar reflects real playback state too β single source of truth). β’ barge-in's querySelectorAll picks up the in-DOM element and pauses it instβ¦3d06a80 -
fix(voice): KI-029 β make push-to-talk button visibly findableβ
User report: screenshot of the live toolbar with Voice off (red dot) β "no push to talk button". Root cause: the mic was a 40Γ40 icon-only button immediately adjacent to the also-icon-only upload button. With Grammarly's browser-extension icons overlapping the input area, the user genuinely couldn't tell which button was which. Changes: β’ Mic button now shows the icon AND a "Push-to-talk" label (visible on sm+ breakpoints; icon-only on mobile to save horizontal space). β’ When Voice is OFF (red pill), the mic button is highlighted in emerald with a soft outer ring and shadow β eye-catching call to action that says "use this instead". When Voice is ON, the mic stays neutral grey (since Live is the primary path). β’ While recording, the button turns rose/red with a "Stop" label. β’ Tooltips updated to spell out the consequence of each state β in particular, "Voice will stay off until you click the red dot" when PTT is used while Voice is off, so the user knoβ¦65ba46c