fix(services): handle TranscriptionFrame separately in TTSService

Exclude TranscriptionFrame from text frame processing in TTSService by updating the type check condition. This resolves unintended processing behavior when handling different frame types.
This commit is contained in:
Mert Sefa AKGUN
2025-01-11 13:00:38 +03:00
parent a8ae79831e
commit df6c2fc403

View File

@@ -30,6 +30,7 @@ from pipecat.frames.frames import (
TTSStartedFrame, TTSStartedFrame,
TTSStoppedFrame, TTSStoppedFrame,
TTSUpdateSettingsFrame, TTSUpdateSettingsFrame,
TranscriptionFrame,
UserImageRequestFrame, UserImageRequestFrame,
VisionImageRawFrame, VisionImageRawFrame,
) )
@@ -290,7 +291,7 @@ class TTSService(AIService):
async def process_frame(self, frame: Frame, direction: FrameDirection): async def process_frame(self, frame: Frame, direction: FrameDirection):
await super().process_frame(frame, direction) await super().process_frame(frame, direction)
if isinstance(frame, TextFrame): if isinstance(frame, TextFrame) and not isinstance(frame, TranscriptionFrame):
await self._process_text_frame(frame) await self._process_text_frame(frame)
elif isinstance(frame, StartInterruptionFrame): elif isinstance(frame, StartInterruptionFrame):
await self._handle_interruption(frame, direction) await self._handle_interruption(frame, direction)