From c4d4c9093050cd01da4228013f2cd0e89f38a2be Mon Sep 17 00:00:00 2001 From: fdc310 <2213070223@qq.com> Date: Sun, 22 Mar 2026 05:57:32 +0800 Subject: [PATCH] fix: add set_webhook_url call in botmgr for auto callback URL Pass webhook_full_url to adapters that implement set_webhook_url(), built from api.webhook_prefix config + bot_uuid. Co-Authored-By: Claude Opus 4.6 --- src/langbot/pkg/platform/botmgr.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/langbot/pkg/platform/botmgr.py b/src/langbot/pkg/platform/botmgr.py index 44874cfb..64d891bd 100644 --- a/src/langbot/pkg/platform/botmgr.py +++ b/src/langbot/pkg/platform/botmgr.py @@ -273,6 +273,12 @@ class PlatformManager: if hasattr(adapter_inst, 'set_bot_uuid'): adapter_inst.set_bot_uuid(bot_entity.uuid) + # 如果 adapter 支持 set_webhook_url 方法,构建并传递完整的 webhook URL + if hasattr(adapter_inst, 'set_webhook_url'): + webhook_prefix = self.ap.instance_config.data['api'].get('webhook_prefix', 'http://127.0.0.1:5300') + webhook_full_url = f'{webhook_prefix}/bots/{bot_entity.uuid}' + adapter_inst.set_webhook_url(webhook_full_url) + runtime_bot = RuntimeBot(ap=self.ap, bot_entity=bot_entity, adapter=adapter_inst, logger=logger) await runtime_bot.initialize()