Skip to content

Commit 33c2419

Browse files
authored
fix(pipeline): don't mark segment end if cancelled (#326)
1 parent 7398cff commit 33c2419

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/lazy-wolves-give.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@livekit/agents": patch
3+
---
4+
5+
fix(pipeline): don't mark segment end if cancelled

agents/src/pipeline/agent_output.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ const streamSynthesisTask = (
202202
handle.synchronizer.pushText(text);
203203
ttsStream.pushText(text);
204204
}
205-
handle.synchronizer.markTextSegmentEnd();
205+
if (!cancelled) {
206+
handle.synchronizer.markTextSegmentEnd();
207+
}
206208

207209
// end the audio queue early if there is no actual text to turn into speech
208210
if (!fullText || fullText.trim().length === 0) {

0 commit comments

Comments
 (0)