Fix race asr problem

This commit is contained in:
Xin Wang
2026-02-09 18:01:40 +08:00
parent 088943166c
commit b57d9f3a65
2 changed files with 6 additions and 3 deletions

View File

@@ -420,7 +420,7 @@ class DuplexPipeline:
async def _on_speech_start(self) -> None:
"""Handle user starting to speak."""
if self.conversation.state == ConversationState.IDLE:
if self.conversation.state in (ConversationState.IDLE, ConversationState.INTERRUPTED):
await self.conversation.start_user_turn()
self._audio_buffer = b""
self._last_sent_transcript = ""
@@ -436,7 +436,7 @@ class DuplexPipeline:
async def _on_end_of_utterance(self) -> None:
"""Handle end of user utterance."""
if self.conversation.state != ConversationState.LISTENING:
if self.conversation.state not in (ConversationState.LISTENING, ConversationState.INTERRUPTED):
return
# Stop interim transcriptions