[eric] voice: whisper's non-speech captions no longer inject as dictation (ENG-167)

This commit is contained in:
ciregenz
2026-08-05 18:07:23 -07:00
parent 9046dfbaa6
commit d9813de3cd
3 changed files with 30 additions and 4 deletions
@@ -200,6 +200,8 @@ export function useVoiceDictation() {
res = await window.openswarm?.voiceTranscribe?.(wav);
}
}
// Whisper captions non-speech in brackets/parens ("[ Background sounds ]", "(laughs)") and marks speaker turns with ">>"; those are annotations, not dictation.
if (res?.ok && res.text) res = { ok: true, text: res.text.replace(/\[[^\]]*\]|\([^)]*\)|\*[^*]*\*|(?:^|\s)>>\s?/g, ' ').replace(/\s+/g, ' ').trim() };
// A transcript with no letter or digit in it is a hallucination artifact (the lone comma), not dictation.
if (res?.ok && res.text && !/[\p{L}\p{N}]/u.test(res.text)) res = { ok: true, text: '' };
if (res?.ok && res.text) {