From 67e47a388d990278f417a6dbc10eb1a7a1e386a2 Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Thu, 16 Jan 2025 10:03:24 -0500 Subject: [PATCH 1/2] TTSService should only process LLMTextFrames --- src/pipecat/services/ai_services.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pipecat/services/ai_services.py b/src/pipecat/services/ai_services.py index 0a03b2eaa..c990707f7 100644 --- a/src/pipecat/services/ai_services.py +++ b/src/pipecat/services/ai_services.py @@ -20,12 +20,12 @@ from pipecat.frames.frames import ( ErrorFrame, Frame, LLMFullResponseEndFrame, + LLMTextFrame, StartFrame, StartInterruptionFrame, STTMuteFrame, STTUpdateSettingsFrame, TextFrame, - TranscriptionFrame, TTSAudioRawFrame, TTSSpeakFrame, TTSStartedFrame, @@ -291,8 +291,7 @@ class TTSService(AIService): async def process_frame(self, frame: Frame, direction: FrameDirection): await super().process_frame(frame, direction) - - if isinstance(frame, TextFrame) and not isinstance(frame, TranscriptionFrame): + if isinstance(frame, LLMTextFrame): await self._process_text_frame(frame) elif isinstance(frame, StartInterruptionFrame): await self._handle_interruption(frame, direction) From 119bc7e35f4675b1b418246af3c8c9411f41d186 Mon Sep 17 00:00:00 2001 From: Mark Backman Date: Thu, 16 Jan 2025 16:43:46 -0500 Subject: [PATCH 2/2] Update check to exclude transcription frames --- src/pipecat/services/ai_services.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pipecat/services/ai_services.py b/src/pipecat/services/ai_services.py index c990707f7..e49452d38 100644 --- a/src/pipecat/services/ai_services.py +++ b/src/pipecat/services/ai_services.py @@ -19,13 +19,14 @@ from pipecat.frames.frames import ( EndFrame, ErrorFrame, Frame, + InterimTranscriptionFrame, LLMFullResponseEndFrame, - LLMTextFrame, StartFrame, StartInterruptionFrame, STTMuteFrame, STTUpdateSettingsFrame, TextFrame, + TranscriptionFrame, TTSAudioRawFrame, TTSSpeakFrame, TTSStartedFrame, @@ -291,7 +292,11 @@ class TTSService(AIService): async def process_frame(self, frame: Frame, direction: FrameDirection): await super().process_frame(frame, direction) - if isinstance(frame, LLMTextFrame): + if ( + isinstance(frame, TextFrame) + and not isinstance(frame, InterimTranscriptionFrame) + and not isinstance(frame, TranscriptionFrame) + ): await self._process_text_frame(frame) elif isinstance(frame, StartInterruptionFrame): await self._handle_interruption(frame, direction)