LLMUserContextAggregator: reset user speaking time after bot interruption
This commit is contained in:
@@ -326,6 +326,8 @@ class LLMUserContextAggregator(LLMContextResponseAggregator):
|
|||||||
diff_time = time.time() - self._last_user_speaking_time
|
diff_time = time.time() - self._last_user_speaking_time
|
||||||
if diff_time > self._bot_interruption_timeout:
|
if diff_time > self._bot_interruption_timeout:
|
||||||
await self.push_frame(BotInterruptionFrame(), FrameDirection.UPSTREAM)
|
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):
|
class LLMAssistantContextAggregator(LLMContextResponseAggregator):
|
||||||
|
|||||||
@@ -343,6 +343,7 @@ class BaseTestUserContextAggregator:
|
|||||||
aggregator = self.AGGREGATOR_CLASS(context, aggregation_timeout=AGGREGATION_TIMEOUT)
|
aggregator = self.AGGREGATOR_CLASS(context, aggregation_timeout=AGGREGATION_TIMEOUT)
|
||||||
frames_to_send = [
|
frames_to_send = [
|
||||||
InterimTranscriptionFrame(text="Hello ", user_id="cat", timestamp=""),
|
InterimTranscriptionFrame(text="Hello ", user_id="cat", timestamp=""),
|
||||||
|
SleepFrame(),
|
||||||
TranscriptionFrame(text="Hello Pipecat!", user_id="cat", timestamp=""),
|
TranscriptionFrame(text="Hello Pipecat!", user_id="cat", timestamp=""),
|
||||||
SleepFrame(sleep=AGGREGATION_SLEEP),
|
SleepFrame(sleep=AGGREGATION_SLEEP),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user