diff --git a/src/pipecat/runner/run.py b/src/pipecat/runner/run.py index a90c96ac5..ccd190707 100644 --- a/src/pipecat/runner/run.py +++ b/src/pipecat/runner/run.py @@ -260,7 +260,10 @@ def _setup_webrtc_routes( # Prepare runner arguments with the callback to run your bot async def webrtc_connection_callback(connection): bot_module = _get_bot_module() - runner_args = SmallWebRTCRunnerArguments(webrtc_connection=connection) + runner_args = SmallWebRTCRunnerArguments( + webrtc_connection=connection, + body=request.request_data + ) background_tasks.add_task(bot_module.bot, runner_args) # Delegate handling to SmallWebRTCRequestHandler diff --git a/src/pipecat/runner/types.py b/src/pipecat/runner/types.py index 89aecd84c..87357d582 100644 --- a/src/pipecat/runner/types.py +++ b/src/pipecat/runner/types.py @@ -24,10 +24,13 @@ class RunnerArguments: handle_sigterm: bool = field(init=False) pipeline_idle_timeout_secs: int = field(init=False) + body: Optional[Any] = field(default_factory=dict) + def __post_init__(self): self.handle_sigint = False self.handle_sigterm = False self.pipeline_idle_timeout_secs = 300 + self.body = self.body or {} @dataclass @@ -42,7 +45,6 @@ class DailyRunnerArguments(RunnerArguments): room_url: str token: Optional[str] = None - body: Optional[Any] = field(default_factory=dict) @dataclass @@ -55,7 +57,6 @@ class WebSocketRunnerArguments(RunnerArguments): """ websocket: WebSocket - body: Optional[Any] = field(default_factory=dict) @dataclass