draft patch: pass request data through to bot module
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user