[英]Actions on Google number genie - assistant not defined
I'm attempting the number genie example from https://developers.google.com/actions/apiai/tutorials/number-genie and I'm getting the following error when I run the code. 我正在尝试从https://developers.google.com/actions/apiai/tutorials/number-genie获取数字精灵的示例,并且在运行代码时遇到以下错误。 It's the section upto Test Your Action.
这是测试您的操作的部分。 If I comment it out then it starts fine.
如果我将其注释掉,它将开始正常。
/home/pi/numbergenie/app.js:54
assistant.handleRequest(actionMap);
ReferenceError: assistant is not defined
at Object.<anonymous> (/home/pi/numbergenie/app.js:54:1)
Any help appreciated. 任何帮助表示赞赏。
Are you sure you're running the whole code? 您确定您正在运行整个代码吗?
From the tutorial I can see that assistant is defined in this section: 从教程中,我可以看到本节中定义了助手:
app.post('/', function (request, response) {
console.log('headers: ' + JSON.stringify(request.headers));
console.log('body: ' + JSON.stringify(request.body));
const assistant = new Assistant({request: request, response: response});
response.sendStatus(200); // OK
});
So the code that uses this variable should be in this block too. 因此,使用此变量的代码也应该在此块中。 Hope it helps.
希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.