From 8572b7478fc762ab8c01d4929ad7b5672165c275 Mon Sep 17 00:00:00 2001 From: dongzeyu001 Date: Wed, 15 Apr 2026 11:42:05 +0800 Subject: [PATCH] Fix wecom mix msg parse --- nanobot/channels/wecom.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nanobot/channels/wecom.py b/nanobot/channels/wecom.py index a7d7f1fe..69bdf3f0 100644 --- a/nanobot/channels/wecom.py +++ b/nanobot/channels/wecom.py @@ -302,13 +302,22 @@ class WecomChannel(BaseChannel): elif msg_type == "mixed": # Mixed content contains multiple message items - msg_items = body.get("mixed", {}).get("item", []) + msg_items = body.get("mixed", {}).get("msg_item", []) for item in msg_items: - item_type = item.get("type", "") + item_type = item.get("msgtype", "") if item_type == "text": text = item.get("text", {}).get("content", "") if text: content_parts.append(text) + elif item_type == "image": + file_url = item.get("image", {}).get("url", "") + aes_key = item.get("image", {}).get("aeskey", "") + if file_url and aes_key: + file_path = await self._download_and_save_media(file_url, aes_key, "image") + if file_path: + filename = os.path.basename(file_path) + content_parts.append(f"[image: {filename}]") + media_paths.append(file_path) else: content_parts.append(MSG_TYPE_MAP.get(item_type, f"[{item_type}]"))