简体   繁体   English

自适应卡片 Bot Framework composer

[英]Adaptive card Bot Framework composer

I am learning Bot framework composer.我正在学习 Bot 框架作曲家。 I am trying to add adaptive card using https://adaptivecards.io/designer .我正在尝试使用https://adaptivecards.io/designer添加自适应卡。 I copied the card payload and paste it in the bot responses.我复制了卡有效负载并将其粘贴到机器人响应中。 It look like this它看起来像这样

[import](common.lg)

#title()
-adaptive card

# adaptivecardjson()

- ```
{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "size": "Medium",
            "weight": "Bolder",
            "text": "${title}",
            "wrap": true,
            "style": "heading",
            
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.0"
}```


# AdaptiveCard()
[Activity
    Attachments = ${json(adaptivecardjson())}
]

In send a response在发送响应

- ${AdaptiveCard()}

I tested the bot in web chat but I'm getting output like this我在 web 聊天中测试了机器人,但我得到了 output 像这样

{

“type”: “AdaptiveCard”,

“version”: “1.0”,

“body”: [

{

  "type": "TextBlock",

  "text": "Pick up where you left off?",

  "weight": "bolder"

},

Can anyone please help me to implement adaptive cards in bot framework composer.谁能帮我在机器人框架作曲家中实现自适应卡。

If the send response is "- ${AdaptiveCard()}" then it sounds like you are setting the Text property of the response instead of the attachments.如果发送响应是“- ${AdaptiveCard()}”,那么听起来您正在设置响应的 Text 属性而不是附件。 Cards need to be added to the attachments.需要将卡片添加到附件中。

You can add attachments via the plus menu like this您可以像这样通过加号菜单添加附件

添加附件菜单

Then add a new attachment using the Adaptive Card template in the subsequent menu and replace the default card with yours.然后在后续菜单中使用自适应卡片模板添加新附件,并用您的卡片替换默认卡片。

In the end, your send activity should look like this if you view it in the code最后,如果您在代码中查看,您的发送活动应该如下所示

# SendActivity_BlahBlah
[Activity
    Attachments = ${json(adaptivecardjson())} 
]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM