diff --git a/src/pipecat/processors/aggregators/llm_response.py b/src/pipecat/processors/aggregators/llm_response.py index 850c0ca27..1f50119fd 100644 --- a/src/pipecat/processors/aggregators/llm_response.py +++ b/src/pipecat/processors/aggregators/llm_response.py @@ -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): diff --git a/tests/test_llm_response.py b/tests/test_llm_response.py index 1d71217a2..e0026f5b5 100644 --- a/tests/test_llm_response.py +++ b/tests/test_llm_response.py @@ -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), ]