From d2401a76c88a74b6741d7f09c130412e73328f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Thu, 31 Oct 2024 15:40:35 -0700 Subject: [PATCH] base_output: only generate bot speaking with TTS audio frames --- src/pipecat/transports/base_output.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pipecat/transports/base_output.py b/src/pipecat/transports/base_output.py index f3dd225c1..3398c48d7 100644 --- a/src/pipecat/transports/base_output.py +++ b/src/pipecat/transports/base_output.py @@ -28,6 +28,7 @@ from pipecat.frames.frames import ( StartInterruptionFrame, StopInterruptionFrame, SystemFrame, + TTSAudioRawFrame, TransportMessageFrame, TransportMessageUrgentFrame, ) @@ -397,13 +398,15 @@ class BaseOutputTransport(FrameProcessor): frame = await asyncio.wait_for(self._audio_out_queue.get(), timeout=wait_time) # Notify the bot started speaking upstream if necessary. - await self._bot_started_speaking() + if isinstance(frame, TTSAudioRawFrame): + await self._bot_started_speaking() # Send audio. await self.write_raw_audio_frames(frame.audio) # Notify the bot is speaking upstream. - await self.push_frame(BotSpeakingFrame(), FrameDirection.UPSTREAM) + if isinstance(frame, TTSAudioRawFrame): + await self.push_frame(BotSpeakingFrame(), FrameDirection.UPSTREAM) # Push frame downstream in case anyone else needs it. await self.push_frame(frame)