Merge pull request #492 from pipecat-ai/khk/flush-more-audio

add calls to flush_audio for say() and rtvi action
This commit is contained in:
Kwindla Hultman Kramer
2024-09-25 12:35:50 -07:00
committed by GitHub

View File

@@ -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):
await 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)