我有一个Dialogflow代理,我正在使用内联编辑器(由Firebase的Cloud Functions提供支持).当我尝试在Intent处理程序中嵌入HTTPS GET处理程序时,它会与日志条目"忽略已完成的函数中的异常"崩溃.也许有更好的方法来实现承诺,但我是新手.我可以看到它确实在升级到Blaze计划后执行外部查询,因此它不是计费帐户的限制.无论如何,这是代码:
'use strict';
const functions = require('firebase-functions');
//const rp = require('request-promise');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers));
console.log('Dialogflow Request body: ' + JSON.stringify(request.body));
function welcome(agent) {
agent.add(`Welcome to my agent!`);
}
function fallback(agent) {
agent.add(`I didn't understand`);
agent.add(`I'm sorry, can you try again?`);
}
function findWidget(agent) { …Run Code Online (Sandbox Code Playgroud) node.js firebase google-cloud-functions actions-on-google dialogflow-es