【发布时间】:2018-05-31 15:48:25
【问题描述】:
我正在尝试使用 Actions on Google Library(用于 DialogFlow v2)中提供的 Helper Intent,但到目前为止没有任何运气。代码编译得非常好,但在执行时(在移动设备和模拟器上),调用会引发引用错误。我已经搜索了互联网地球,但到目前为止还没有运气。有什么建议吗?
我的代码(基于 https://developers.google.com/actions/assistant/helpers#confirmation 并且几乎相同)
const { dialogflow } = require('actions-on-google');
const app = dialogflow();
...
app.intent('program', conv => {
if (somestatement) {
const parameters = somedata;
conv.contexts.set(contextVariable, 1, parameters);
return conv.ask(new Confirmation('prompt!'));
}
});
抛出的错误:
ReferenceError: Confirmation is not defined
at app.intent.conv (/user_code/index.js:161:25)
at Function.<anonymous> (/user_code/node_modules/actions-on-google/dist/service/dialogflow/dialogflow.js:146:23)
at next (native)
at /user_code/node_modules/actions-on-google/dist/service/dialogflow/dialogflow.js:22:71
at __awaiter (/user_code/node_modules/actions-on-google/dist/service/dialogflow/dialogflow.js:18:12)
at Function.handler (/user_code/node_modules/actions-on-google/dist/service/dialogflow/dialogflow.js:84:16)
at Object.<anonymous> (/user_code/node_modules/actions-on-google/dist/assistant.js:55:32)
at next (native)
at /user_code/node_modules/actions-on-google/dist/assistant.js:22:71
at __awaiter (/user_code/node_modules/actions-on-google/dist/assistant.js:18:12)
我也在使用最新的 actions-on-google 依赖项:
"dependencies": {
"actions-on-google": "^2.1.2",
"firebase-admin": "^5.12.1",
"firebase-functions": "^1.0.3",
"sprintf-js": "^1.1.1"
}
我什至将新的 Confirmation() 助手更改为任何其他助手,但没有运气。在 DialogFlow 方面,我有上面相同文档链接所要求的意图。
非常感谢任何帮助!
【问题讨论】:
标签: node.js actions-on-google dialogflow-es