From cb45807b12ee002d1a7d6fe4c157f375cf264b70 Mon Sep 17 00:00:00 2001 From: mintya Date: Fri, 4 Sep 2026 13:05:36 +0800 Subject: [PATCH] fix(qqofficial): tolerate missing optional token in adapter config (#2496) Since b55f073e the token field is optional in qqofficial.yaml ("the current adapter implementation does not use it either, so it can be safely left blank"), but the adapter constructor still reads it with config['token']. Creating a bot via QR binding (which only returns appid/secret) or with the token field left blank raises KeyError and the API returns 500. Read it with config.get('token', '') instead. The value is never used by QQOfficialClient beyond being stored, so an empty string default is safe. --- src/langbot/pkg/platform/sources/qqofficial.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/langbot/pkg/platform/sources/qqofficial.py b/src/langbot/pkg/platform/sources/qqofficial.py index f65a9683e..f012b07f9 100644 --- a/src/langbot/pkg/platform/sources/qqofficial.py +++ b/src/langbot/pkg/platform/sources/qqofficial.py @@ -205,7 +205,7 @@ class QQOfficialAdapter(abstract_platform_adapter.AbstractMessagePlatformAdapter bot = QQOfficialClient( app_id=config['appid'], secret=config['secret'], - token=config['token'], + token=config.get('token', ''), logger=logger, unified_mode=enable_webhook, )