【发布时间】:2018-02-28 05:40:43
【问题描述】:
我正在尝试使用 AWS Lex 开发聊天机器人。但不幸的是,我在 Lex 上构建聊天时遇到了错误。我正在使用一个意图和 2 个插槽。由于某种原因,当lambda函数连接到聊天时,槽的第二个值被保存为null。但是当我在 lambda 作为测试用例运行它时,它是成功的。
现在,我要做的就是在输入槽的详细信息后显示一条响应消息。
这是我的代码
public class LexBot implements RequestHandler<Map<String, Object>, Object> {
@Override
public Object handleRequest(Map<String, Object> input, Context context) {
// LexRequest lexRequest = LexRequestFactory.createLexRequest(input);
String content = "Request came from the bot: ";
Message message = new Message("PlainText", content);
DialogAction dialogAction = new DialogAction("Close", "Fullfiled", message);
return new LexRespond(dialogAction);
}
}
这是我在 AWS Lex 中遇到的错误:
发生错误:无效的 Lambda 响应:收到无效 来自 Lambda 的响应:无法构造消息实例,问题: 内容在 [来源: {"dialogAction":{"type":"Close","message":{"contentType":"PlainText","some_respond_message":"请求 来自机器人:“}}};行:1,列:122]
【问题讨论】:
标签: amazon-web-services aws-lambda amazon-lex