hermes-dingtalk-media
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "hermes-dingtalk-media":https://skillpi.com/zh/skills/deepskill-b53fc2fa1a27ff30f7e80b37a1ec7af8c71197175bc441d3218e4f88124f8726。安装前核对上游来源和版本:https://skillhub.cn/skills/user_9ab57f1a/hermes-dingtalk-media。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
skillhub.cn
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
用于 Hermes Agent 的钉钉媒体推送功能开发:包括通过钉钉机器人发送图片或文件、修复媒体附件处理、调试钉钉机器人配置与 robotCode 问题、处理流式模式回调与上传 media_id 流程、区分群组与单聊机器人端点,以及验证原生钉钉图片/文件附件。
介绍来源: third_party · user_9ab57f1a · 1.0.2 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: "hermes-dingtalk-media"
description: "Use when working on Hermes Agent DingTalk media delivery: sending images or files from DingTalk bots, fixing MEDIA attachment handling, debugging dingtalk-bot profiles, robotCode issues, Stream Mode callbacks, upload media_id flow, group versus one-to-one robot endpoints, and validating native DingTalk photo/file attachments."Hermes DingTalk Media
Use this skill when a Hermes DingTalk bot needs to send or receive native media attachments, especially when MEDIA:/absolute/path responses do not arrive as independent DingTalk images/files.
Bundled Files
This Hermes skill includes a non-Hermes-native helper script:
scripts/fix_dingtalk_media_support.py: validates that the Hermes source tree contains the DingTalk media implementation, checks required Python modules, runs syntax checks, and can restart a Hermes profile gateway.scripts/send_dingtalk_file.py: sends a local image/file through DingTalk robot media APIs using credentials from a Hermes profile, without modifying Hermes core.
The helpers do not contain credentials. Run the validation helper from any location by passing the Hermes source repository root:
python /path/to/hermes-dingtalk-media/scripts/fix_dingtalk_media_support.py --repo-root "$HERMES_REPO"
python /path/to/hermes-dingtalk-media/scripts/fix_dingtalk_media_support.py --repo-root "$HERMES_REPO" --restart-profile <profile>
If HERMES_REPO points to the Hermes source tree, the --repo-root argument can be omitted.
To validate native DingTalk file delivery without changing Hermes source, send a local file from a configured Hermes profile:
python /path/to/hermes-dingtalk-media/scripts/send_dingtalk_file.py --profile <profile> --target-name "<group-name>" /tmp/example.txt
For one-to-one robot sends, pass a DingTalk staff/user id:
python /path/to/hermes-dingtalk-media/scripts/send_dingtalk_file.py --profile <profile> --user-id "<staff-id>" /tmp/example.txt
Core Flow
-
Confirm the bot receives callbacks.
- Look for
DingTalk callback receivedandinbound message: platform=dingtalk. - If no callback appears, fix Stream Mode/connectivity first.
- Look for
-
Confirm Hermes parsed the media tag.
- The assistant response should contain
MEDIA:/absolute/path/to/file. - Gateway logs should show
Sending DingTalk media via ... robot API.
- The assistant response should contain
-
Upload the local file to DingTalk.
- Endpoint:
POST https://oapi.dingtalk.com/media/upload - Params:
access_token,type=imagefor image extensions, otherwisetype=file. - Multipart field:
media. - Use returned
media_id/mediaId.
- Endpoint:
-
Send the uploaded
media_idwith the correct robot endpoint.- Group chat:
POST https://api.dingtalk.com/v1.0/robot/groupMessages/send - One-to-one bot chat:
POST https://api.dingtalk.com/v1.0/robot/oToMessages/batchSend
- Group chat:
Important Routing Rules
- Do not use
privateChatMessages/sendfor Hermes bot one-to-one media replies. It can returnresource.not.foundeven when upload succeeded. - For one-to-one bot media, use
oToMessages/batchSendwithuserIds: [sender_staff_id]. - For group media, use
groupMessages/sendwithopenConversationId. - Prefer
message.robot_codefrom the incoming DingTalk callback over configured app/client id. Config fallback is acceptable only when there is no callback context. - Keep the incoming callback context by
chat_id; it providesconversation_type,robot_code, andsender_staff_id.
Payloads
Group media:
payload = {
"robotCode": robot_code,
"openConversationId": chat_id,
"msgKey": msg_key,
"msgParam": json.dumps(msg_param, ensure_ascii=False),
}
One-to-one media:
payload = {
"robotCode": robot_code,
"userIds": [sender_staff_id],
"msgKey": msg_key,
"msgParam": json.dumps(msg_param, ensure_ascii=False),
}
Known media templates to try:
image_candidates = [
("sampleImageMsg", {"photoURL": media_id}),
("sampleImageMsg", {"mediaId": media_id}),
("sampleImage", {"mediaId": media_id}),
]
file_candidates = [
("sampleFile", {"mediaId": media_id, "fileName": file_name}),
("sampleFileMsg", {"mediaId": media_id, "fileName": file_name}),
]
Hermes Implementation Checklist
In gateway/platforms/dingtalk.py:
- Implement
send_image_file,send_document, andsend_video. - Resolve inbound
downloadCodeto local cache files for images/audio/video/documents. - Use a cancellable Stream loop instead of
dingtalk_stream.DingTalkStreamClient.start()if shutdown or reconnect gets stuck; the SDK can swallow cancellation. - Call
self._stream_client.pre_start()before opening the Stream connection when replacing SDKstart(). - Log media routing without exposing secrets, for example:
Sending DingTalk media via oto robot API; robot_code_source=callback recipient_source=sender_staff_id.
In tools/send_message_tool.py:
- Support DingTalk
MEDIA:extraction. - For direct sends without callback context, one-to-one media requires an explicit DingTalk user id/staff id; otherwise default to group sends.
In agent/prompt_builder.py:
- Add a DingTalk platform hint that native media can be sent with
MEDIA:/absolute/path/to/file.
Validation
Run:
cd "$HERMES_REPO"
python -m py_compile gateway/platforms/dingtalk.py tools/send_message_tool.py agent/prompt_builder.py
python /path/to/hermes-dingtalk-media/scripts/fix_dingtalk_media_support.py --repo-root "$HERMES_REPO"
git diff --check
python /path/to/hermes-dingtalk-media/scripts/fix_dingtalk_media_support.py --repo-root "$HERMES_REPO" --restart-profile <profile>
Test image and file delivery separately:
result = await adapter._send_robot_media(
chat_id=chat_id,
file_path="/tmp/example.png",
media_kind="image",
)
result = await adapter._send_robot_media(
chat_id=chat_id,
file_path="/tmp/example.txt",
media_kind="file",
file_name="example.txt",
)
Expected success shape:
{"success": True, "error": None, "message_id": "..."}
Failure Signals
resource.not.foundaftermedia/upload: upload worked, but the send endpoint orrobotCode/recipient is wrong.robot 不存在: usually wrongrobotCode; use callbackmessage.robot_code.private HTTP 400 ... resource.not.foundin one-to-one chat: switch fromprivateChatMessages/sendtooToMessages/batchSend.- No
DingTalk callback received: Stream callback delivery is not reaching Hermes; check bot/app, Stream Mode, competing gateway processes, and profile credentials.
当前收录版本
1.0.2
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 针对 Hermes Agent 钉钉机器人媒体传输的具体痛点提供解决方案
- 涵盖 MEDIA 附件处理、robotCode 问题、Stream Mode 回调、media_id 上传流程等关键环节
- 提供详细的实现流程、Payload 示例和故障排查指南
亮点
- 触发词覆盖全面,包括发送图片/文件、MEDIA 附件处理、robotCode 问题、Stream Mode 回调等
- 边界清晰,能有效引导用户在相关开发调试场景下触发
待提升项
-
文档长度 原报告严重程度:轻微
文档内容较丰富,总行数约 600 行,可能影响阅读体验
改进建议:建议适当拆分章节或增加目录导航以提升可读性
亮点
- 结构清晰,包含 Bundled Files、Core Flow、Routing Rules、Payloads、Checklist 等完整章节
- 提供了端到端的示例和具体命令,frontmatter 完整
亮点
- 提供了两个辅助脚本用于验证和发送,脚本来源明确,参数说明清晰
- 覆盖了主要异常场景并提供了解决方案,不可逆操作有明确参数控制
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
账号、密钥或授权
使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。
主文档提及 · 第 15, 17, 50, 165 行
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- api.dingtalk.com
- oapi.dingtalk.com
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。