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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user