Skip to content

Add Feishu channel support for image, file, audio, and media message types with resource downloading and inline image forwarding to the agent engine.#156

Merged
everettjf merged 1 commit intomicroclaw:mainfrom
Rvn0xsy:main
Feb 28, 2026

Conversation

@Rvn0xsy
Copy link
Contributor

@Rvn0xsy Rvn0xsy commented Feb 28, 2026

修改了 src/channels/feishu.rs,4 处变更:

  1. 新增 3 个辅助函数(parse_message_content 之后):
  • download_feishu_resource() — 通过飞书 API GET /open-apis/im/v1/messages/{message_id}/resources/{key}?type={type} 下载图片/文件二进制数据
  • base64_encode() — 与 Telegram 侧相同的 base64 编码
  • guess_image_media_type() — magic bytes 判断图片 MIME 类型
  1. handle_feishu_event → handle_feishu_message 调用处:新增传递 message_type 和 content_raw 两个参数
  2. handle_feishu_message 函数体内(token 获取后,slash command 检查前)增加了消息类型分发:
消息类型 处理逻辑
image 用 image_key 下载图片 → base64 → image_data → agent 多模态处理
file 用 file_key 下载文件 → 大小检查(max_document_size_mb) → 存到 uploads/ → 拼 [document] filename=... bytes=... saved_path=... 到文本(与 Telegram 一致)
audio 提示暂不支持转写(预留扩展点)
media/sticker 替换为 [media]/[sticker] 占位符
  1. 两个 process_with_agent_with_events 调用点:将第 4 个参数从 None 改为 image_data

⚠️注意:关于文件收发的功能,需要启用获取与上传图片或文件资源 im:resource 权限

image

…types with resource downloading and inline image forwarding to the agent engine.
@everettjf everettjf merged commit 7aceaca into microclaw:main Feb 28, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants