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
|
# Prepare runner arguments with the callback to run your bot
|
||||||
async def webrtc_connection_callback(connection):
|
async def webrtc_connection_callback(connection):
|
||||||
bot_module = _get_bot_module()
|
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)
|
background_tasks.add_task(bot_module.bot, runner_args)
|
||||||
|
|
||||||
# Delegate handling to SmallWebRTCRequestHandler
|
# Delegate handling to SmallWebRTCRequestHandler
|
||||||
|
|||||||
@@ -24,10 +24,13 @@ class RunnerArguments:
|
|||||||
handle_sigterm: bool = field(init=False)
|
handle_sigterm: bool = field(init=False)
|
||||||
pipeline_idle_timeout_secs: int = field(init=False)
|
pipeline_idle_timeout_secs: int = field(init=False)
|
||||||
|
|
||||||
|
body: Optional[Any] = field(default_factory=dict)
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
self.handle_sigint = False
|
self.handle_sigint = False
|
||||||
self.handle_sigterm = False
|
self.handle_sigterm = False
|
||||||
self.pipeline_idle_timeout_secs = 300
|
self.pipeline_idle_timeout_secs = 300
|
||||||
|
self.body = self.body or {}
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -42,7 +45,6 @@ class DailyRunnerArguments(RunnerArguments):
|
|||||||
|
|
||||||
room_url: str
|
room_url: str
|
||||||
token: Optional[str] = None
|
token: Optional[str] = None
|
||||||
body: Optional[Any] = field(default_factory=dict)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -55,7 +57,6 @@ class WebSocketRunnerArguments(RunnerArguments):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
websocket: WebSocket
|
websocket: WebSocket
|
||||||
body: Optional[Any] = field(default_factory=dict)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
Reference in New Issue
Block a user