What happened / 发生了什么
在钉钉群聊中,用户使用“引用回复”向机器人提问时,AstrBot 只能读取用户新输入的正文,无法完整读取被引用消息的文本或图片内容。
钉钉当前的机器人回调会把引用信息放在 text.isReplyMsg 和 text.repliedMsg 中。repliedMsg 可能是普通文本、单张图片或包含图片的富文本;但钉钉适配器此前只读取 message.text.content,没有将引用内容转换为 AstrBot 的 Reply 消息组件,因此引用上下文在进入 LLM 前丢失。
对于引用图片,仅生成 [Image] 文本占位也不够。适配器需要使用引用负载中的 downloadCode 和当前回调中的 robotCode 下载媒体,并将得到的 Image 组件放入 Reply.chain,模型才能实际接收图片。
脱敏后的文本引用回调结构:
{
"msgtype": "text",
"msgId": "current-message-id",
"robotCode": "robot-code",
"text": {
"content": "你能回答这个问题么",
"isReplyMsg": true,
"repliedMsg": {
"msgType": "text",
"msgId": "quoted-message-id",
"senderId": "quoted-sender-id",
"senderNick": "Quoted User",
"createdAt": 1785405000000,
"content": {
"text": "这个产品目前接入了哪些模型?"
}
}
}
}
脱敏后的图片引用核心结构:
{
"msgtype": "text",
"robotCode": "robot-code",
"text": {
"content": "这张图片是什么问题?",
"isReplyMsg": true,
"repliedMsg": {
"msgType": "picture",
"msgId": "quoted-picture-message-id",
"content": {
"downloadCode": "quoted-picture-download-code"
}
}
}
}
富文本引用中的图片位于 repliedMsg.content.richText,图片段同样携带 downloadCode。
当前转换结果只包含用户新输入的正文,例如:
预期转换结果应包含:
Reply 组件以及被引用文本、发送者、时间和消息 ID;
- 单图引用对应的真实
Image 组件;
- 富文本引用中按原顺序排列的
Plain 和 Image 组件;
- 图片下载信息缺失或下载失败时保留可读占位,不应丢弃整个引用。
Reproduce / 如何复现?
- 配置并启动 AstrBot 内置钉钉 Stream 机器人适配器。
- 在钉钉群聊中找到一条普通文本、图片或包含图片的富文本消息。
- 对该消息使用钉钉“引用回复”,在回复中 @ 机器人并提出问题。
- 查看 AstrBot Debug 日志或模型收到的消息上下文。
- 可以看到回调中存在
text.isReplyMsg=true 和 text.repliedMsg,但未修复版本的消息链缺少完整的 Reply 文本或图片内容。
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商和消息平台适配器
- AstrBot: v4.26.8
- 部署方式: Linux 源码部署(systemd)
- 消息平台: 内置 DingTalk / 钉钉 Stream 适配器
- Provider: 与 Provider 无关,问题发生在消息进入 LLM 前的平台消息转换阶段
OS
Linux
Logs / 报错日志
该问题通常不会抛出异常。Debug 回调中可以看到引用字段,但转换后的消息链缺少引用组件或只保留图片占位:
[Core] [DBUG] [dingtalk.dingtalk_adapter]: dingtalk: {
"msgtype": "text",
"text": {
"content": "这张图片是什么问题?",
"isReplyMsg": true,
"repliedMsg": {
"msgType": "picture",
"msgId": "quoted-picture-message-id",
"content": {
"downloadCode": "quoted-picture-download-code"
}
}
}
}
Are you willing to submit a PR? / 你愿意提交 PR 吗?
Code of Conduct
What happened / 发生了什么
在钉钉群聊中,用户使用“引用回复”向机器人提问时,AstrBot 只能读取用户新输入的正文,无法完整读取被引用消息的文本或图片内容。
钉钉当前的机器人回调会把引用信息放在
text.isReplyMsg和text.repliedMsg中。repliedMsg可能是普通文本、单张图片或包含图片的富文本;但钉钉适配器此前只读取message.text.content,没有将引用内容转换为 AstrBot 的Reply消息组件,因此引用上下文在进入 LLM 前丢失。对于引用图片,仅生成
[Image]文本占位也不够。适配器需要使用引用负载中的downloadCode和当前回调中的robotCode下载媒体,并将得到的Image组件放入Reply.chain,模型才能实际接收图片。脱敏后的文本引用回调结构:
{ "msgtype": "text", "msgId": "current-message-id", "robotCode": "robot-code", "text": { "content": "你能回答这个问题么", "isReplyMsg": true, "repliedMsg": { "msgType": "text", "msgId": "quoted-message-id", "senderId": "quoted-sender-id", "senderNick": "Quoted User", "createdAt": 1785405000000, "content": { "text": "这个产品目前接入了哪些模型?" } } } }脱敏后的图片引用核心结构:
{ "msgtype": "text", "robotCode": "robot-code", "text": { "content": "这张图片是什么问题?", "isReplyMsg": true, "repliedMsg": { "msgType": "picture", "msgId": "quoted-picture-message-id", "content": { "downloadCode": "quoted-picture-download-code" } } } }富文本引用中的图片位于
repliedMsg.content.richText,图片段同样携带downloadCode。当前转换结果只包含用户新输入的正文,例如:
预期转换结果应包含:
Reply组件以及被引用文本、发送者、时间和消息 ID;Image组件;Plain和Image组件;Reproduce / 如何复现?
text.isReplyMsg=true和text.repliedMsg,但未修复版本的消息链缺少完整的Reply文本或图片内容。AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商和消息平台适配器
OS
Linux
Logs / 报错日志
该问题通常不会抛出异常。Debug 回调中可以看到引用字段,但转换后的消息链缺少引用组件或只保留图片占位:
Are you willing to submit a PR? / 你愿意提交 PR 吗?
Code of Conduct