Compare commits
3 Commits
master
...
dialog-imp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ccc0c6ca2 | ||
|
|
554a16794d | ||
|
|
c731f7597c |
@@ -42,7 +42,7 @@ module.exports = {
|
|||||||
slots: [],
|
slots: [],
|
||||||
utterances: intent.questions,
|
utterances: intent.questions,
|
||||||
},
|
},
|
||||||
function (request, response) {
|
(request, response) => {
|
||||||
return response.say (intent.answer).shouldEndSession (false);
|
return response.say (intent.answer).shouldEndSession (false);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -52,6 +52,56 @@ module.exports = {
|
|||||||
return response.say (skill.invocationAnswer).shouldEndSession (false);
|
return response.say (skill.invocationAnswer).shouldEndSession (false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
alexaApp.intent (
|
||||||
|
'EmailIntent',
|
||||||
|
{
|
||||||
|
dialog: {
|
||||||
|
'type': 'delegate',
|
||||||
|
},
|
||||||
|
slots: [
|
||||||
|
{
|
||||||
|
name:'Name',
|
||||||
|
type:'AMAZON.US_FIRST_NAME',
|
||||||
|
samples:[
|
||||||
|
'My name is {-|Name}',
|
||||||
|
'I am {-|Name}',
|
||||||
|
'{-|Name}'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Email",
|
||||||
|
"type": "emailSlot",
|
||||||
|
"samples": [
|
||||||
|
"{blablablabla@blablabla.blabla.blabla|Email}",
|
||||||
|
"My email is {blablablabla@blablabla.blabla.blabla|Email}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Message",
|
||||||
|
"type": "emailMessage",
|
||||||
|
"samples": [
|
||||||
|
"{Quick brown fox jumps over lazy dog. Quick brown fox jumps over lazy dog. Quick brown fox jumps over lazy dog.|Message}",
|
||||||
|
"My message is {Quick brown fox jumps over lazy dog. Quick brown fox jumps over lazy dog. Quick brown fox jumps over lazy dog.|Message}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
utterances: [
|
||||||
|
'I would like to send a message',
|
||||||
|
'I want to send a message',
|
||||||
|
'Send message',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
(request, response) => {
|
||||||
|
console.log('Name : ' + request.slot('Name'));
|
||||||
|
console.log('Color : ' + request.slot('Color'));
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
alexaApp.intent (
|
alexaApp.intent (
|
||||||
'EmailIntentLaunch',
|
'EmailIntentLaunch',
|
||||||
{
|
{
|
||||||
@@ -193,6 +243,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
})
|
})
|
||||||
.catch (err => {
|
.catch (err => {
|
||||||
console.log (err);
|
console.log (err);
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ var refreshTokens = function () {
|
|||||||
var generateInteractionModel = function (skill) {
|
var generateInteractionModel = function (skill) {
|
||||||
let result = {};
|
let result = {};
|
||||||
let allIntents = [];
|
let allIntents = [];
|
||||||
|
let allPrompts = [];
|
||||||
|
let dialogIntents = [];
|
||||||
|
let allTypes = [];
|
||||||
|
|
||||||
let defaultIntents = [
|
let defaultIntents = [
|
||||||
{
|
{
|
||||||
name: 'AMAZON.CancelIntent',
|
name: 'AMAZON.CancelIntent',
|
||||||
@@ -81,7 +85,154 @@ 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": "Email",
|
||||||
|
"type": "emailSlot",
|
||||||
|
"samples": [
|
||||||
|
"{Email}",
|
||||||
|
"My email is {Email}"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Message",
|
||||||
|
"type": "emailMessage",
|
||||||
|
"samples": [
|
||||||
|
"{Message}",
|
||||||
|
"My message is {Message}"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
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": "What is your email"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PlainText",
|
||||||
|
"value": "Tell me your email"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
allPrompts.push(
|
||||||
|
{
|
||||||
|
"id": "Elicit.Intent-EmailIntent.IntentSlot-Message",
|
||||||
|
"variations": [
|
||||||
|
{
|
||||||
|
"type": "PlainText",
|
||||||
|
"value": "What is your message ?"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PlainText",
|
||||||
|
"value": "What is the message ?"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
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": "Email",
|
||||||
|
"type": "emailSlot",
|
||||||
|
"elicitationRequired": true,
|
||||||
|
"confirmationRequired": false,
|
||||||
|
"prompts": {
|
||||||
|
"elicitation": "Elicit.Intent-EmailIntent.IntentSlot-Email"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Message",
|
||||||
|
"type": "emailMessage",
|
||||||
|
"elicitationRequired": true,
|
||||||
|
"confirmationRequired": false,
|
||||||
|
"prompts": {
|
||||||
|
"elicitation": "Elicit.Intent-EmailIntent.IntentSlot-Message"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
allTypes.push(
|
||||||
|
{
|
||||||
|
"name": "emailMessage",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"id": null,
|
||||||
|
"name": {
|
||||||
|
"value": "Quick brown fox jumps over lazy dog. Quick brown fox jumps over lazy dog. Quick brown fox jumps over lazy dog.",
|
||||||
|
"synonyms": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
allTypes.push(
|
||||||
|
{
|
||||||
|
"name": "emailSlot",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"id": null,
|
||||||
|
"name": {
|
||||||
|
"value": "blablablabla@blablabla.blabla.blabla",
|
||||||
|
"synonyms": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Special Email Intents :
|
//Special Email Intents :
|
||||||
|
/*
|
||||||
allIntents.push ({
|
allIntents.push ({
|
||||||
name: 'EmailIntentLaunch',
|
name: 'EmailIntentLaunch',
|
||||||
slots: [],
|
slots: [],
|
||||||
@@ -123,6 +274,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 +285,11 @@ var generateInteractionModel = function (skill) {
|
|||||||
intents: allIntents,
|
intents: allIntents,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
result.interactionModel.types = allTypes;
|
||||||
|
result.interactionModel.prompts = allPrompts;
|
||||||
|
result.interactionModel.dialog = {};
|
||||||
|
result.interactionModel.dialog.intents = dialogIntents;
|
||||||
|
|
||||||
return JSON.stringify (result);
|
return JSON.stringify (result);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user