某个自适应卡使我的网络聊天崩溃

A certain adaptive card crashes my webchat

我目前正在制作一些动态生成的卡片,但出于某种原因,当我尝试将其添加为自适应卡片时,整个网络聊天都崩溃了。

我试过将 JSON 作为不带双引号的对象、带双引号的字符串和带双引号的对象传递。

  "type": "AdaptiveCard",
  "version": "1.0",
  "body": [
    {
      "type": "Container",
      "id": "header",
      "items": [
        {
          "type": "ColumnSet",
          "id": "headerColSet",
          "columns": [
            {
              "type": "TextBlock",
              "id": "actionTextCol",
              "items": [
                {
                  "type": "TextBlock",
                  "id": "actionText",
                  "text": "Action Here!",
                  "horizontalAlignment": "Right"
                }
              ],
              "width": "stretch"
            },
            {
              "type": "TextBlock",
              "id": "actionTextCol",
              "items": [
                {
                  "type": "TextBlock",
                  "id": "actionText",
                  "text": "Action Here!",
                  "horizontalAlignment": "Right"
                }
              ],
              "width": "stretch"
            }
          ]
        }
      ]
    },
    {
      "type": "ColumnSet",
      "id": "columnSet1",
      "columns": [
        {
          "type": "Column",
          "id": "columnIndex0",
          "items": [
            {
              "type": "TextBlock",
              "id": "textOne1",
              "text": "Test text One"
            }
          ],
          "width": "stretch"
        },
        {
          "type": "Column",
          "id": "columnIndex0",
          "items": [
            {
              "type": "TextBlock",
              "id": "textTwo1",
              "text": "Sec Text One"
            }
          ],
          "width": "stretch"
        }
      ]
    },
    {
      "type": "ColumnSet",
      "id": "columnSet2",
      "columns": [
        {
          "type": "Column",
          "id": "columnIndex1",
          "items": [
            {
              "type": "TextBlock",
              "id": "textOne2",
              "text": "Test text 2"
            }
          ],
          "width": "stretch"
        },
        {
          "type": "Column",
          "id": "columnIndex1",
          "items": [
            {
              "type": "TextBlock",
              "id": "textTwo2",
              "text": "Sec Text 2"
            }
          ],
          "width": "stretch"
        }
      ]
    },
    {
      "type": "Container",
      "id": "footer",
      "items": [],
      "separator": true
    }
  ],
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
    }

这个 JSON 应该可以附加到网络聊天中的自适应卡片,但整个屏幕变白并抛出这些错误

card-elements.js:2330 未捕获类型错误:无法读取 属性 'internalValidateProperties' of null

index.js:1375 未在 observeActivity TypeError 中捕获:无法读取 属性 'internalValidateProperties' of null

您的自适应卡似乎有很多问题,最值得注意的是 ColumnSet 应该有一个对象数组,其中 type 属性 设置为 Column。此外,TextBlocks 没有 items 属性。我强烈建议您使用 Adaptive Card Designer to create your cards. Also take a look at the Adaptive Card Schema Explorer.

{
    "type": "AdaptiveCard",
    "version": "1.0",
    "body": [
        {
            "type": "Container",
            "id": "header",
            "items": [
                {
                    "type": "ColumnSet",
                    "columns": [
                        {
                            "type": "Column",
                            "width": "stretch",
                            "items": [
                                {
                                    "type": "TextBlock",
                                    "text": "New TextBlock"
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}

希望对您有所帮助!