example: pass RunnerArguments to run_bot()
This lets us get handle_sigint from RunnerArguments which knows where the application is running and if SIGINT/SIGTERM should be handled or not.
This commit is contained in:
@@ -108,7 +108,7 @@ transport_params = {
|
||||
}
|
||||
|
||||
|
||||
async def run_bot(transport: BaseTransport):
|
||||
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
||||
logger.info(f"Starting bot")
|
||||
|
||||
session_properties = SessionProperties(
|
||||
@@ -213,7 +213,7 @@ Remember, your responses should be short. Just one or two sentences, usually."""
|
||||
line = f"{timestamp}{msg.role}: {msg.content}"
|
||||
logger.info(f"Transcript: {line}")
|
||||
|
||||
runner = PipelineRunner(handle_sigint=False)
|
||||
runner = PipelineRunner(handle_sigint=runner_args.handle_sigint)
|
||||
|
||||
await runner.run(task)
|
||||
|
||||
@@ -221,7 +221,7 @@ Remember, your responses should be short. Just one or two sentences, usually."""
|
||||
async def bot(runner_args: RunnerArguments):
|
||||
"""Main bot entry point compatible with Pipecat Cloud."""
|
||||
transport = await create_transport(runner_args, transport_params)
|
||||
await run_bot(transport)
|
||||
await run_bot(transport, runner_args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user