Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/clear-user-turn-cleanup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@livekit/agents': patch
---

fix(voice): clean up turn variables and end user_turn span when committing a user turn manually
10 changes: 10 additions & 0 deletions agents/src/voice/audio_recognition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1404,8 +1404,18 @@ export class AudioRecognition {
this.audioInterimTranscript = '';
this.audioPreflightTranscript = '';
this.finalTranscriptConfidence = [];
this.lastFinalTranscriptTime = 0;
this.speechStartTime = undefined;
this.lastSpeakingTime = undefined;
this.userTurnCommitted = false;

// end any in-progress user_turn span so the next speech starts a fresh one
if (this.userTurnSpan && this.userTurnSpan.isRecording()) {
this.userTurnSpan.end();
}
this.userTurnSpan = undefined;
this.sttRequestIds = [];

const restartStt = async () => {
const unlock = await this.sttLifecycleLock.lock();
try {
Expand Down
Loading