Skip to content

Desktop: speech recognition loads in a built app, so voice mode hears (#346) - #349

Merged
Khoality-dev merged 2 commits into
mainfrom
fix/346-vad-assets
Sep 28, 2026
Merged

Khoality-dev merged 2 commits into
mainfrom
fix/346-vad-assets

Conversation

@Khoality-dev

Copy link
Copy Markdown
Owner

Closes #346

Cause

MicVAD.new was given baseAssetPath / onnxWASMBasePath of './vad/'. onnxruntime imports its ort-wasm-simd-threaded.mjs relative to its own bundle, not the page, so in a built app (dist/index.html + dist/assets/index-*.js) it asked for dist/assets/vad/…, where nothing is: "no available backend found … Failed to fetch dynamically imported module". The Vite dev server hid it with a middleware that serves any ort-wasm* request by filename, whatever the path. So voice mode heard nothing in every build but electron:dev — the e2e build and, by the same path logic, the packaged app and the browser build.

Fix

micStore resolves the folder against the page — new URL('./vad/', document.baseURI).href — and hands the VAD that absolute URL for both paths, so every loader means the same folder. The voice bar carries data-mic="on" once the recogniser is listening, which the e2e waits for.

Tests

Written first (c09f8fb), red before the fix:

  • state/vadAssets.test.ts: the VAD gets absolute URLs under the page's vad/.
  • VoiceModeBar.test.tsx: data-mic says whether the mic is on.
  • Playwright voiceMode.spec.ts: in the built app, starting voice mode reaches data-mic="on" and "Say “Kurisu” to start", never "Speech recognition didn't load". Red locally with the attribute but without the path fix (Received: "off"), green with it; the renderer log no longer shows the failed import.

Locally: state 74, voiceMode.spec.ts 4/4 in Electron under Xvfb. The waiting state now renders in the real app and matches the mockup (1b).

🤖 Generated with Claude Code

https://claude.ai/code/session_014L9pxjp1MTSJe5DZG9A9sv

akn-sfu and others added 2 commits September 28, 2026 01:22
Red first: the mic store must hand the VAD absolute asset URLs under the
page's vad/ folder, and in the built app the e2e voice bar must reach
data-mic="on" and "Say “Kurisu” to start" rather than "Speech
recognition didn't load".

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014L9pxjp1MTSJe5DZG9A9sv
onnxruntime imports its .mjs relative to its own bundle, so the relative
'./vad/' pointed a built app at dist/assets/vad/, where nothing is, and
voice mode heard nothing outside the Vite dev server (which answers those
files at any path). The mic store now resolves the folder against the
page and passes an absolute URL.

The voice bar carries data-mic="on" once the recogniser is listening, so
the e2e can wait for it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014L9pxjp1MTSJe5DZG9A9sv
@Khoality-dev
Khoality-dev marked this pull request as ready for review September 28, 2026 08:32
@Khoality-dev
Khoality-dev merged commit a6820be into main Sep 28, 2026
3 checks passed
@Khoality-dev
Khoality-dev deleted the fix/346-vad-assets branch September 28, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop: speech recognition never loads in a built app, so voice mode hears nothing

2 participants