Merge pull request #3206 from pipecat-ai/vp-update-bot-latency-observer
use VADUserStarted/StoppedSpeakingFrame s in user_bot_latency_log_observer.py
This commit is contained in:
3
changelog/3206.changed.md
Normal file
3
changelog/3206.changed.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
- `UserBotLatencyLogObserver` now uses `VADUserStartedSpeakingFrame` and
|
||||||
|
`VADUserStoppedSpeakingFrame` to determine latency from user stopped speaking
|
||||||
|
to bot started speaking.
|
||||||
@@ -15,8 +15,8 @@ from pipecat.frames.frames import (
|
|||||||
BotStartedSpeakingFrame,
|
BotStartedSpeakingFrame,
|
||||||
CancelFrame,
|
CancelFrame,
|
||||||
EndFrame,
|
EndFrame,
|
||||||
UserStartedSpeakingFrame,
|
VADUserStartedSpeakingFrame,
|
||||||
UserStoppedSpeakingFrame,
|
VADUserStoppedSpeakingFrame,
|
||||||
)
|
)
|
||||||
from pipecat.observers.base_observer import BaseObserver, FramePushed
|
from pipecat.observers.base_observer import BaseObserver, FramePushed
|
||||||
from pipecat.processors.frame_processor import FrameDirection
|
from pipecat.processors.frame_processor import FrameDirection
|
||||||
@@ -56,9 +56,9 @@ class UserBotLatencyLogObserver(BaseObserver):
|
|||||||
|
|
||||||
self._processed_frames.add(data.frame.id)
|
self._processed_frames.add(data.frame.id)
|
||||||
|
|
||||||
if isinstance(data.frame, UserStartedSpeakingFrame):
|
if isinstance(data.frame, VADUserStartedSpeakingFrame):
|
||||||
self._user_stopped_time = 0
|
self._user_stopped_time = 0
|
||||||
elif isinstance(data.frame, UserStoppedSpeakingFrame):
|
elif isinstance(data.frame, VADUserStoppedSpeakingFrame):
|
||||||
self._user_stopped_time = time.time()
|
self._user_stopped_time = time.time()
|
||||||
elif isinstance(data.frame, (EndFrame, CancelFrame)):
|
elif isinstance(data.frame, (EndFrame, CancelFrame)):
|
||||||
self._log_summary()
|
self._log_summary()
|
||||||
|
|||||||
Reference in New Issue
Block a user