feat(dingtalk): extract quoted-reply context for agent awareness#17368
feat(dingtalk): extract quoted-reply context for agent awareness#17368spike2204 wants to merge 1 commit into
Conversation
When a user long-presses → quotes → replies in DingTalk, the inbound
payload carries isReplyMsg=True + repliedMsg={...}. The dingtalk-stream
SDK does not expose this through a typed field; without explicit
extraction the agent loses the quoted context.
- Add _extract_quoted_msg_text() — recursive parser (max_depth=3)
supporting text, richText, picture, video, audio (recognition),
file (fileName), markdown, and interactiveCard (forward-compatible)
- Enhance _extract_text() to surface quoted context as '[引用] <body>'
lines; handle both dict and TextContent.extensions SDK payload shapes
- Add SDK blind-spot fallbacks for audio/video/file/markdown via
extensions['content'] (types the SDK doesn't parse into typed attrs)
- Add 12 unit tests covering all scenarios
Matches dingtalk-openclaw-connector core/message-handler.ts:163-240. to #
|
Hi @alt-glitch, thanks for flagging the overlap! 🙏 Correct — this is a refined, self-contained extraction of the quoted-reply feature from the original stacked #14334. To clarify the relationship: @PeterGuy326 and @spike2204 are colleagues on the DingTalk (钉钉) Open Platform team at Alibaba. We maintain the DingTalk stream SDK, AI Card APIs, and the messaging infrastructure that Hermes integrates with. This PR series represents production-validated improvements from our internal Hermes deployment. The original #14334 was stacked on top of #14333 (included all reliability fixes + the quoted-reply feature in one PR). This new PR (#17368) isolates only the quoted-reply extraction logic, rebased cleanly against Technical note on this feature: DingTalk's quoted-reply payload is carried in The 12 unit tests cover all message types including the forward-compatible Happy to address any feedback! 🚀 |
Summary
When a user long-presses → quotes → replies in DingTalk, the inbound payload carries
isReplyMsg=True+repliedMsg={...}. The dingtalk-stream SDK does not expose this through a typed field; without explicit extraction the agent loses the quoted context.Changes
_extract_quoted_msg_text()— recursive parser (max_depth=3) supporting text, richText, picture, video, audio (recognition), file (fileName), markdown, and interactiveCard (forward-compatible)_extract_text()to surface quoted context as[引用] <body>lines; handle both dict and TextContent.extensions SDK payload shapesextensions['content']Ported from dingtalk-openclaw-connector
core/message-handler.ts:163-240.Related
Part of the DingTalk adapter enhancement series — see #12769 for the umbrella PR.