Repository navigation
feat(web): optional left context for instant-mode live transcription chunks - #3526
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Member
Author
|
@greptileai review |
Member
Author
|
@greptileai review |
Member
Author
|
@greptileai review |
Member
Author
|
@greptileai review |
richiemcilroy
marked this pull request as ready for review
October 28, 2026 23:38
Member
Author
|
@greptileai review |
Member
Author
|
@greptileai review |
This branch was successfully deployed
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.
Instant-mode live transcription sends each 5 to 10 s chunk on its own, so the first words of every chunk start mid-sentence and the last word is often cut in half. Those chunks are promoted to the final transcript, so the damage at every cut ends up in the video's transcript.
This adds opt-in left context: each chunk is sent with the already-transcribed segments just before it, and the next chunk re-transcribes the last 2 s before its cut, where it hears the cut words whole.
sequenceDiagram participant W as liveTranscribeWorkflow participant P as transcription API Note over W: chunk N = segments 11..14, context = segments 4..10 (up to N s) W->>P: init + context + chunk audio P-->>W: words for all of it (ms from audio start) Note over W: offsetChunkWords places all words on the<br/>recording timeline (context words before the cut) Note over W: applyChunkToLiveTranscript joins at a word both<br/>chunks heard near (cut - 2 s), else cuts thereplanNextLiveChunk(apps/web/lib/live-transcribe-core.ts:74) returnscontext/contextMs: the trailing already-processed segments untilcontextSecondsis reached. The first chunk has none.offsetChunkWordstakescontextMsand places every word on the recording timeline; context words land before the chunk start instead of being clamped to it.applyChunkToLiveTranscriptjoins the previous words to the new chunk about 2 s before the cut (joinAtHandover), so the new chunk replaces the previous chunk's cut-off tail:alignedRun), then the closest start;chunkHandoverMsnever hands over more than the context actually sent, so a short context can't leave a hole.orderLiveTranscriptWordskeeps word starts non-decreasing and gives every word at least 1 ms inside the recording, whichparseEditTranscriptrequires. A join can reorder starts by up to 300 ms. A word clamped to a chunk's end is zero-length, and that already happens without context.promoteLiveTranscriptparses the canonical transcript before claiming the video and falls back to the full post-stop pass if it would not read back.LIVE_TRANSCRIBE_CONTEXT_SECONDS(apps/web/workflows/live-transcribe.ts:548, clamped to 0 to 60). Unset or 0 sends exactly the audio it sends today. A retried chunk is sent without context in case the earlier audio is what failed.Context multiplies the audio sent per chunk (about 2.7x with 20 s), which is why it is off by default.
Measured
A 5 minute public-domain LibriVox reading, cut into 3 s fMP4 AAC segments, replayed through
planNextLiveChunk/offsetChunkWords/applyChunkToLiveTranscriptone segment at a time as a recording in progress, transcribed by AssemblyAI. Compared with AssemblyAI's own full-file transcript of the same audio:Audio duration is too shortA failed final chunk is retried, then skipped as a gap, which blocks promotion and falls back to the full post-stop pass. With context the tail chunk carries enough audio to be accepted.


Confidence Score: 5/5
The PR appears safe to merge; no new blocking issues were found.Summary
Adds optional earlier audio to live transcription chunks and joins overlapping words to improve chunk boundaries.
Reviews (7) · Last reviewed commit: "fix(web): keep promoted live transcripts..." · Reviewed by Greptile