experiment with Yes and No intents
This commit is contained in:
@@ -64,6 +64,19 @@ var generateInteractionModel = function (skill) {
|
|||||||
let result = {};
|
let result = {};
|
||||||
let allIntents = [];
|
let allIntents = [];
|
||||||
|
|
||||||
|
//Special Amazon intent
|
||||||
|
|
||||||
|
allIntents.push (
|
||||||
|
{
|
||||||
|
name: 'AMAZON.YesIntent',
|
||||||
|
samples: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'AMAZON.NoIntent',
|
||||||
|
samples: [],
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
skill.intents.map (intent => {
|
skill.intents.map (intent => {
|
||||||
allIntents.push ({name: intent.intentName, samples: intent.questions});
|
allIntents.push ({name: intent.intentName, samples: intent.questions});
|
||||||
});
|
});
|
||||||
@@ -96,8 +109,6 @@ var generateInteractionModel = function (skill) {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let customSlotTypes = [
|
let customSlotTypes = [
|
||||||
{
|
{
|
||||||
name: 'EmailSlot',
|
name: 'EmailSlot',
|
||||||
@@ -244,7 +255,7 @@ var generateInteractionModel = function (skill) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var uploadSkill = function (skill) {
|
var uploadSkill = function (skill) {
|
||||||
let generatedInteractionModel = generateInteractionModel(skill);
|
let generatedInteractionModel = generateInteractionModel (skill);
|
||||||
return fetch (
|
return fetch (
|
||||||
`https://api.amazonalexa.com/v0/skills/${skill.skillID}/interactionModel/locales/en-US`,
|
`https://api.amazonalexa.com/v0/skills/${skill.skillID}/interactionModel/locales/en-US`,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,24 +47,31 @@ module.exports = {
|
|||||||
//Defaul Amazon handlers (some of them)
|
//Defaul Amazon handlers (some of them)
|
||||||
|
|
||||||
handlers.NewSession = function () {
|
handlers.NewSession = function () {
|
||||||
this.attributes['WantToHearQuestions'] = false;
|
this.attributes['WaitingQuestions'] = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
handlers['AMAZON.YesIntent'] = function () {
|
handlers['AMAZON.YesIntent'] = function () {
|
||||||
console.log("yes intent");
|
console.log("yes intent");
|
||||||
if (this.attributes['WantToHearQuestions']) {
|
if (this.attributes['WaitingQuestions']) {
|
||||||
this.response
|
this.response
|
||||||
.speak (listOfPossibleQuestions)
|
.speak (listOfPossibleQuestions)
|
||||||
.listen(listOfPossibleQuestions);
|
.listen(constants.voiceResponseStrings.GENERIC_CONTINUE);
|
||||||
this.emit(':responseReady');
|
this.emit(':responseReady');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
handlers['AMAZON.NoIntent'] = function () {
|
||||||
|
console.log("No intent");
|
||||||
|
if (this.attributes['WaitingQuestions']) {
|
||||||
|
this.attributes['WaitingQuestions'] = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//Handler for launch request
|
//Handler for launch request
|
||||||
handlers = {
|
handlers = {
|
||||||
LaunchRequest: function () {
|
LaunchRequest: function () {
|
||||||
this.response
|
this.response
|
||||||
.speak (activeSkill.invocationAnswer)
|
.speak (activeSkill.invocationAnswer + '<break time="1s"/> Would you like to hear possible questions ?')
|
||||||
.listen (constants.voiceResponseStrings.GENERIC_CONTINUE); //Phrase from listen doesn't work !!!
|
.listen (constants.voiceResponseStrings.GENERIC_CONTINUE); //Phrase from listen doesn't work !!!
|
||||||
|
|
||||||
this.attributes['WantToHearQuestions'] = true;
|
this.attributes['WantToHearQuestions'] = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user