UserIdleProcessor: Account for function calls in progress
This commit is contained in:
@@ -15,6 +15,8 @@ from pipecat.frames.frames import (
|
||||
CancelFrame,
|
||||
EndFrame,
|
||||
Frame,
|
||||
FunctionCallInProgressFrame,
|
||||
FunctionCallResultFrame,
|
||||
StartFrame,
|
||||
UserStartedSpeakingFrame,
|
||||
UserStoppedSpeakingFrame,
|
||||
@@ -168,6 +170,13 @@ class UserIdleProcessor(FrameProcessor):
|
||||
self._idle_event.set()
|
||||
elif isinstance(frame, BotSpeakingFrame):
|
||||
self._idle_event.set()
|
||||
elif isinstance(frame, FunctionCallInProgressFrame):
|
||||
# Function calls can take longer than the timeout, so we want to prevent idle callbacks
|
||||
self._interrupted = True
|
||||
self._idle_event.set()
|
||||
elif isinstance(frame, FunctionCallResultFrame):
|
||||
self._interrupted = False
|
||||
self._idle_event.set()
|
||||
|
||||
async def cleanup(self) -> None:
|
||||
"""Cleans up resources when processor is shutting down."""
|
||||
|
||||
Reference in New Issue
Block a user