这是我的履行代码。我只想显示与财务或其他任何内容匹配的值,然后将其发送到dialogflow,但是每当我运行此代码时,我得到的只是此响应“对不起,我不知道”。
'use strict';
var https = require('https');
const functions = require('firebase-functions');
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const action = request.body.queryResult.action;
//const agent = new WebhookClient({ request, response });
response.setHeader('Content-Type', 'application/json');
if (action != 'input.getfunc1') {
response.send(buildChatResponse("I'm sorry, I don't know this"));
return;
}
const parameters = request.body.queryResult.parameters;
var c = parameters.commitee;
getfunc1(c, response);
});
function func1(c, CloudFnResponse) {
var e = {
'corporate strategy & implementation':
'CSI is a dynamic committee that is the on-ground army of Aaruush. Responsible for internal and external publicity, strategizing work-plans and executing them.',
'operations & resource management':
'Operations & Resource Management is a committee which deals with all the resources required for the team, permissions required for proper work flow of Aaruush team. ',
finance:
'The Finance Committee examines the accounts, scrutinizes the proposals for expenditures and submits the annual budget for the Aaruush. No expenditure in the budget is incurred without the prior approval of the Finance Committee',
};
var g = e[c.toLowerCase()];
var chat = g;
CloudFnResponse.send(buildChatResponse(chat));
}
function buildChatResponse(chat) {
return JSON.stringify({ fulfillmentText: chat });
}