fix(stt): switch DeepGram from streaming to batch mode to fix truncation#44
Open
ReneXiong wants to merge 1 commit into
Open
fix(stt): switch DeepGram from streaming to batch mode to fix truncation#44ReneXiong wants to merge 1 commit into
ReneXiong wants to merge 1 commit into
Conversation
DeepGram's streaming WebSocket mode sends truncated is_final at sentence boundaries, causing long utterances to be cut off. - Replace WebSocket streaming with REST API batch mode (POST /v1/listen) - Buffer audio during recording, send all at once on stop - No more truncation, no need for delay workarounds - Pass reqwest::Client to DeepGram provider for connection reuse
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.
Summary
Fix DeepGram speech-to-text truncation issue by switching from streaming WebSocket mode to batch REST API mode. Long utterances were being cut short because DeepGram's streaming mode sends truncated
is_finalat sentence boundaries.Change Type
Changes
DeepGram's streaming WebSocket mode has a known issue where
is_finaltranscripts can be truncated at sentence boundaries, causing long utterances to be cut short. The partial transcript before theis_finalis often more complete than the final itself.POST /v1/listenREST API on disconnectbuild_wav()helper to construct WAV header for raw PCM audiocreate_provider()now passesreqwest::Clientto DeepGram viawith_client()Test Plan
npm run buildpassesnpx vitest runpasses (pre-existing failures in api.test.ts/authStore.test.ts unrelated to this change)cargo clippy -- -D warningspassesScreenshots / Recordings
N/A (no UI changes)
Related Issues
Fixes DeepGram truncation issue where long utterances were cut short at sentence boundaries