Я тестировал новый код в соответствии с v2. Ссылка: Создайте свое первое приложение с Dialogflow
код:
'use strict';
const {dialogflow} = require('actions-on-google');
const functions = require('firebase-functions');
const app = dialogflow({debug: true});
app.intent('Default Welcome Intent', conv => {
console.log("-----welcome intent-----");
conv.ask('Welcome');
});
exports.testMain = functions.https.onRequest(app);
Но когда я имитирую это, он показывает:
MalformedResponse
'final_response' must be set.
Что я могу сделать?
Запрос не достигает функции, хотя выполнение выполнено.
--------- ОБНОВЛЕНО ------------
теперь я получаю эту ошибку при попытке развернуть функцию в firebase:
Function load error: Code in file index.js can't be loaded
Is there a syntax error in your code?
Detailed stack trace: TypeError: dialogflow is not a funct
at Object.<anonymous> (/user_code/index.js:6:13)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at getUserFunction (/var/tmp/worker/worker.js:388:24)
at loadUserCode (/var/tmp/worker/worker.js:444:18)
Я не могу понять ???
Вот мой package.json:
{
"name": "some name",
"description": "some desc",
"version": "0.0.1",
"author": "Google Inc.",
"engines": {
"node": "~4.2"
},
"dependencies": {
"actions-on-google": "^1.0.0",
"firebase-admin": "^5.11.0",
"firebase-functions": "^1.0.0",
"dialogflow": "^0.3.0",
"request": "^2.85.0",
"uuid": "^3.0.1"
}
}
------ обновление 2 ------
Я изменил узел на:
"engines": {
"node": "~6.0"
все та же проблема
----- Обновление 3 --------
Развертывание завершено, но когда запрос переходит к нему, он показывает: