From 3621fceae2555ca24fac993086b19241740f780a Mon Sep 17 00:00:00 2001 From: Kwindla Hultman Kramer Date: Wed, 25 Sep 2024 09:19:28 -0700 Subject: [PATCH 1/2] 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 @@ def __init__( 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 @@ async def cancel(self, frame: CancelFrame): 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) From 3d43ad0f4dcb9570202516dd0095a26226853aca Mon Sep 17 00:00:00 2001 From: Kwindla Hultman Kramer Date: Wed, 25 Sep 2024 10:59:00 -0700 Subject: [PATCH 2/2] actually save the file --- src/pipecat/services/ai_services.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pipecat/services/ai_services.py b/src/pipecat/services/ai_services.py index b32eb708d..21ef8dfca 100644 --- a/src/pipecat/services/ai_services.py +++ b/src/pipecat/services/ai_services.py @@ -283,7 +283,7 @@ async def cancel(self, frame: CancelFrame): self._stop_frame_task = None async def process_frame(self, frame: Frame, direction: FrameDirection): - super().process_frame(frame, direction) + await super().process_frame(frame, direction) if isinstance(frame, TTSSpeakFrame): await self.flush_audio()