From 3ac728e6976856c3543b3c7471cf33c946c86ddc Mon Sep 17 00:00:00 2001 From: liuwei Date: Wed, 29 Apr 2026 10:40:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4MaiBot=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E5=88=A4=E5=AE=9A=E4=B8=BAroomid=E9=9D=9E=E7=A9=BA=E5=8D=B3?= =?UTF-8?q?=E7=BE=A4=E8=81=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 变更项:\n1. 修改 _resolve_chat_route 首段规则:只要 plugin message 的 roomid 非空,即直接判定为群聊。\n2. 去除对 roomid 必须以 @chatroom 结尾的强依赖,修复你当前场景下群消息被误判为私聊的问题。\n3. 保留原有后续兜底链路与诊断日志,便于后续继续观察上游字段质量。 --- plugins/maibot_adapter/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/maibot_adapter/main.py b/plugins/maibot_adapter/main.py index d496bf3..bbc65d3 100644 --- a/plugins/maibot_adapter/main.py +++ b/plugins/maibot_adapter/main.py @@ -596,9 +596,11 @@ class MaiBotAdapterPlugin(MessagePluginInterface): full_msg = message.get("full_wx_msg") # 先看插件消息里已经带好的 roomid,这是最直接、最便宜的一跳。 + # 按你现在的业务约定:只要 roomid 非空,就视为群聊。 + # 这样可以避免某些平台包体里 roomid 不是 @chatroom 结尾时被误判成私聊。 plugin_roomid = str(message.get("roomid", "") or "").strip() - if plugin_roomid.endswith("@chatroom"): - return {"is_group": True, "route_type": "group", "roomid": plugin_roomid, "route_source": "plugin_roomid"} + if plugin_roomid: + return {"is_group": True, "route_type": "group", "roomid": plugin_roomid, "route_source": "plugin_roomid_non_empty"} # 再看 WxMessage 里计算过的 roomid。 wx_roomid = ""