Chatbot: Are you emotionally feeling positive, negative, neutral? \User: negative.
(Unwanted response) Chatbot: okay, cancelled.
(Wanted response) Chatbot: you are feeling negative. Can you tell me more?
I use slot filling to extract the users' response from: {negative, positive, neutral}. The "positive" "neutral" are captured well. If user says "negative", it always trigger the "okay, cancelled" response.
As per this documentation when the end-user says any exit phrases like "cancel", "stop it","negative" etc. then the Dialogflow agent will reply with an "Okay Cancelled" message and clears the slot filling contexts. Sometimes instead of an "Okay Cancelled" message, other similar messages can also appear like "All right, cancelled" , "No problem, cancelling" etc.
To avoid this, instead of saying “negative” you can use similar words of negative like "Low" , "not good" , and you will get your desired response.
You can refer to the below chatbot responses screenshot :
1. problem you are facing :
2. Other similar responses :
3. Use phrases similar to the word “negative “ :
Dialogflow Agent response : “you are feeling low. Can you tell me more”
There are several words like "stop,abort,negative,exit" etc. which are used as exit phrases in Dialogflow. The list of cancelling phrases is similar to the "cancel" intent of the prebuilt smalltalk agent. To find this, go to Prebuilt Agents -> Small Talk -> Import. Then navigate to that agent and find the intent "smalltalk.cancellation.cancel"
to view the list of phrases.
If you want to add the word negative to your response, it can be possible through Fulfillment Webhook responses .
You can refer to the below steps :
"feeling positive"
"feeling negative"
"feeling neutral"
those words will be mapped with the custom entity @emotions
1. enable Webhook call for this intent
2. Enable Webhook call for slot filling
I have written the code using node.js 10
index.js
'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.slot = 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 emo(agent){
const emotions=agent.parameters[`emotions`];
agent.add(`you are feeling ` + emotions + `,Can you tell me more?`);
}
let intentMap = new Map();
intentMap.set('emotional', emo);
agent.handleRequest(intentMap);
});
package.json:
{
"name" : "slot",
"description": "This is the webhook",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
"node": "10"
},
"dependencies": {
"actions-on-google": "^2.2.0",
"firebase-admin": "^5.13.1",
"firebase-functions": "^2.0.2",
"dialogflow": "^0.6.0",
"dialogflow-fulfillment": "^0.6.1"
}
}
output :
user : "hi"
response(Default welcome Intent) : "Are you emotionally feeling positive, negative, neutral?"
user : "i am feeling negative"
response : "you are feeling negative,Can you tell me more?"