transports: broadcast InputTransportMessageFrame frames
This commit is contained in:
@@ -1728,8 +1728,9 @@ class DailyInputTransport(BaseInputTransport):
|
|||||||
message: The message data to send.
|
message: The message data to send.
|
||||||
sender: ID of the message sender.
|
sender: ID of the message sender.
|
||||||
"""
|
"""
|
||||||
frame = DailyInputTransportMessageFrame(message=message, participant_id=sender)
|
await self.broadcast_frame_class(
|
||||||
await self.push_frame(frame)
|
DailyInputTransportMessageFrame, message=message, participant_id=sender
|
||||||
|
)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Audio in
|
# Audio in
|
||||||
|
|||||||
@@ -698,8 +698,7 @@ class SmallWebRTCInputTransport(BaseInputTransport):
|
|||||||
message: The application message to process.
|
message: The application message to process.
|
||||||
"""
|
"""
|
||||||
logger.debug(f"Received app message inside SmallWebRTCInputTransport {message}")
|
logger.debug(f"Received app message inside SmallWebRTCInputTransport {message}")
|
||||||
frame = InputTransportMessageFrame(message=message)
|
await self.broadcast_frame_class(InputTransportMessageFrame, message=message)
|
||||||
await self.push_frame(frame)
|
|
||||||
|
|
||||||
# Add this method similar to DailyInputTransport.request_participant_image
|
# Add this method similar to DailyInputTransport.request_participant_image
|
||||||
async def request_participant_image(self, frame: UserImageRequestFrame):
|
async def request_participant_image(self, frame: UserImageRequestFrame):
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ from pipecat.frames.frames import (
|
|||||||
EndFrame,
|
EndFrame,
|
||||||
Frame,
|
Frame,
|
||||||
InputAudioRawFrame,
|
InputAudioRawFrame,
|
||||||
|
InputTransportMessageFrame,
|
||||||
OutputAudioRawFrame,
|
OutputAudioRawFrame,
|
||||||
OutputTransportMessageFrame,
|
OutputTransportMessageFrame,
|
||||||
OutputTransportMessageUrgentFrame,
|
OutputTransportMessageUrgentFrame,
|
||||||
@@ -298,6 +299,8 @@ class WebsocketClientInputTransport(BaseInputTransport):
|
|||||||
return
|
return
|
||||||
if isinstance(frame, InputAudioRawFrame) and self._params.audio_in_enabled:
|
if isinstance(frame, InputAudioRawFrame) and self._params.audio_in_enabled:
|
||||||
await self.push_audio_frame(frame)
|
await self.push_audio_frame(frame)
|
||||||
|
elif isinstance(frame, InputTransportMessageFrame):
|
||||||
|
await self.broadcast_frame(frame)
|
||||||
else:
|
else:
|
||||||
await self.push_frame(frame)
|
await self.push_frame(frame)
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ from pipecat.frames.frames import (
|
|||||||
EndFrame,
|
EndFrame,
|
||||||
Frame,
|
Frame,
|
||||||
InputAudioRawFrame,
|
InputAudioRawFrame,
|
||||||
|
InputTransportMessageFrame,
|
||||||
InterruptionFrame,
|
InterruptionFrame,
|
||||||
OutputAudioRawFrame,
|
OutputAudioRawFrame,
|
||||||
OutputTransportMessageFrame,
|
OutputTransportMessageFrame,
|
||||||
@@ -311,6 +312,8 @@ class FastAPIWebsocketInputTransport(BaseInputTransport):
|
|||||||
|
|
||||||
if isinstance(frame, InputAudioRawFrame):
|
if isinstance(frame, InputAudioRawFrame):
|
||||||
await self.push_audio_frame(frame)
|
await self.push_audio_frame(frame)
|
||||||
|
elif isinstance(frame, InputTransportMessageFrame):
|
||||||
|
await self.broadcast_frame(frame)
|
||||||
else:
|
else:
|
||||||
await self.push_frame(frame)
|
await self.push_frame(frame)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ from pipecat.frames.frames import (
|
|||||||
EndFrame,
|
EndFrame,
|
||||||
Frame,
|
Frame,
|
||||||
InputAudioRawFrame,
|
InputAudioRawFrame,
|
||||||
|
InputTransportMessageFrame,
|
||||||
|
InputTransportMessageUrgentFrame,
|
||||||
InterruptionFrame,
|
InterruptionFrame,
|
||||||
OutputAudioRawFrame,
|
OutputAudioRawFrame,
|
||||||
OutputTransportMessageFrame,
|
OutputTransportMessageFrame,
|
||||||
@@ -214,6 +216,8 @@ class WebsocketServerInputTransport(BaseInputTransport):
|
|||||||
|
|
||||||
if isinstance(frame, InputAudioRawFrame):
|
if isinstance(frame, InputAudioRawFrame):
|
||||||
await self.push_audio_frame(frame)
|
await self.push_audio_frame(frame)
|
||||||
|
elif isinstance(frame, InputTransportMessageFrame):
|
||||||
|
await self.broadcast_frame(frame)
|
||||||
else:
|
else:
|
||||||
await self.push_frame(frame)
|
await self.push_frame(frame)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user