Я обращаюсь к веб-службе покоя из диалогового потока, но не могу получить ответ.
Я даже указал вариант выставления счетов, но по-прежнему не могу получить ответ.
КакЯ не получаю никакой ошибки в журналах, есть ли ошибка в моем коде?
'use strict';
var http = require('http');
const functions = require('firebase-functions');
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) {
const jsonObject = JSON.stringify({
".... : "...",
".....": "....",
"....": ".....",
".....": "......",
"....": "..."
});
const header = {
'.....': '......',
'.....': '.......',
'Content-Type': 'application/json'
};
agent.add(`i am welcome agent!2`);
const optionspost = {
host: '.....',
path: '.....',
method: 'POST',
headers: header
};
agent.add(`i am welcome agent!3`);
var req = http.request({
optionspost,
jsonObject
}, function(res) {
agent.add(`i am welcome agent!5`);
agent.add(req);
});
req.end();
}
function fallback(agent) {
agent.add(`I didn't understand`);
agent.add(`I'm sorry, can you try again?`);
}
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
agent.handleRequest(intentMap);
});
программа не идет в запросе и не выводит сообщение "Я доброжелательный агент! 5"
Ответ:
![this is rsponse](https://i.stack.imgur.com/CqRS6.png)