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:
@@ -55,7 +55,7 @@ logger.info("✅ All components loaded successfully!")
|
||||
load_dotenv(override=True)
|
||||
|
||||
|
||||
async def run_bot(transport: BaseTransport):
|
||||
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
||||
logger.info(f"Starting bot")
|
||||
|
||||
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"))
|
||||
@@ -113,7 +113,7 @@ async def run_bot(transport: BaseTransport):
|
||||
logger.info(f"Client disconnected")
|
||||
await task.cancel()
|
||||
|
||||
runner = PipelineRunner(handle_sigint=False)
|
||||
runner = PipelineRunner(handle_sigint=runner_args.handle_sigint)
|
||||
|
||||
await runner.run(task)
|
||||
|
||||
@@ -130,7 +130,7 @@ async def bot(runner_args: RunnerArguments):
|
||||
webrtc_connection=runner_args.webrtc_connection,
|
||||
)
|
||||
|
||||
await run_bot(transport)
|
||||
await run_bot(transport, runner_args)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user