自适应卡内的自适应卡,用于常见问题解答

时间:2019-03-29 00:06:16

标签: json bots chatbot adaptive-cards

我正在考虑创建一个适用于常见问题的自适应卡。因此,有一个带有Action.Showcard的卡片,其中包含标题常见问题解答。用户单击常见问题解答后,该卡片应展开以显示5个问题。问题本身就是自适应卡片,因此当用户单击问题时,卡片会打开以显示答案。

我无法在卡中放入卡。这是我使用Adaptive Card designer

构建的JSON
{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "size": "Medium",
            "weight": "Bolder",
            "text": "Hi I am a ChatBot."
        },
        {
            "type": "TextBlock",
            "text": "Look at FAQs below.",
            "wrap": true
        }
    ],
    "actions": [
        {
            "type": "Action.ShowCard",
            "title": "FAQs",
            "card": {
                "type": "AdaptiveCard",
                "style": "emphasis",
                "body": [
                    {
                        "type": "TextBlock",
                        "text": "How quickly can we close?"
                    }
                ],
                "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
            }
        },
        {
            "type": "Action.ShowCard",
            "title": "Comment",
            "card": {
                "type": "AdaptiveCard",
                "style": "emphasis",
                "body": [
                    {
                        "type": "Input.Text",
                        "id": "comment",
                        "placeholder": "Enter your comment",
                        "isMultiline": true
                    }
                ],
                "actions": [
                    {
                        "type": "Action.Submit",
                        "title": "OK"
                    }
                ],
                "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
            }
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.0"
}

当我将Action.ShowCard放在Action.ShowCard标记中时,它给我一个错误,并将Action.ShowCard更改为AdpativeCard。有人可以告诉我这种设计的结构吗?这将很有帮助,因为我需要扩展这些常见问题解答。

1 个答案:

答案 0 :(得分:1)

也许我不了解您的问题,但是我能够在设计器中创建所需的结构而没有问题:

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "size": "Medium",
            "weight": "Bolder",
            "text": "Hi I am a ChatBot."
        },
        {
            "type": "TextBlock",
            "text": "Look at FAQs below.",
            "wrap": true
        }
    ],
    "actions": [
        {
            "type": "Action.ShowCard",
            "title": "FAQs",
            "card": {
                "type": "AdaptiveCard",
                "style": "emphasis",
                "actions": [
                    {
                        "type": "Action.ShowCard",
                        "title": "How quickly can we close?",
                        "card": {
                            "type": "AdaptiveCard",
                            "style": "emphasis",
                            "body": [
                                {
                                    "type": "TextBlock",
                                    "text": "Never"
                                }
                            ],
                            "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
                        }
                    },
                    {
                        "type": "Action.ShowCard",
                        "title": "Second question",
                        "card": {
                            "type": "AdaptiveCard",
                            "style": "emphasis",
                            "body": [
                                {
                                    "type": "TextBlock",
                                    "text": "Second answer"
                                }
                            ],
                            "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
                        }
                    }
                ],
                "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
            }
        },
        {
            "type": "Action.ShowCard",
            "title": "Comment",
            "card": {
                "type": "AdaptiveCard",
                "style": "emphasis",
                "body": [
                    {
                        "type": "Input.Text",
                        "id": "comment",
                        "placeholder": "Enter your comment",
                        "isMultiline": true
                    }
                ],
                "actions": [
                    {
                        "type": "Action.Submit",
                        "title": "OK"
                    }
                ],
                "$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
            }
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.0"
}