Skip to content

Commit ba0ddb1

Browse files
committed
FrameProcessor: copy kwargs when broadcasting frame
1 parent eacd2a4 commit ba0ddb1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/pipecat/processors/frame_processor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -781,14 +781,14 @@ async def broadcast_frame(self, frame_cls: Type[Frame], **kwargs):
781781
frame_cls: The class of the frame to be broadcasted.
782782
**kwargs: Keyword arguments to be passed to the frame's constructor.
783783
"""
784-
await self.push_frame(frame_cls(**kwargs))
785-
await self.push_frame(frame_cls(**kwargs), FrameDirection.UPSTREAM)
784+
await self.push_frame(frame_cls(**deepcopy(kwargs)))
785+
await self.push_frame(frame_cls(**deepcopy(kwargs)), FrameDirection.UPSTREAM)
786786

787787
async def broadcast_frame_instance(self, frame: Frame):
788788
"""Broadcasts a frame instance upstream and downstream.
789789
790-
This method extracts the class and init fields from the given frame
791-
instance and creates two new instances to push upstream and downstream.
790+
This method creates two new frame instances copying all fields from the
791+
original frame except `id` and `name`, which get fresh values.
792792
793793
Args:
794794
frame: The frame instance to broadcast.

0 commit comments

Comments
 (0)