LLMUserContextAggregator: reset user speaking time after bot interruption

This commit is contained in:
Aleix Conchillo Flaqué
2025-02-12 23:54:59 -08:00
parent b602e78625
commit 9f6a1c093a
2 changed files with 3 additions and 0 deletions

View File

@@ -326,6 +326,8 @@ class LLMUserContextAggregator(LLMContextResponseAggregator):
diff_time = time.time() - self._last_user_speaking_time
if diff_time > self._bot_interruption_timeout:
await self.push_frame(BotInterruptionFrame(), FrameDirection.UPSTREAM)
# Reset time so we don't interrupt again right away.
self._last_user_speaking_time = time.time()
class LLMAssistantContextAggregator(LLMContextResponseAggregator):

View File

@@ -343,6 +343,7 @@ class BaseTestUserContextAggregator:
aggregator = self.AGGREGATOR_CLASS(context, aggregation_timeout=AGGREGATION_TIMEOUT)
frames_to_send = [
InterimTranscriptionFrame(text="Hello ", user_id="cat", timestamp=""),
SleepFrame(),
TranscriptionFrame(text="Hello Pipecat!", user_id="cat", timestamp=""),
SleepFrame(sleep=AGGREGATION_SLEEP),
]