feat: Add interimResults prop for live (interim) transcripts#272
Open
untemps wants to merge 1 commit into
Open
feat: Add interimResults prop for live (interim) transcripts#272untemps wants to merge 1 commit into
untemps wants to merge 1 commit into
Conversation
Thread the Web Speech API's interimResults flag through useVocal and the <Vocal> component so consumers can render live captions as the user is still speaking. In non-continuous mode, an interim result no longer discards the session: _onResult finalizes (matches commands and stops) only on the final segment, gated on SpeechRecognitionResult.isFinal. Absent isFinal (interimResults off, or synthetic aggregated events) still counts as final, so existing behavior is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Thread the Web Speech API's
interimResultsflag throughuseVocaland the<Vocal>component so consumers can render live captions as the user is still speaking.<Vocal interimResults>prop (defaultfalse) and 5th argumentuseVocal(lang, grammars, maxAlternatives, continuous, interimResults), forwarded tocreateVocal(already supported by@untemps/vocal@2.2.0)._onResultnow finalizes (matches commands and stops the session) only on the final segment, gated onSpeechRecognitionResult.isFinal. An interim result no longer truncates the session.isFinal(interimResults off, or synthetic aggregated events) still counts as final, so existing behavior is unchanged.Why
Live/interim transcripts are the most compelling thing to show for speech recognition, and the demo revamp (stacked PR) uses this for its dictation card. Without it,
interimResultscouldn't reachcreateVocal.Tests
useVocal.test.ts(factory forwarding, teardown/recreate on change) andVocal.test.tsx(interim streams toonResultwithout ending; final ends + matches).<Vocal>props table and theuseVocalsignature).🤖 Generated with Claude Code