From cdde0c841190613564e86815d0ba84c4d3e654c5 Mon Sep 17 00:00:00 2001 From: yuehei Date: Sun, 3 May 2026 21:52:26 +0800 Subject: [PATCH] fix(feishu): enable MEDIA attachment delivery in send_message tool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The _send_feishu() function already supports media_files (images, video, audio, documents) via the adapter's send_image_file/send_video/send_voice /send_document methods, but _send_to_platform() never routed Feishu into the early media-handling branch — media attachments were silently dropped with a "not supported" warning. Add a Feishu-specific media branch (matching the existing Yuanbao/Signal pattern) so that MEDIA: tags in send_message calls are correctly delivered as native Feishu attachments. Also update the two error/warning message strings to include feishu in the supported platform list. Co-Authored-By: Claude Opus 4.6 (1M context) --- tools/send_message_tool.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tools/send_message_tool.py b/tools/send_message_tool.py index 0ad30d6dcb..b4de998fe5 100644 --- a/tools/send_message_tool.py +++ b/tools/send_message_tool.py @@ -588,11 +588,28 @@ async def _send_to_platform(platform, pconfig, chat_id, message, thread_id=None, last_result = result return last_result + # --- Feishu: native media attachment support via adapter --- + if platform == Platform.FEISHU and media_files: + last_result = None + for i, chunk in enumerate(chunks): + is_last = (i == len(chunks) - 1) + result = await _send_feishu( + pconfig, + chat_id, + chunk, + media_files=media_files if is_last else None, + thread_id=thread_id, + ) + if isinstance(result, dict) and result.get("error"): + return result + last_result = result + return last_result + # --- Non-media platforms --- if media_files and not message.strip(): return { "error": ( - f"send_message MEDIA delivery is currently only supported for telegram, discord, matrix, weixin, signal and yuanbao; " + f"send_message MEDIA delivery is currently only supported for telegram, discord, matrix, weixin, signal, yuanbao and feishu; " f"target {platform.value} had only media attachments" ) } @@ -600,7 +617,7 @@ async def _send_to_platform(platform, pconfig, chat_id, message, thread_id=None, if media_files: warning = ( f"MEDIA attachments were omitted for {platform.value}; " - "native send_message media delivery is currently only supported for telegram, discord, matrix, weixin, signal and yuanbao" + "native send_message media delivery is currently only supported for telegram, discord, matrix, weixin, signal, yuanbao and feishu" ) last_result = None