From 96d40903a948b19426dc495809bd1151616e254e Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Fri, 2 May 2025 10:18:53 -0400 Subject: [PATCH] Only send TTSStoppedFrame from Gemini when in AUDIO mode, only send one LLMFullResponseEndFrame --- src/pipecat/services/gemini_multimodal_live/gemini.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pipecat/services/gemini_multimodal_live/gemini.py b/src/pipecat/services/gemini_multimodal_live/gemini.py index b337c50e2..499bbfb42 100644 --- a/src/pipecat/services/gemini_multimodal_live/gemini.py +++ b/src/pipecat/services/gemini_multimodal_live/gemini.py @@ -905,11 +905,12 @@ class GeminiMultimodalLiveLLMService(LLMService): text = self._bot_text_buffer self._bot_text_buffer = "" - # Pertains to modalities set to TEXT only - if text: - await self.push_frame(LLMFullResponseEndFrame()) + # Only push the TTSStoppedFrame the bot is outputting audio + # when text is found, modalities is set to TEXT and no audio + # is produced. + if not text: + await self.push_frame(TTSStoppedFrame()) - await self.push_frame(TTSStoppedFrame()) await self.push_frame(LLMFullResponseEndFrame()) async def _handle_evt_output_transcription(self, evt):