【发布时间】:2021-03-09 07:50:10
【问题描述】:
我正在使用 Dialogflow 为 Google 助理创建一个操作。我正在关注本教程:https://medium.com/voice-tech-podcast/get-current-location-of-a-user-using-helper-intents-in-actions-on-google-19fe9a8ea99f
当我在第 5 步中使用命令 firebase deploy 时,得到的输出如下:
=== Deploying to 'location-tracker-xxxx'...
i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint
> lint
> eslint .
✔ functions: Finished running predeploy script.
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔ functions: required API cloudbuild.googleapis.com is enabled
✔ functions: required API cloudfunctions.googleapis.com is enabled
i functions: preparing functions directory for uploading...
✔ Deploy complete!
Project Console: https://console.firebase.google.com/project/location-tracker-xxxx/overview
我应该获得可以在 Dialogflow 中用作 webhook URL 的 Webhook URL。
这是我的 index.js:
const functions = require("firebase-functions");
const { dialogflow, Permission, SimpleResponse } = require("actions-on-google");
const app = dialogflow();
app.intent("Default Welcome Intent", conv => {
conv.data.requestedPermission = "DEVICE_PRECISE_LOCATION";
conv.ask(new SimpleResponse('Welcome to location tracker'));
return conv.ask(
new Permission({
context: "to locate you",
permissions: conv.data.requestedPermission
})
);
});
我已阅读此Stackoverflow,但它并没有解决我的问题,因为没有显示解决方案是科学的,所引用的代码不再可用。
谢谢!
【问题讨论】:
-
没有部署任何函数,因为您从未定义和导出过任何函数。仅定义对话流应用程序是不够的。
-
您好,Doug,感谢您的回答!我还是很菜鸟,应该怎么定义?
-
@DougStevenson 我尝试了几件事,但仍然无法正常工作..
标签: javascript google-cloud-functions dialogflow-es actions-on-google dialogflow-es-fulfillment