amazon-web-services - 亚马逊 lex 响应中的反序列化错误
问题描述
我已将 Amazon Lex 与 Amazon Lambda 连接,我测试了 Amazon Lambda,它按预期工作。
我从 Amazon Lambda 得到以下响应(使用云手表测试):
{'sessionAttributes': {}, 'dialogAction': {'type': 'ElicitSlot', 'intentName': 'paymentdue', 'slots': {}, 'slotToElicit': '', 'message': 'This is a test message', 'responseCard': '', 'fulfillmentState': 'Fulfilled'}}
但我从 amazon lex 收到以下错误:这里可能是什么问题?
An error has occurred: Invalid Lambda Response: Received invalid response from Lambda:
Can not construct instance of Message: no String-argument constructor/factory method to deserialize from String value
('This is a test message') at [Source: {"sessionAttributes": {}, "dialogAction": {"type": "ElicitSlot", "intentName": "paymentdue", "slots": {}, "slotToElicit": "", "message": "This is a test message", "responseCard": "", "fulfillmentState": "Fulfilled"}}; line: 1, column: 138]
有人可以让我知道这个问题吗?
谢谢,
哈利
解决方案
当响应类型为ElicitSlot
时,Lex 期望看到message
如下字段:
"message": {
"contentType": "PlainText or SSML or CustomPayload",
"content": "Message to convey to the user. For example, What size pizza would you like?"
}
您的响应是一个字符串,而不是一个对象。请参阅此处了解更多信息。
推荐阅读
- flutter - 将标题和副标题添加到 Listview
- julia - 为什么这个for循环不能运行两次?(朱莉娅)
- javascript - 如果从 props 传递,Sass 变量将不起作用
- xposed - Xposed:如何以 My Xposed Module 的名义调用方法?
- arrays - 如何从对象中提取密钥?
- javascript - 如何使用javascript从html表中删除空白行(tr)
- python - 在 pandas python 列中追加循环输出
- shell - 如何使用 Windows 批处理文件或 vbs 脚本一次将多个文件 1 从 2 个文件夹复制到另一个文件夹
- javascript - 隐藏按钮将在输入值文本后立即显示,无需按任何按钮
- vue.js - 如何删除以下 npm install 错误?