From 736ac05d98dcdb47715924e813d3ba382b73e691 Mon Sep 17 00:00:00 2001 From: liuwei Date: Wed, 29 Apr 2026 11:00:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0MaiBot=E5=8F=91=E5=8C=85messa?= =?UTF-8?q?ge=5Finfo=E5=BF=AB=E7=85=A7=E6=97=A5=E5=BF=97=E7=94=A8=E4=BA=8E?= =?UTF-8?q?=E7=A7=81=E8=81=8A=E8=AF=AF=E5=88=A4=E6=8E=92=E9=9A=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 变更项:\n1. 在 _send_outbound_payload 发送前新增 message_info 快照日志,完整输出实际入包的 message_info JSON。\n2. 日志仅输出 message_info,避免正文 segment 造成噪音与隐私扩散。\n3. 增加序列化异常保护,避免日志构建失败影响正常发包。\n4. 为定位‘群消息仍被识别为私聊’提供第一手协议证据。 --- plugins/maibot_adapter/main.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugins/maibot_adapter/main.py b/plugins/maibot_adapter/main.py index 951c760..8ff2e18 100644 --- a/plugins/maibot_adapter/main.py +++ b/plugins/maibot_adapter/main.py @@ -361,6 +361,19 @@ class MaiBotAdapterPlugin(MessagePluginInterface): "payload": payload["api_message"], } + # 发送前打印 message_info 快照: + # 1. 当前“MaiBot 侧仍显示私聊”的排障核心是确认 group_info 是否真实入包; + # 2. 仅打印 message_info,不输出 message_segment 正文,避免无意义扩大日志; + # 3. 保留 ensure_ascii=False 便于直接查看中文群名/昵称。 + try: + message_info_snapshot = json.dumps( + (payload.get("api_message") or {}).get("message_info") or {}, + ensure_ascii=False, + ) + self._log_runtime(f"[{self.name}] 发送前 message_info={message_info_snapshot}") + except Exception as exc: + self.LOG.warning(f"[{self.name}] message_info 序列化失败,跳过快照日志: {exc}") + await websocket.send_json(package) self._log_runtime( f"[{self.name}] 已发送到 MaiBot: roomid={payload['roomid']}, sender={payload['sender']}, "