From 5bf1b9f29fa8618981e8eabecd6dd6c53115d55f Mon Sep 17 00:00:00 2001 From: Kwindla Hultman Kramer Date: Sun, 22 Sep 2024 19:05:06 -0700 Subject: [PATCH] add calls to flush_audio for say() and rtvi action --- src/pipecat/services/ai_services.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pipecat/services/ai_services.py b/src/pipecat/services/ai_services.py index dc75b9793..1b44bf741 100644 --- a/src/pipecat/services/ai_services.py +++ b/src/pipecat/services/ai_services.py @@ -186,6 +186,7 @@ async def run_tts(self, text: str) -> AsyncGenerator[Frame, None]: async def say(self, text: str): await self.process_frame(TextFrame(text=text), FrameDirection.DOWNSTREAM) + await self.flush_audio() async def _handle_interruption(self, frame: StartInterruptionFrame, direction: FrameDirection): self._current_sentence = "" @@ -235,6 +236,7 @@ async def process_frame(self, frame: Frame, direction: FrameDirection): await self.push_frame(frame, direction) elif isinstance(frame, TTSSpeakFrame): await self._push_tts_frames(frame.text) + await self.flush_audio() elif isinstance(frame, TTSModelUpdateFrame): await self.set_model(frame.model) elif isinstance(frame, TTSVoiceUpdateFrame):