Я использую код ниже.То, что я пытаюсь сделать, это выбрать параметр с полным заполнением в диалоге, а затем использовать его в ответе пользователю.Это работает, но я не вижу предложение, и я получаю ошибку ниже (в симуляторе) Что я сделал не так?
Я также получаю эту ошибку:
MalformedResponse
expected_inputs[0].input_prompt.rich_initial_prompt: 'item[1]' must not be empty.
Этомой код:
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
//const {Card, Suggestion} = require('dialogflow-fulfillment');
const {
dialogflow,
BasicCard,
BrowseCarousel,
BrowseCarouselItem,
Button,
Carousel,
Image,
LinkOutSuggestion,
List,
MediaObject,
Suggestions,
SimpleResponse,
} = require('actions-on-google');
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 emojify(agent) {
let conv = agent.conv();
conv.ask("Test response:" + request.body.queryResult.parameters.sentence);
conv.ask(new Suggestions('The cat likes fish'));
agent.add(conv);
}
// Run the proper function handler based on the matched Dialogflow intent name
let intentMap = new Map();
intentMap.set('Emojify', emojify);
agent.handleRequest(intentMap);
});
![enter image description here](https://i.stack.imgur.com/3o84A.png)
![enter image description here](https://i.stack.imgur.com/84ZEN.png)