fix duplicate assistant text events
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user