From 3621fceae2555ca24fac993086b19241740f780a Mon Sep 17 00:00:00 2001 From: Kwindla Hultman Kramer Date: Wed, 25 Sep 2024 09:19:28 -0700 Subject: [PATCH] fixes as noted by aleix --- src/pipecat/services/ai_services.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pipecat/services/ai_services.py b/src/pipecat/services/ai_services.py index 197067adc..b32eb708d 100644 --- a/src/pipecat/services/ai_services.py +++ b/src/pipecat/services/ai_services.py @@ -259,6 +259,10 @@ class AsyncTTSService(TTSService): async def flush_audio(self): pass + async def say(self, text: str): + await super.say(text) + await self.flush_audio() + async def start(self, frame: StartFrame): await super().start(frame) if self._push_stop_frames: @@ -278,6 +282,11 @@ class AsyncTTSService(TTSService): await self._stop_frame_task self._stop_frame_task = None + async def process_frame(self, frame: Frame, direction: FrameDirection): + super().process_frame(frame, direction) + if isinstance(frame, TTSSpeakFrame): + await self.flush_audio() + async def push_frame(self, frame: Frame, direction: FrameDirection = FrameDirection.DOWNSTREAM): await super().push_frame(frame, direction)