[英]Why is my Amazon slot returning undefined?
I'm trying to follow this tutorial here: 我正在尝试按照此教程进行操作:
https://medium.com/@itsHabib/integrate-an-amazon-lex-chatbot-into-a-react-native-app-1536883ccbed https://medium.com/@itsHabib/integrate-an-amazon-lex-chatbot-into-a-react-native-app-1536883ccbed
When I run my chatbot, the JSON is as follows: 当我运行聊天机器人时,JSON如下:
{
"dialogState": "Fulfilled",
"intentName": "MakeUsername",
"message": "Your username is mikeundefined",
"messageFormat": "PlainText",
"responseCard": null,
"sessionAttributes": {},
"slotToElicit": null,
"slots": {
"Name": "mike",
"Number": "51"
}
}
So, it looks like the number 51 is being stored. 因此,似乎正在存储数字51。
But the output function: 但是输出功能:
exports.handler = (event, context, callback) => {
console.log(event.currentIntent)
console.log(context)
let { Name: name } = event.currentIntent.slots
let { Num: number } = event.currentIntent.slots
callback(null, close({
contentType: "PlainText",
content: `Your username is ${name}${number}`
}))
}
prints out 打印出来
Your username is mikeundefined
Why is the number undefined? 为什么数字未定义?
该数字是未定义的,因为在第5行中,应将let { Number: number }
let { Num: number }
let { Number: number }
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.