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