【发布时间】:2019-07-29 18:09:09
【问题描述】:
我尝试使用 AWS Lambda 函数为 AWS Lex 添加多个响应,但我遇到了这个错误。
但我被消息卡住了
发生错误:无效的 Lambda 响应:收到来自 Lambda 的无效响应:无法构造消息实例,问题:contentType 在 [Source: {"dialogAction": {"type": "ConfirmIntent", "message": {"messages": [{"contentType": "PlainText", "group": 1, "content": "Hello"}, {"contentType": "PlainText", "group": 2, " content": "My"}, {"contentType": "PlainText", "group": 3, "content": "Friend"}]}, "intentName": "CardsI", "slots": {"CardsB" : 无效的}}};行:1,列:252]
在 Lambda 函数中,我们使用以下代码打印多个响应
return {
"dialogAction": {
"type": "ConfirmIntent",
"message": {
"messages": [{
"contentType": "PlainText",
"group": 1,
"content": "Hello"
},
{
"contentType": "PlainText",
"group": 2,
"content": "My"
},
{
"contentType": "PlainText",
"group": 3,
"content": "Friend"
}
]
},
"intentName": "CardsI",
"slots": {
"CardsB": ""
}
}
}
我们甚至浏览了诸如
之类的文档https://docs.aws.amazon.com/lex/latest/dg/howitworks-manage-prompts.html#message-groups
https://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html#special-response
但我们仍然面临问题。有什么帮助吗?
【问题讨论】:
标签: python amazon-web-services aws-lambda chatbot amazon-lex