@yaoyuanchao/dingtalk 1.3.9 → 1.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaoyuanchao/dingtalk",
3
- "version": "1.3.9",
3
+ "version": "1.3.11",
4
4
  "type": "module",
5
5
  "description": "DingTalk channel plugin for Clawdbot with Stream Mode support",
6
6
  "license": "MIT",
@@ -74,7 +74,7 @@ export const dingTalkConfigSchema = z.object({
74
74
  streamingEnabled: z.boolean().default(false)
75
75
  .describe('Enable streaming update for AI typewriter effect (costs more API quota)'),
76
76
  streamingKey: z.string().default('content')
77
- .describe('Variable key for streaming content in the card template'),
77
+ .describe('Variable key for content in the card template (must match template variable name)'),
78
78
  fallbackToMarkdown: z.boolean().default(true)
79
79
  .describe('Fall back to markdown when card delivery fails'),
80
80
  }).optional()
package/src/monitor.ts CHANGED
@@ -770,17 +770,26 @@ async function deliverCardReply(
770
770
 
771
771
  const robotCodeValue = robotCode || clientId;
772
772
 
773
- // Prepare card data - use 'content' as the main variable for markdown content
773
+ // Prepare card data - use configurable key for content variable (default: 'content')
774
+ // For basic cards: only send content variable
775
+ // For AI streaming cards: also send 'flowStatus' and optionally 'title'
774
776
  const isStreaming = cardConfig.streamingEnabled;
777
+ const contentKey = cardConfig.streamingKey || 'content';
775
778
  const cardData: Record<string, string> = {
776
- content: text,
777
- // flowStatus: "0" = streaming, "1" = complete
778
- flowStatus: isStreaming ? "0" : "1",
779
- // title: use configured title, or "完成" for non-streaming mode
780
- title: cardConfig.title || (isStreaming ? "" : "完成"),
779
+ [contentKey]: text,
781
780
  };
782
781
 
783
- log?.info?.("[dingtalk-card] Sending card message, templateId=" + cardConfig.templateId);
782
+ // Only add flowStatus for streaming cards (AI cards)
783
+ if (isStreaming) {
784
+ cardData.flowStatus = "0"; // "0" = streaming in progress
785
+ }
786
+
787
+ // Only add title if explicitly configured
788
+ if (cardConfig.title) {
789
+ cardData.title = cardConfig.title;
790
+ }
791
+
792
+ log?.info?.("[dingtalk-card] Sending card message, templateId=" + cardConfig.templateId + ", contentKey=" + contentKey);
784
793
 
785
794
  const result = await sendCardMessage({
786
795
  clientId,