fix duplicate assistant text events

This commit is contained in:
Xin Wang
2026-06-01 08:41:00 +08:00
parent 402ad81cb6
commit 8a39461b21

View File

@@ -18,7 +18,6 @@ from pipecat.frames.frames import (
OutputAudioRawFrame,
OutputTransportMessageFrame,
OutputTransportMessageUrgentFrame,
TextFrame,
TranscriptionFrame,
UserImageRawFrame,
)
@@ -64,9 +63,9 @@ class ProductWebsocketSerializer(FrameSerializer):
timestamp=frame.timestamp,
)
if isinstance(frame, TextFrame):
return self._event("response.text.delta", text=frame.text)
# ProductTextStreamProcessor owns response.text.* events. TTS also
# emits TextFrame subclasses internally, and serializing those here
# would make the UI render duplicate assistant bubbles.
if isinstance(frame, (OutputTransportMessageFrame, OutputTransportMessageUrgentFrame)):
if self.should_ignore_frame(frame):
return None