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);
});
alexaApp.intent (
'EmailIntent',
{
dialog: {
type: 'delegate',
'type': 'delegate',
},
slots: [
{
name: 'Name',
type: 'AMAZON.US_FIRST_NAME',
samples: [],
'name': 'Name',
'type': 'AMAZON.US_FIRST_NAME',
'samples': ['My name is {Name}', 'I am {Name}', '{Name}'],
},
{
name: 'Color',
type: 'AMAZON.Color',
samples:[]
'name': 'Color',
'type': 'AMAZON.Color',
'samples':['My favorite color is {Color}', '{Color}']
},
],
utterances: [

View File

@@ -56,6 +56,9 @@ var refreshTokens = function () {
var generateInteractionModel = function (skill) {
let result = {};
let allIntents = [];
let allPrompts = [];
let dialogIntents = [];
let defaultIntents = [
{
name: 'AMAZON.CancelIntent',
@@ -81,7 +84,91 @@ var generateInteractionModel = function (skill) {
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 :
/*
allIntents.push ({
name: 'EmailIntentLaunch',
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}',
],
});
*/
result.interactionModel = {};
@@ -131,6 +221,10 @@ var generateInteractionModel = function (skill) {
intents: allIntents,
};
result.interactionModel.prompts = allPrompts;
result.interactionModel.dialog = {};
result.interactionModel.dialog.intents = dialogIntents;
return JSON.stringify (result);
};