Skip to content

feat(speech,web): add local 2-phase voice dictation, hands-free commands, and local STT/cleanup endpoints - #19

Open
drakestapleton wants to merge 1 commit into
MiaAI-Lab:mainfrom
drakestapleton:feat/local-voice-dictation
Open

drakestapleton wants to merge 1 commit into
MiaAI-Lab:mainfrom
drakestapleton:feat/local-voice-dictation

Conversation

@drakestapleton

Copy link
Copy Markdown

Local voice dictation previously required an external text-generation provider for Phase 2 transcript cleanup, had no way to drive AI models hands-free or plug in a generic local STT/cleanup server, and could time out on cold Apple Silicon Metal GPU discovery (10s).

What changed

  • Two-phase local dictation (zero external API calls):
    • Phase 1 live streaming works with built-in local transcribe-cpp models (e.g. Parakeet 0.6B on Metal/CPU) and now also emits periodic live interim previews for configurable local OpenAI-compatible / whisper.cpp HTTP STT endpoints (speechLocalEndpointUrl, speechLocalEndpointModel).
    • Phase 2 local cleanup (speechLocalTwoPhaseCleanup, on by default for local dictation) fixes capitalization, punctuation, contractions, word stutters, spoken self-corrections, and dictionary aliases deterministically with zero API calls, or routes to an optional local OpenAI-compatible /v1/chat/completions endpoint (speechLocalCleanupEndpointUrl, speechLocalCleanupModel) with automatic local fallback.
  • Hands-free AI model control:
    • Spoken commands in ChatComposer (voiceCommandsEnabled): switch models (switch to Opus, use model Gemini 3 Pro, or chained switch to Sonnet and fix the parser tests, send it), send (send it / over), interrupt (stop generating / cancel turn), and clear draft (clear draft).
    • Hands-free Auto-send on pause (voiceAutoSend + configurable voiceSilenceTimeoutMs) automatically stops recording and submits after a sustained pause in speech.
  • Apple Silicon reliability: Increased cold-start GPU discovery timeout in listNativeSpeechGpuDevices from 10s to 30s.

Verification

  • Loaded parakeet-unified-en-0.6b-Q8_0.gguf on Apple M2 Metal (MTL0, streaming: true).
  • Ran focused unit tests (7 files, 92 tests passing): voiceCommands.test.ts, localEndpoint.test.ts, localCleanup.test.ts, postProcessing.test.ts, SpeechService.test.ts, CloudSpeech.test.ts, packages/contracts/src/settings.test.ts.
  • Ran vp lint across all 15 changed files (0 warnings, 0 errors).

Built with Antigravity.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XXL labels Nov 24, 2026
@MiaAI-Lab

Copy link
Copy Markdown
Owner

Not merged yet: conflicts with current main (translations and others). Needs a rebase on current main.

@drakestapleton
drakestapleton force-pushed the feat/local-voice-dictation branch from 36f536f to 7f14d49 Compare November 25, 2026 15:56
@drakestapleton

Copy link
Copy Markdown
Author

Rebased cleanly onto current main (7f14d49e5d), resolved translation and source conflicts, fixed the React Compiler bailout in ChatComposer.tsx, and verified i18n:check, vp fmt --check, vp lint, typecheck, React Compiler coverage, and speech/voice unit tests.

1 similar comment
@drakestapleton

Copy link
Copy Markdown
Author

Rebased cleanly onto current main (7f14d49e5d), resolved translation and source conflicts, fixed the React Compiler bailout in ChatComposer.tsx, and verified i18n:check, vp fmt --check, vp lint, typecheck, React Compiler coverage, and speech/voice unit tests.

@MiaAI-Lab

Copy link
Copy Markdown
Owner

Thanks for the rebase. This isn't mergeable yet, mainly because new defaults change behaviour for users who never opted in. speechLocalTwoPhaseCleanup defaults to true (packages/contracts/src/settings.ts:616) and apps/web/src/speech/voiceInputSession.ts:149 enables cleanup without readCleanupGrant(); the server can't tell the request is meant to stay local, so apps/server/src/speech/postProcessing.ts:70-89 sends the transcript to the configured provider model whenever one is set. voiceCommandsEnabled also defaults to true (settings.ts:609) and apps/web/src/speech/voiceCommands.ts:32 treats any trailing "over" as send ("move the button over" submits), while a bare "stop" or "clear" interrupts the turn or wipes the draft. The deterministic cleaner mangles code and URLs (apps/server/src/speech/localCleanup.ts:118 turns package.json into package. Json), and postProcessing.ts:67 / :89 silently substitute that output when the provider fails, so cleanup errors no longer surface; interim previews also re-encode and re-upload the whole recording every 1.5 s (apps/server/src/speech/SpeechService.ts:835), and the endpoint fetches have no timeout or response size cap. Please make the new behaviour opt-in, add an explicit local-only flag to the contract, translate the new strings, and consider splitting the local STT endpoint into its own PR.

(Review notes prepared with Claude Code on behalf of the maintainer.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants