Default Welcome Intent - search
Vamos criar uma intent de pesquisa para obter o termo de pesquisa que nossos usuários desejam iniciar sua pesquisa.
Passo a passo
// See https://github.com/dialogflow/dialogflow-fulfillment-nodejs
// for Dialogflow fulfillment library docs, samples, and to report issues
"use strict";
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) {
agent.add(
`Olá, bem vindo ao app de conversação GDG Cloud. Você gostaria de procurar um organizador por 1.Name ou 2.Skill?`
);
}
function fallback(agent) {
agent.add(`Eu não entendi`);
agent.add(`Desculpe, poderia falar novamente?`);
}
function getSearchTerm(agent) {
if (agent.parameters.search_terms == 1) {
agent.add(`Qual o nome do organizador do GDG Cloud?`);
} else {
agent.add(`Qual skill você está procurando?`);
}
}
// Run the proper function handler based on the matched Dialogflow intent name
let intentMap = new Map();
intentMap.set("Default Welcome Intent", welcome);
intentMap.set("Default Fallback Intent", fallback);
intentMap.set("Default Welcome Intent - search", getSearchTerm);
agent.handleRequest(intentMap);
}
);Explicação:
Mas o que é esta tal de Follow-up intent?
Last updated