Merge pull request #250 from pipecat-ai/lewis/flush-tts-on-llm-response-end

Flush output from TTSService on LLMFullResponseEndFrame
This commit is contained in:
Kwindla Hultman Kramer
2024-06-22 20:37:45 -04:00
committed by GitHub

View File

@@ -21,6 +21,7 @@ from pipecat.frames.frames import (
TTSStoppedFrame,
TextFrame,
VisionImageRawFrame,
LLMFullResponseEndFrame,
)
from pipecat.processors.frame_processor import FrameDirection, FrameProcessor
from pipecat.utils.audio import calculate_audio_volume
@@ -136,6 +137,11 @@ class TTSService(AIService):
if self._current_sentence:
await self._push_tts_frames(self._current_sentence)
await self.push_frame(frame)
elif isinstance(frame, LLMFullResponseEndFrame):
if self._current_sentence:
await self._push_tts_frames(self._current_sentence.strip())
self._current_sentence = ""
await self.push_frame(frame)
else:
await self.push_frame(frame, direction)