mirror of
https://github.com/ylytdeng/wechat-decrypt.git
synced 2026-11-06 06:26:47 +08:00
Issue #88: 群聊里的引用回复(appmsg type=57)/ 卡片 / 视频在 export_chat 和 export_all_chats 渲染成 type=link_or_file 且 content 为空。 根因:`_extract_content` 把数据库里带 `wxid_xxx:\n` 群前缀的原始 content 直接喂给 `_format_app_message_text`,XML 解析器在前缀文本上 ParseError, 返回 None。 修复: - 用 `chat_username.endswith('@chatroom')` 判定群聊 - 在 dispatch 前调 `mcp_server._parse_message_content(..., is_group=True)` 剥前缀;逻辑也对群里的 base=1 text 生效(之前同样带前缀) - 把 `is_group=True` 透传给 `_format_app_message_text`,让引用回复走 group 分支的发送者标签解析 - 用 `mcp_server.get_contact_names()` 代替之前硬编码的 `{}`,让 wxid 能 正确解出昵称 测试:新增 5 个测试覆盖群引用回复带前缀 / 1-on-1 不受影响 / 群 text 前缀剥离 / 1-on-1 text 不变 / names dict 正确解析。126/126 通过。 Belugary 在 #100 修了 `_format_app_message_text` 内部的 type=57 schema 渲染(对 get_chat_history 生效),本 PR 是补 export 这条路径上的群前缀 bug。两者互补。 Co-authored-by: ylytdeng <ylytdeng@users.noreply.github.com>