I'm trying to configure my VUI to repeat a sentence in Dialogflow when it is prompted for this. Little back story, I am helping develop a social robot for elderly so repeating a sentence is a much needed feature. I just started on this project and the previous developer responsible for this is gone and not reachable, also, I have no experience in Node.js.
I am looking to use the multivocal for this. These are the steps I have done so far:
- Created an intent called 'Repeat'.
- Added training phrases for the intent
- Added 'multivocal.repeat' as an action
- Enabled webhook call for this intent
- In Node.js added 'intentMap.set('Repeat', repeat);' to my existing intentMap
// Run the proper function handler based on the matched Dialogflow intent name
let intentMap = new Map();
intentMap.set('Game_Rock_Paper_Scissors - Result', game_stone_paper_scissors);
intentMap.set('Game_Rock_Paper_Scissors - Result - yes', game_stone_paper_scissors_again);
intentMap.set('Conversation tree', conversation_tree);
intentMap.set('Question date', question_date);
intentMap.set('Question time', question_time);
intentMap.set('Music', music);
intentMap.set('Repeat', repeat);
Next, under the 'Fulfillment' tab, I want to enter the function inside the Inline Editor 'index.js' tab and make sure in the 'package.json' that the multivocal library is installed and usable. So far, there are a few things in my package.json
"name": "dialogflowFirebaseFulfillment",
"description": "This is the default fulfillment for a Dialogflow agents using Cloud Functions for Firebase",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"author": "Google Inc.",
"engines": {
"node": "8"
},
"scripts": {
"start": "firebase serve --only functions:dialogflowFirebaseFulfillment",
"deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment"
},
"dependencies": {
"actions-on-google": "^2.2.0",
"firebase-admin": "^5.13.1",
"firebase-functions": "^2.0.2",
"dialogflow": "^0.6.0",
"dialogflow-fulfillment": "^0.5.0"
}
}
So, how do I install the library? In the Read.me is says 'You can install it using npm install --save multivocal.' But where would I install this? Do I put this somewhere in the index.js or packages.js?
Also, in this example it shows the index.js code to be:
const Color = require('./color.js');
Color.init();
const Multivocal = require('multivocal');
exports.webhook = Multivocal.processFirebaseWebhook;
Should I just add this to the end of my index.js? Or should it be wrapped in a function? Sorry to be so not experienced in this but I hope I explained it clearly.