dialog test

This commit is contained in:
GotPPay
2018-01-18 07:38:09 +01:00
parent c731f7597c
commit 554a16794d
2 changed files with 104 additions and 7 deletions

View File

@@ -52,22 +52,25 @@ module.exports = {
return response.say (skill.invocationAnswer).shouldEndSession (false); return response.say (skill.invocationAnswer).shouldEndSession (false);
}); });
alexaApp.intent ( alexaApp.intent (
'EmailIntent', 'EmailIntent',
{ {
dialog: { dialog: {
type: 'delegate', 'type': 'delegate',
}, },
slots: [ slots: [
{ {
name: 'Name', 'name': 'Name',
type: 'AMAZON.US_FIRST_NAME', 'type': 'AMAZON.US_FIRST_NAME',
samples: [], 'samples': ['My name is {Name}', 'I am {Name}', '{Name}'],
}, },
{ {
name: 'Color', 'name': 'Color',
type: 'AMAZON.Color', 'type': 'AMAZON.Color',
samples:[] 'samples':['My favorite color is {Color}', '{Color}']
}, },
], ],
utterances: [ utterances: [

View File

@@ -56,6 +56,9 @@ var refreshTokens = function () {
var generateInteractionModel = function (skill) { var generateInteractionModel = function (skill) {
let result = {}; let result = {};
let allIntents = []; let allIntents = [];
let allPrompts = [];
let dialogIntents = [];
let defaultIntents = [ let defaultIntents = [
{ {
name: 'AMAZON.CancelIntent', name: 'AMAZON.CancelIntent',
@@ -81,7 +84,91 @@ var generateInteractionModel = function (skill) {
allIntents.push ({name: intent.intentName, samples: intent.questions}); allIntents.push ({name: intent.intentName, samples: intent.questions});
}); });
allIntents.push({
name:'EmailIntent',
samples:['I would like to send a message', 'I want to send a message', 'Send a message'],
slots:[
{
name:'Name',
type:'AMAZON.US_FIRST_NAME',
samples:[
'My name is {Name}',
'I am {Name}',
'{Name}'
]
},
{
"name": "Color",
"type": "AMAZON.Color",
"samples": [
"{Color}",
"My favorite color is {Color}"
]
}
]
});
allPrompts.push(
{
"id": "Elicit.Intent-EmailIntent.IntentSlot-Name",
"variations": [
{
"type": "PlainText",
"value": "What is your name ?"
}
]
}
);
allPrompts.push(
{
"id": "Elicit.Intent-EmailIntent.IntentSlot-Color",
"variations": [
{
"type": "PlainText",
"value": "Tell me your favorite color"
},
{
"type": "PlainText",
"value": "What is your favorite color"
}
]
}
);
dialogIntents.push(
{
"name": "EmailIntent",
"confirmationRequired": false,
"prompts": {},
"slots": [
{
"name": "Name",
"type": "AMAZON.US_FIRST_NAME",
"elicitationRequired": true,
"confirmationRequired": false,
"prompts": {
"elicitation": "Elicit.Intent-EmailIntent.IntentSlot-Name"
}
},
{
"name": "Color",
"type": "AMAZON.Color",
"elicitationRequired": true,
"confirmationRequired": false,
"prompts": {
"elicitation": "Elicit.Intent-EmailIntent.IntentSlot-Color"
}
}
]
}
);
//Special Email Intents : //Special Email Intents :
/*
allIntents.push ({ allIntents.push ({
name: 'EmailIntentLaunch', name: 'EmailIntentLaunch',
slots: [], slots: [],
@@ -123,6 +210,9 @@ var generateInteractionModel = function (skill) {
'My message is {The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.|Message}', 'My message is {The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.The quick brown fox jumps over the lazy dog.|Message}',
], ],
}); });
*/
result.interactionModel = {}; result.interactionModel = {};
@@ -131,6 +221,10 @@ var generateInteractionModel = function (skill) {
intents: allIntents, intents: allIntents,
}; };
result.interactionModel.prompts = allPrompts;
result.interactionModel.dialog = {};
result.interactionModel.dialog.intents = dialogIntents;
return JSON.stringify (result); return JSON.stringify (result);
}; };