Я пытаюсь отобразить несколько элементов с помощью action-on-google Carousel, чтобы обработать действие, связанное с кликом, мне нужно использовать функцию intent ('actions.intent.OPTION', (?,?,?)), Но выполняюэто приводит к ошибке ниже,
ERROR:
TypeError: agent.intent is not a function at exports.dialogflowFirebaseFulfillment.functions.https.onRequest
Код
const functions = require('firebase-functions');
const {
WebhookClient
} = require('dialogflow-fulfillment');
const {
Image,
Carousel,
BrowseCarousel,
BrowseCarouselItem,
} = require('actions-on-google');
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({
request,
response
});
agent.requestSource = agent.ACTIONS_ON_GOOGLE;
console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers));
console.log('Dialogflow Request body: ' + JSON.stringify(request.body));
// Run the proper function handler based on the matched Dialogflow intent name
let intentMap = new Map();
intentMap.set('Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set('video.search', searchQuery);
// intentMap.set('your intent name here', googleAssistantHandler);
agent.handleRequest(intentMap);
agent.action('actions.intent.OPTION', (conv, params, option) => {
let response = 'You did not select any item';
if (option) {
response = 'You have chosen: ' + option;
}
conv.ask(response);
});
}
Пожалуйста, помогите Если я что-то здесь упускаю?
Кроме того, мне нужно вызватьглубокая ссылка, из метода обработки намерений, есть ли способ вызвать здесь явный URI намерения глубоких ссылок?