gpt4 book ai didi

node.js - 如何从 node.js 中的自适应卡读取按钮操作?

转载 作者:太空宇宙 更新时间:2023-11-04 00:21:25 26 4
gpt4 key购买 nike

如果我有一张自适应卡,如下所示:

var msg = new builder.Message(session)
.addAttachment({
contentType: "application/vnd.microsoft.card.adaptive",
content: {
type: "AdaptiveCard",
speak: "<s>Your meeting about \"Adaptive Card design session\"<break strength='weak'/> is starting at 12:30pm</s><s>Do you want to snooze <break strength='weak'/> or do you want to send a late notification to the attendees?</s>",
body: [
{
"type": "TextBlock",
"text": "Adaptive Card design session",
"size": "large",
"weight": "bolder"
},
{
"type": "TextBlock",
"text": "Conf Room 112/3377 (10)"
},
{
"type": "TextBlock",
"text": "12:30 PM - 1:30 PM"
},
{
"type": "TextBlock",
"text": "Snooze for"
},
{
"type": "Input.ChoiceSet",
"id": "snooze",
"style":"compact",
"choices": [
{
"title": "5 minutes",
"value": "5",
"isSelected": true
},
{
"title": "15 minutes",
"value": "15"
},
{
"title": "30 minutes",
"value": "30"
}
]
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Snooze"
},
{
"type": "Action.Submit",
"title": "I'll be late"
}
]
}
});

如何在对话中呈现它,以便机器人等待用户单击其中一个提交按钮?

如何读取已按下的按钮?

我在 Node.js 中找不到任何示例来执行此操作。

非常感谢

最佳答案

您需要检查session.message.value是否存在

if (session.message && session.message.value) {
// process your card's submit action
}

看看下面的Adaptive Card sample了解如何处理提交操作。

关于node.js - 如何从 node.js 中的自适应卡读取按钮操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44451640/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com