Deadmon commited on
Commit
13df605
·
verified ·
1 Parent(s): f86fc3c

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -5,7 +5,7 @@ import time
5
  import logging
6
  from pipecat.frames.frames import (
7
  TextFrame, UserStartedSpeakingFrame, UserStoppedSpeakingFrame,
8
- LLMResponseStartFrame, LLMResponseEndFrame, TTSStartedFrame, TTSEndFrame
9
  )
10
  from pipecat.pipeline.pipeline import Pipeline
11
  from pipecat.pipeline.runner import PipelineRunner
@@ -64,9 +64,9 @@ class SilenceAndCallLogicProcessor(FrameProcessor):
64
  async def process_frame(self, frame: Frame, direction: FrameDirection):
65
  if isinstance(frame, (UserStartedSpeakingFrame, TextFrame)) and direction == FrameDirection.UPSTREAM:
66
  self._reset_activity_timer()
67
- if isinstance(frame, (LLMResponseStartFrame, TTSStartedFrame)) and direction == FrameDirection.DOWNSTREAM:
68
  self._bot_is_speaking = True
69
- elif isinstance(frame, (LLMResponseEndFrame, TTSEndFrame)) and direction == FrameDirection.DOWNSTREAM:
70
  self._bot_is_speaking = False
71
  self.last_activity_ts = time.time()
72
  await self.push_frame(frame, direction)
 
5
  import logging
6
  from pipecat.frames.frames import (
7
  TextFrame, UserStartedSpeakingFrame, UserStoppedSpeakingFrame,
8
+ TTSStartedFrame, TTSEndFrame
9
  )
10
  from pipecat.pipeline.pipeline import Pipeline
11
  from pipecat.pipeline.runner import PipelineRunner
 
64
  async def process_frame(self, frame: Frame, direction: FrameDirection):
65
  if isinstance(frame, (UserStartedSpeakingFrame, TextFrame)) and direction == FrameDirection.UPSTREAM:
66
  self._reset_activity_timer()
67
+ if isinstance(frame, TTSStartedFrame) and direction == FrameDirection.DOWNSTREAM:
68
  self._bot_is_speaking = True
69
+ elif isinstance(frame, TTSEndFrame) and direction == FrameDirection.DOWNSTREAM:
70
  self._bot_is_speaking = False
71
  self.last_activity_ts = time.time()
72
  await self.push_frame(frame, direction)