feat(dingtalk): default to public AI Card template for dynamic streaming#1
Open
sls-dev-agent wants to merge 2 commits into
Open
feat(dingtalk): default to public AI Card template for dynamic streaming#1sls-dev-agent wants to merge 2 commits into
sls-dev-agent wants to merge 2 commits into
Conversation
Adopts the public AI Card template that @dingtalk-real-ai/dingtalk-connector uses (02fcf2f4-...schema), so DingTalk replies stream into a single updatable card out of the box — no manual template setup. Existing card_template_id overrides keep the legacy simple flow. - New `dynamic_card` toggle (default true) - INPUTING / FINISHED flowStatus lifecycle PUTs for the public template - Markdown normalize: `\n`→`<br>` outside fences/lists/tables, table blank-line insertion, consecutive quote-line merge - Process-wide 20 QPS token bucket with QpsLimit backoff - 22 new tests covering payload shape, lifecycle, normalize, limiter Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The previous StreamingCard contract aggregated thinking, tool calls, and assistant text into a single bundled card body, so every turn ended with the entire trace stuck in one message. Replicate dingtalk-real-ai's reply-dispatcher behavior instead: the assistant reply is the persistent card content, while tool-call and thinking events are short-lived overlays that the next text chunk overwrites. Finalize now uses the assistant text only — tool/thinking events do not pollute the final card body. - Drop cardToolEntry / buildCardContent / cardToolCalls / cardThinkingText from the engine; thinking and tool events Update() with a transient overlay string (existing MsgThinking / MsgTool i18n templates). - Update StreamingCard / StreamingCardPlatform interface docs to match. - Add TestStreamingCard_ToolAndThinkingDoNotAccumulate which drives Thinking + ToolUse + Text events through the engine and asserts the Finalize content is the assistant text only, while transient overlays do appear during streaming. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
02fcf2f4-5e02-4a85-b672-46d1f715543e.schemafrom@dingtalk-real-ai/dingtalk-connector(openclaw plugin) so operators don't need to register a template themselves on DingTalk Open Platform.card_template_idoverrides still work — the new behavior is opt-out viadynamic_card = false.What changed
platform/dingtalk/dingtalk.go— newDefaultCardTemplateIDconstant,dynamic_card/useDefaultTemplatefields; factory falls back to public template whencard_template_idunset (andcard_template_keydefaults tomsgContent).platform/dingtalk/card.go—cardParamMapshape DingTalk's public template expects (flowStatus,msgContent,staticMsgContent,sys_full_json_obj,config).PUT /v1.0/card/instanceswithflowStatus=INPUTINGbefore the first stream chunk andflowStatus=FINISHEDonFinalize, so the loading spinner actually clears.normalizeForCard(Go): convert single\n→<br>outside fenced code blocks / lists / tables / headings, insert blank line before tables, merge consecutive quote-block lines.<br>flicker.QpsLimit403) shared across all DingTalk instances.config.example.toml— document the new defaults & options.platform/dingtalk/card_test.go— 22 new tests.Test plan
go test ./platform/dingtalk/ -count=1— 22 new + originals all passgo test ./core/ -count=1— no regressions in engine StreamingCard testsgo vet ./platform/dingtalk/cleandynamic_card = false, confirm fallback to plain markdown still works.card_template_id, confirm legacy simple-shape flow still works.🤖 Generated with Claude Code