自适应卡显示屏未显示在cortana通道上,但在团队和模拟器上均能正常工作

时间:2019-05-28 12:40:48

标签: botframework cortana adaptive-cards cortana-skills-kit

我创建了一个QnA机器人并将其集成了cortana。 我可以在Cortana频道上看到英雄卡片,但看不到自适应卡片。 尽管我在代码中的答复变量中获得了附件,但该卡未呈现。 另外,自适应卡的语音属性似乎已被弃用。

下面是我作为调试信息得到的json响应

{
  "botId": "ValoremReplyCortanaBot",
  "botRequest": {
    "type": "message",
    "id": "ru2O3ASCqo",
    "timestamp": "2019-05-28T12:28:38.6194349Z",
    "serviceUrl": "https://CortanaBFChannelEastUs.azurewebsites.net/",
    "channelId": "cortana",
    "from": {
      "id": "6E45EE54844A79A85857DE2CEF10B9223A16AE6ACC2360DC007744F9CA7377E5"
    },
    "conversation": {
      "id": "f002bf89-2d89-4e41-a5b6-bcdfa4e35cc3"
    },
    "recipient": {
      "id": "valoremreplycortanabot"
    },
    "locale": "en-US",
    "text": "guide",
    "entities": [
      {
        "type": "Intent",
        "name": "None",
        "entities": []
      },
      {
        "type": "AuthorizationToken",
        "token": "##",
        "status": 0
      },
      {
        "type": "UserInfo",
        "current_location": {
          "StartTime": "2019-05-28T12:28:38.0673147Z",
          "EndTime": null,
          "Hub": {
            "Id": null,
            "Type": "Other",
            "Name": null,
            "Latitude": 10.0126075744629,
            "Longitude": 76.3658599853516,
            "Address": null
          },
          "VenueName": null,
          "Away": false
        },
        "name": {
          "GivenName": "##",
          "FamilyName": "##"
        },
        "email": "##@outlook.com"
      },
      {
        "type": "DeviceInfo",
        "supportsDisplay": "true"
      }
    ],
    "channelData": {
      "skillId": "cc3ef598-4f4f-444f-bd20-87a211581607",
      "skillProductId": "188779dd-2894-4cb3-b93f-b99955039ead",
      "isDebug": true
    }
  },
  "botResponse": {
    "type": "message",
    "timestamp": "2019-05-28T12:28:51.306281Z",
    "serviceUrl": "https://CortanaBFChannelEastUs.azurewebsites.net/",
    "channelId": "cortana",
    "from": {
      "id": "valoremreplycortanabot"
    },
    "conversation": {
      "id": "f002bf89-2d89-4e41-a5b6-bcdfa4e35cc3"
    },
    "recipient": {
      "id": "6E45EE54844A79A85857DE2CEF10B9223A16AE6ACC2360DC007744F9CA7377E5"
    },
    "locale": "en-US",
    "text": "",
    "attachments": [
      {
        "contentType": "application/vnd.microsoft.card.adaptive",
        "content": {
          "type": "AdaptiveCard",
          "version": "1.0",
          "body": [
            {
              "type": "TextBlock",
              "size": "large",
              "weight": "bolder"
            },
            {
              "type": "Image",
              "size": "stretch",
              "url": "##",
              "width": "100px",
              "height": "100px"
            }
          ],
          "actions": [
            {
              "type": "Action.OpenUrl",
              "url": "##",
              "title": "Guide Poster",
              "speak": "Guide Poster"
            }
          ]
        }
      }
    ],
    "entities": [],
    "replyToId": "ru2O3ASCqo"
  }
}

1 个答案:

答案 0 :(得分:1)

Cortana桌面中的HTML渲染器比其他客户端的宽容度低。选中https://adaptivecards.io/explorer/TextBlock.html

确保每个元素都有其必填字段。

就像您的TextBlock没有文本对象一样简单。...添加 "text": ""

哦,说话不被弃用。它在卡级别;对身体。还有... Cortana默认不会讲。您需要从卡中复制它,并将其添加到消息https://github.com/microsoft/cortana-skills-samples/blob/master/Consumer/CSharp/V4Patches/07.using-adaptive-cards.diff