我在将AdaptiveCardJSON用于python web聊天机器人(BotFrameWork)时遇到了一个问题,我想知道如何自定义JSON元素中的值,这些值是动态的。我解释得更多,我必须在一张卡片上列出图书信息,但标题、作者等。。。每次都会改变。那么如何动态地填充值呢? 这是我的json文件
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.3",
"body": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "RISULTATI",
"horizontalAlignment": "center",
"spacing": "None",
"size": "Large",
"color": "Attention",
"wrap": true
}
]
}
]
},
{
"type": "ColumnSet",
"separator": true,
"spacing": "Medium",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "Nome Libro e autore",
"isSubtle": true,
"weight": "Bolder",
"wrap": true
},
{
"type": "TextBlock",
"text": "Prezzo",
"spacing": "Small",
"wrap": true
},
{
"type": "TextBlock",
"text": "Disponibilità",
"spacing": "Small",
"wrap": true
},
{
"type": "TextBlock",
"text": "Link",
"spacing": "Small",
"wrap": true
}
]
},
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "TextBlock",
"text": "Genere",
"horizontalAlignment": "Right",
"isSubtle": true,
"weight": "Bolder",
"wrap": true
}
]
}
]
},
{
"type": "ColumnSet",
"spacing": "Medium",
"separator": true,
"columns": [
{
"type": "Column",
"width": 1,
"items": [
{
"type": "TextBlock",
"text": "Prezzo",
"spacing": "Small",
"wrap": true
},
{
"type": "TextBlock",
"text": "Disponibilità",
"spacing": "Small",
"wrap": true
},
{
"type": "TextBlock",
"text": "Link",
"spacing": "Small",
"wrap": true
}
]
}
]
}
]
}
我必须填写项目中的文本值,我应该如何做
不幸的是,Adaptive Cards SDK没有Python支持,因此您无法直接在bot代码中制作动态卡。但是,您仍然可以使用Adaptive Card Templating,因此您的卡可以是动态的,尽管它仅限于卡中包含的数据
因此,您确实有两种选择:
相关问题 更多 >
编程相关推荐