draft patch: pass request data through to bot module

This commit is contained in:
Jon Taylor
2025-10-20 22:45:40 +01:00
parent a0c93ab6de
commit e0e2b6ac6b
2 changed files with 7 additions and 3 deletions

View File

@@ -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

View File

@@ -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