Add ASR capture timeout handling in DuplexPipeline and enhance EOU detection logic. Introduce _ASR_CAPTURE_MAX_MS constant and manage capture state timing to ensure timely end of utterance processing, even during silence. Update EouDetector to allow silence-only EOU when VAD state is lost.

This commit is contained in:
Xin Wang
2026-02-27 09:59:54 +08:00
parent 0b308f9bce
commit 403b4b93c7
2 changed files with 28 additions and 0 deletions

View File

@@ -53,6 +53,18 @@ class EouDetector:
if vad_status == "Silence":
if not self.is_speaking:
# Fallback path: ASR has already started but VAD speaking state
# was lost (e.g. VAD flicker). Allow silence-only EOU so the
# turn can still close instead of stalling forever.
if not force_eligible:
return False
if self.silence_start_time is None:
self.silence_start_time = now
silence_duration = now - self.silence_start_time
if silence_duration >= self.threshold and not self.triggered:
self.triggered = True
self.silence_start_time = None
return True
return False
if self.silence_start_time is None:
self.silence_start_time = now