Voice UX: replies that arrive, in the language you speak - #22
Open
luca-71 wants to merge 5 commits into
Open
Conversation
npm audit fix, no --force needed: vite 6.4.1 -> 6.4.3, plus transitive bumps to postcss, nanoid, and picomatch. All within the ranges package.json already declares, so only the lockfile moves. The one that mattered here is the Vite dev server's arbitrary file read via WebSocket (GHSA-p9ff-h696-f583) — this project's documented workflow runs that dev server. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Nine call sites sent JARVIS's reply only inside `if audio:`, so whenever
Fish Audio was unconfigured, rate-limited, or failing, the reply was
dropped with no trace in the UI. The startup greeting and every proactive
notification — research complete, build finished, project connected — went
straight to nothing. Each site now falls back to a "text" message, which
the client can surface.
Three of those sites also passed the raw `bytes` from synthesize_speech
straight to send_json as `"data": audio`, without base64. Bytes are not
JSON-serializable, so the send raised — and in two cases the exception was
swallowed by a bare `except Exception: pass`. Those paths ("Fix Yourself"
and the calendar/mail lookups) delivered neither audio nor text even with
a working Fish key, and did so silently.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The client's stated "text fallback when TTS fails" only ran console.log, so a reply that arrived without audio reached the devtools console and nowhere else. With no Fish Audio key the interface was not merely silent but blank — the orb reacted to nothing and said nothing. Add a caption below the orb, in the existing palette. It is shown whether or not audio arrived, so it doubles as subtitles for a working voice. It holds for 4s plus 60ms per character, capped at 20s. Reading time rather than a fixed delay, because without a voice the caption is the entire response and vanishing mid-sentence loses it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
recognition.lang was hardcoded to en-US, so anyone speaking another
language was transcribed phonetically into English nonsense — "come stai"
arrived as "comic Style". Add a Spoken Language selector to the settings
panel, persisted as SPEECH_LANG and read live, so the choice applies
without a restart.
voice.ts rebuilds the recognition object on a language change rather than
reassigning .lang. Chrome reads that property at construction and ignores
it on a session that has already run, so the reassignment silently kept
the old language. The retired session's onend checks whether it has been
superseded, or it would restart and race the new one for the microphone.
main.ts resolves the language before opening the microphone, so the first
session is built correctly and the fragile switch path is reserved for
live changes from the panel.
The system prompt is English and would answer an Italian question in
English, so a non-English selection appends a language directive. Kept to
a bare directive deliberately: wordings that also discussed action
selection measurably weakened the language adherence they were added to
enforce.
Known limitation: action routing is less reliable outside English. On one
repeated question, English chose the right action 4/4 while Italian
misrouted to a screen capture 4/4. The 46 hardcoded English strings in
server.py ("Right away, sir.") also stay English — translating them is an
i18n project, not a setting.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Chrome closes a recognition segment at every pause, and the client sent each "final" result the instant it arrived. A sentence spoken with any hesitation reached JARVIS as several questions: he answered half a thought, then received the rest as a new one. The logs show single words like "hey" arriving alone. Collect fragments and send once the speaker has actually stopped, after a 1s gap. Two edges that would otherwise bite: - A 6s ceiling. Steady dictation never produces the gap, so without a cap the timer re-arms forever and the reply never comes. - Muting discards what is pending, so half a sentence cannot arrive a second after the user silenced him. Barge-in stays immediate: the audio is cut on the first fragment, not at flush, since interrupting is what the user wanted the moment they spoke. Costs 1s before JARVIS starts thinking. That is the price of knowing the sentence ended; UTTERANCE_GAP_MS trades it back for more split sentences. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Five changes from setting JARVIS up on a fresh Mac and trying to talk to him. Independent of #21 — this branch is cut from
main.Each commit stands alone and explains its own reasoning; the summary below is what they add up to.
The replies were not arriving
Nine call sites sent JARVIS's reply only inside
if audio:. With no Fish Audio key — or a rate-limited one — the reply was dropped with no trace in the UI. The startup greeting and every proactive notification went straight to nothing.Three of those sites also passed the raw
bytesfromsynthesize_speechtosend_jsonas"data": audio, without base64. Bytes are not JSON-serializable, so the send raised, and in two cases a bareexcept Exception: passswallowed it. Those paths ("Fix Yourself", the calendar/mail lookups) delivered neither audio nor text even with a working Fish key, silently.The client's stated "text fallback when TTS fails" then only ran
console.log, so anything that did arrive reached the devtools console and nowhere else. There is now a caption below the orb, shown whether or not audio arrived, so it doubles as subtitles.It could not understand anyone who is not American
recognition.langwas hardcoded toen-US. Spoken Italian came back as phonetic English nonsense —come staiarrived ascomic Style. There is now a Spoken Language selector in the settings panel, persisted asSPEECH_LANGand read live.Two things this required beyond a select element:
langat construction. Reassigning it on a session that has already run is silently ignored, sovoice.tsrebuilds the recognition object. The retired session'sonendchecks whether it has been superseded, or it restarts and races the new one for the microphone.Hesitation was read as a finished sentence
Chrome closes a recognition segment at every pause, and each "final" result was sent immediately. A sentence spoken with any hesitation reached JARVIS as several questions — he answered half a thought, then got the rest as a new one. The logs show single words like
heyarriving alone.Fragments are now collected and sent after a 1s gap, with a 6s ceiling (steady dictation never produces a gap, so an uncapped timer re-arms forever). Muting discards what is pending. Barge-in stays immediate — audio is cut on the first fragment, not at flush.
Dependencies
npm audit fix, no--force: vite 6.4.1 → 6.4.3 plus transitive bumps, all within the rangespackage.jsonalready declares. The one that mattered is the Vite dev server's arbitrary file read via WebSocket (GHSA-p9ff-h696-f583) — the documented workflow runs that dev server.Known limitations, measured not guessed
server.py("Right away, sir.") stay English in every language. Translating them is an i18n project, not a setting.screen.pythat never sees the language directive.UTTERANCE_GAP_MStrades it back.Testing
pytest tests/gives 35 passed, 8 failed — identical to this branch's base, so no regressions. The 8 pre-existing failures are unrelated: 7 needplaywright install, andtest_browse_action_keywordsimportsACTION_KEYWORDS, a symbol that no longer exists inserver.py.tsc --noEmitis clean.Verified by hand against a live server: language round-trips through the panel and applies without a restart, and replies arrive as captions with no Fish key configured.
🤖 Generated with Claude Code