Reputation: 1086
i am developing chat bot application with google dialog flow. i am using node js client https://github.com/dialogflow/dialogflow-nodejs-client-v2 to access the data of my chat bot. i have enabled small talk from the dialog flow console and it works fine when i use it from the dialog flow web demo or the console it self
for the same chat application i have implemented a api by using dialogflow node js client.
if (req.body.text) {
query = req.body.text;
}
// Get the city and date from the request
var request = {
session: sessionPath,
queryInput: {
text: {
text: query,
languageCode: languageCode,
},
},
};
// Send request and log result
sessionClient
.detectIntent(request)
.then(responses => {
console.log('Detected intent');
const result = responses[0].queryResult;
console.log(` Query: ${result.queryText}`);
console.log(` Response: ${result.fulfillmentText}`);
if (result.intent) {
res.json({ "text": result.fulfillmentText });
} else {
res.json({ 'fulfillmentText': "No intent matched" });
console.log(` No intent matched.`);
}
})
.catch(err => {
console.error('ERROR:', err);
});
there i dont get the result i want. instead it goes to a different intent
what i have done incorrectly here..
Upvotes: 0
Views: 1148
Reputation: 589
Queries defined in Small Talk section of your Dialogflow agent will not have an associated intent. If there was a matching intent, then you shouldn't have really added that query into Small Talk. Therefore, since there is not matching intent, the Dialogflow Node library will return an unmatched intent.
Upvotes: 1