首页 > 解决方案 > 团队机器人框架 - composeExtensions 不显示自适应卡上的按钮

问题描述

清单中定义了两个撰写扩展命令。这些会触发对机器人框架的请求,该框架会使用自适应卡进行响应。

显示自适应卡时,它会正确呈现,但缺少按钮。如果我发送与聊天活动完全相同的自适应卡片,它会正确显示。

它是如何显示的

handleTeamsMessagingExtensionFetchTask 代码

// enableInboundCard = below json
const card = this.renderAdaptiveCard(enableInboundCard, { channel })

    return {
      task: {
        type: 'continue',
        value: {
          card,
          height: 500,
          title: 'Enable Inbound',
          width: 600
        }
      }
    };

命令(在清单中)。

{
  "id": "enableInbound",
  "context": [
    "compose"
  ],
  "description": "Enable inbound SMS to channel",
  "title": "Enable Inbound",
  "type": "action",
  "fetchTask": true,
  "parameters": [
    {
      "name": "test",
      "title": "test",
      "inputType": "text",
      "value": "test"
    }
  ]
}

自适应卡

{
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.5",
    "body": [
        {
            "type": "TextBlock",
            "size": "Large",
            "weight": "Bolder",
            "wrap": true,
            "style": "heading",
            "text": "Enable Inbound SMS"
        },
        {
            "type": "TextBlock",
            "text": "A wholeeeeeeee bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch bunch  of txt",
            "wrap": true
        },
        {
            "type": "FactSet",
            "facts": [
                {
                    "title": "Current Channel",
                    "value": "${channel}"
                }
            ]
        },
        {
            "type": "ActionSet",
            "actions": [
                {
                    "type": "Action.Execute",
                    "title": "Enable Inbound SMS",
                    "verb": "enable_inbound",
                    "fallback": "Action.Submit"
                }
            ]
        }
    ]
}

标签: botframeworkmicrosoft-teamsteams-toolkit

解决方案


推荐阅读