【问题标题】:How to display response messege as response card in Amazon aws lex?如何在 Amazon aws lex 中将响应消息显示为响应卡?
【发布时间】:2019-05-15 16:00:41
【问题描述】:
我创建了一个简单的聊天机器人,流程如下。
机器人:你想买书吗?
人类:是的
Bot:你对什么书感兴趣? (响应卡)
-drama
-crime
-action
人类:戏剧(点击或打字)
Bot:这是商店中可用的戏剧电影列表(响应卡)
- Django
- first man
-true story
最后一部分是问题,我不知道如何实现。
有人可以帮我做些什么来得到我想要的吗?类似的演示或教程将不胜感激。
【问题讨论】:
标签:
amazon-web-services
amazon-ec2
aws-lambda
amazon-lex
【解决方案1】:
您需要在此处使用您的 Lambda 代码添加响应卡,因为值是动态的(可用电影)。
下面是添加响应卡的示例代码:
"dialogAction": {
"type": "Close",
"fulfillmentState": "Fulfilled or Failed",
"message": {
"contentType": "PlainText or SSML",
"content": "Message to convey to the user. For example, Thanks, your pizza has been ordered."
},
"responseCard": {
"version": "1",
"contentType": "application/vnd.amazonaws.card.generic",
"genericAttachments": [
{
"title":"card-title",
"subTitle":"card-sub-title",
"imageUrl":"URL of the image to be shown",
"attachmentLinkUrl":"URL of the attachment to be associated with the card",
"buttons":[
{
"text":"button-text",
"value":"Value sent to server on button click"
}
]
}
]
}
}
这是一个在 fulfimmnet 消息中添加响应卡的示例,您也可以在 elicit_slot 中添加它。尝试一下,如果您有任何困惑,请告诉我们。
希望对你有帮助。