简体   繁体   English

我想知道如何使用 Bot 框架 SDK 为 python 设置自适应卡的主机配置

[英]I would like to know how to set the host config of the adaptive card using Bot framework SDK for python

If you use a Hero Card with a large number of buttons, the button actions will be scrolled horizontally on Teams.如果您使用带有大量按钮的英雄卡,则按钮操作将在 Teams 上水平滚动。 Therefore, we are considering the use of adaptive cards because we want to display the buttons as messages arranged vertically.因此,我们正在考虑使用自适应卡片,因为我们希望将按钮显示为垂直排列的消息。 I want to change the value of actionsOrientation of ActionsConfig of HostConfig to adapt to Adaptive Card, but I do not know how.我想更改 HostConfig 的ActionsConfig的 actionsOrientation 的值以适应自适应卡,但我不知道如何。 With Bot framework SDK for python, you can create an AdaptiveCard attachment with CardFactory.adaptive_card(card_data: dict) , but I don't know how to set HostConfig.使用用于 python 的 Bot 框架 SDK,您可以使用CardFactory.adaptive_card(card_data: dict)创建一个 AdaptiveCard 附件,但我不知道如何设置 HostConfig。

A host config can only be specified by an Adaptive Cards renderer, not an Adaptive Cards author.主机配置只能由自适应卡片渲染器指定,而不是自适应卡片作者。 If you want to set your own host config then you need to build your own application.如果要设置自己的主机配置,则需要构建自己的应用程序。 The idea behind Adaptive Cards is that the author is meant to have very limited control so that the renderer gets to decide how the card looks and therefore fit it into the appearance of its surroundings.自适应卡片背后的想法是,作者的控制权非常有限,因此渲染器可以决定卡片的外观,从而使其适合周围环境的外观。 Teams is such a renderer, and its host config make Adaptive Cards look like the other components within Teams. Teams 就是这样一个渲染器,它的主机配置使 Adaptive Cards 看起来像 Teams 中的其他组件。 You can learn more about this in my blog post: https://blog.botframework.com/2019/07/02/using-adaptive-cards-with-the-microsoft-bot-framework/您可以在我的博客文章中了解更多信息: https://blog.botframework.com/2019/07/02/using-adaptive-cards-with-the-microsoft-bot-framework/

While that answers the question you asked, I can also answer the question you meant to ask.虽然这回答了你提出的问题,但我也可以回答你想问的问题。 I think you meant to ask how to arrange buttons vertically in an Adaptive Card.我想你的意思是问如何在自适应卡片中垂直排列按钮。 Microsoft Teams now supports Adaptive Cards 1.2, which means action sets are available to you. Microsoft Teams 现在支持 Adaptive Cards 1.2,这意味着您可以使用操作集。 If you put each action in its own action set in the card's body, they will be arranged vertically:如果您将每个动作放在卡片正文中自己的动作集中,它们将垂直排列:

{
    "$schema": "https://adaptivecards.io/schemas/1.2.0/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.2",
    "body": [
        {
            "type": "ActionSet",
            "actions": [
                {
                    "type": "Action.Submit",
                    "title": "1",
                }
            ]
        },
        {
            "type": "ActionSet",
            "actions": [
                {
                    "type": "Action.Submit",
                    "title": "2",
                }
            ]
        }
    ]
}

自适应卡

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

相关问题 使用python将自适应卡添加到bot框架 - Adding an adaptive card to bot framework with python 如何使用python语言在bot中显示适配卡 - how to display the adaptive card in the bot using python language Microsoft Bot Framework Python 在使用自适应卡附件的 WaterfallStepContext 期间从自适应卡操作获取提交值 - Microsoft Bot Framework Python During a WaterfallStepContext using adaptive card attachment get submit value from adaptive card action 动态创建自适应卡片机器人框架azure - Dynamically create adaptive card bot framework azure 您好,我想知道如何在python中使用Enum - Hello, I would like to know how to use Enum in python Python我想知道如何使用for循环编写(DictWriter) - Python i would like to know how to writerow with a for loop (DictWriter) 我想知道如何在python中将ISO日期更改为UTC - I would like to know how to change an ISO date to UTC in python 我想知道这在python中是否可行 - I would like to know if this is possible in python 我如何使用 python 在我的 discord 机器人上添加冷却时间 - How would i add cooldown on my discord bot using python 使用 python 我想知道一个点(具有三个坐标)是否更接近给定的其他点的 2 厘米 - Using python I would like to know if one point (with three coordinates) is closer to 2 cm of other point given
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM