change utterances to correct form;change intents to mimic dialog;
This commit is contained in:
@@ -8,8 +8,8 @@ config.REFRESH_TOKEN = 'Atzr|IwEBICA3kDhfSJxlwvnQp9AD1o115AC_KBbFd5GBg8oN_QHWn2o
|
|||||||
config.TOKEN_EXPIRES_IN = 1515100500;
|
config.TOKEN_EXPIRES_IN = 1515100500;
|
||||||
|
|
||||||
config.SKILL_ID = 'amzn1.ask.skill.efbf0564-a732-4ba9-958f-57939138adae';
|
config.SKILL_ID = 'amzn1.ask.skill.efbf0564-a732-4ba9-958f-57939138adae';
|
||||||
//config.SKILL_DB_ID = '5a5016e775becaef2015da10'; //for server
|
config.SKILL_DB_ID = '5a5016e775becaef2015da10'; //for server
|
||||||
config.SKILL_DB_ID = '5a232fb86ce046c749739455'; //for local
|
//config.SKILL_DB_ID = '5a232fb86ce046c749739455'; //for local
|
||||||
|
|
||||||
config.CLIENT_ID = 'amzn1.application-oa2-client.c748ca56ded04a95b236979898585ff7';
|
config.CLIENT_ID = 'amzn1.application-oa2-client.c748ca56ded04a95b236979898585ff7';
|
||||||
config.CLIENT_SECRET = '6dea8125cecd049d3c4cff7bb5bdfd3ff17bc6fed246c4c8f6b519d9ed08d0b3';
|
config.CLIENT_SECRET = '6dea8125cecd049d3c4cff7bb5bdfd3ff17bc6fed246c4c8f6b519d9ed08d0b3';
|
||||||
|
|||||||
@@ -92,25 +92,27 @@ var updateIntentsJSON = function () {
|
|||||||
//This is problem only if we introduce slot options for regular intents for users
|
//This is problem only if we introduce slot options for regular intents for users
|
||||||
alexaApp.intent('EmailIntent',{
|
alexaApp.intent('EmailIntent',{
|
||||||
slots:{
|
slots:{
|
||||||
'Name':'AMAZON.Person',
|
'Name':'AMAZON.US_FIRST_NAME',
|
||||||
'Email' : 'AMAZON.LITERAL',
|
'Email' : 'AMAZON.LITERAL',
|
||||||
'Message': 'AMAZON.LITERAL',
|
'Message': 'AMAZON.LITERAL',
|
||||||
'Data': 'AMAZON.LITERAL'
|
'Data': 'AMAZON.LITERAL'
|
||||||
},
|
},
|
||||||
utterances: [
|
utterances: [
|
||||||
'My name is {Name}',
|
'My name is {-|Name}',
|
||||||
'I am {Name}',
|
'I am {-|Name}',
|
||||||
'{Data}',
|
'{dawdw at dwd wdw|Data}',
|
||||||
'My email is {Email}',
|
'My email is {wadwwdw at wadwwd wdw|Email}',
|
||||||
'Send replay to {Email}',
|
'Send replay to {fkofkeofe at dppfam wd|Email}',
|
||||||
'My message is {Message}'
|
'My message is {Quick brown fox jumps over lazy dog|Message}'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
function(request,response){
|
function(request,response){
|
||||||
if (!Name) Name = response.slots['Name'];
|
let Data = undefined;
|
||||||
if (!Email) Email = response.slots['Email'];
|
try{if (!Name) Name = request.slot('Name');}catch(e){console.log('Error. No name slot ');Name=undefined;}
|
||||||
if (!Message) Message = response.slots['Message'];
|
try{if (!Email) Email = request.slot('Email');}catch(e){console.log('Error. No Email slot');Email=undefined;}
|
||||||
let Data = reponse.slots['Data'];
|
try{if (!Message) Message = request.slot('Message');}catch(e){console.log('Error. No Message slot');Message=undefined;}
|
||||||
|
try{Data = request.slot('Data');}catch(e){console.log('Error. No Data slot');Data=undefined;}
|
||||||
|
console.log('State : ' + State);
|
||||||
|
|
||||||
//TODO : Responses could be configurable for each skill ?
|
//TODO : Responses could be configurable for each skill ?
|
||||||
|
|
||||||
@@ -118,6 +120,7 @@ var updateIntentsJSON = function () {
|
|||||||
//Was waiting for name, so if Name is null, name is probably in Data
|
//Was waiting for name, so if Name is null, name is probably in Data
|
||||||
if ((!Name && Data) || Name){
|
if ((!Name && Data) || Name){
|
||||||
//got the name, let's continue for the email
|
//got the name, let's continue for the email
|
||||||
|
if (!Name) Name = Data;
|
||||||
State = 2;
|
State = 2;
|
||||||
return response.say('Ok ' + Name + '. What is your email ?').shouldEndSession(false);
|
return response.say('Ok ' + Name + '. What is your email ?').shouldEndSession(false);
|
||||||
}else{
|
}else{
|
||||||
@@ -128,7 +131,7 @@ var updateIntentsJSON = function () {
|
|||||||
//was waiting for email, so if Email is null, email is probably in Data
|
//was waiting for email, so if Email is null, email is probably in Data
|
||||||
if ((!Email && Data) || Email){
|
if ((!Email && Data) || Email){
|
||||||
//Got the email, first verify email and than continue to message
|
//Got the email, first verify email and than continue to message
|
||||||
|
if (!Email) Email = Data;
|
||||||
//TODO : verify email
|
//TODO : verify email
|
||||||
State = 3;
|
State = 3;
|
||||||
return response.say('Great. Whats the message ?').shouldEndSession(false);
|
return response.say('Great. Whats the message ?').shouldEndSession(false);
|
||||||
@@ -140,11 +143,18 @@ var updateIntentsJSON = function () {
|
|||||||
//Was waiting for message, so if Message is null, message is probably in Data
|
//Was waiting for message, so if Message is null, message is probably in Data
|
||||||
if ((!Message && Data) || Message){
|
if ((!Message && Data) || Message){
|
||||||
//Ok, we got all informations. Exit email intent
|
//Ok, we got all informations. Exit email intent
|
||||||
|
if (!Message) Message=Data;
|
||||||
State = 0;
|
State = 0;
|
||||||
//TODO : Send email
|
//TODO : Send email
|
||||||
|
console.log('Name : ' + Name + ' | Email : ' + Email + ' | Message : ' + Message);
|
||||||
return response.say('Message sent. Someone will contact you ASAP');
|
return response.say('Message sent. Someone will contact you ASAP');
|
||||||
}
|
}else{
|
||||||
}
|
//Something is wrong, ask for the message again
|
||||||
|
return response.say('Sorry, I didnt understand your message. Can you say it again ?').shouldEndSession(false);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
console.log('State strange ! ' + State);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -197,6 +207,7 @@ router.post ('/updateSkill/:id', async (req, res, next) => {
|
|||||||
if (id !== '-1') {
|
if (id !== '-1') {
|
||||||
if (updateOnAmazon){
|
if (updateOnAmazon){
|
||||||
amazonHelper.updateSkill(skill).then(amazonResult=>{
|
amazonHelper.updateSkill(skill).then(amazonResult=>{
|
||||||
|
console.log('Amazon : ' + amazonResult);
|
||||||
if (amazonResult === 200 || amazonResult === 202) {
|
if (amazonResult === 200 || amazonResult === 202) {
|
||||||
//Skill uploaded, it's ok to update databaseI
|
//Skill uploaded, it's ok to update databaseI
|
||||||
databaseHelper
|
databaseHelper
|
||||||
@@ -208,7 +219,9 @@ router.post ('/updateSkill/:id', async (req, res, next) => {
|
|||||||
.catch (e => {
|
.catch (e => {
|
||||||
res.json ({result: -1, message: 'error'});
|
res.json ({result: -1, message: 'error'});
|
||||||
});
|
});
|
||||||
}
|
}else{
|
||||||
|
res.json({result: -1, message: 'amazon error : ' + amazonResult});
|
||||||
|
}
|
||||||
}).catch(e=>{
|
}).catch(e=>{
|
||||||
res.json ({result: -1, message: e});
|
res.json ({result: -1, message: e});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ var refreshTokens = function () {
|
|||||||
parsedResponse.access_token,
|
parsedResponse.access_token,
|
||||||
parsedResponse.expires_in
|
parsedResponse.expires_in
|
||||||
);
|
);
|
||||||
|
console.log('Token refresh failed');
|
||||||
|
console.log(body);
|
||||||
|
reject(body);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -81,6 +84,7 @@ var generateInteractionModel = function (skill) {
|
|||||||
allIntents.push ({name: intent.intentName, samples: intent.questions});
|
allIntents.push ({name: intent.intentName, samples: intent.questions});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//Special Email Intents :
|
//Special Email Intents :
|
||||||
allIntents.push({
|
allIntents.push({
|
||||||
name: 'EmailIntentLaunch',
|
name: 'EmailIntentLaunch',
|
||||||
@@ -92,34 +96,38 @@ var generateInteractionModel = function (skill) {
|
|||||||
'Leave a message'
|
'Leave a message'
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
allIntents.push({
|
allIntents.push({
|
||||||
name: 'EmailIntent',
|
name: 'EmailIntent',
|
||||||
slots:[
|
slots:[
|
||||||
{
|
{
|
||||||
name: 'Name',
|
'name': 'Name',
|
||||||
type: 'AMAZON.Person'
|
'type': 'AMAZON.US_FIRST_NAME'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Email',
|
'name': 'Email',
|
||||||
type: 'AMAZON.LITERAL'
|
'type': 'AMAZON.LITERAL'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Message',
|
'name': 'Message',
|
||||||
type: 'AMAZON.LITERAL'
|
'type': 'AMAZON.LITERAL'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Data',
|
'name': 'Data',
|
||||||
type: 'AMAZON.LITERAL'
|
'type': 'AMAZON.LITERAL'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
samples: [
|
samples: [
|
||||||
'My name is {Name}',
|
'My name is {Name}',
|
||||||
'I am {Name}',
|
'I am {Name}',
|
||||||
'{Data}',
|
'{exampleww at wwdwdw|Data}',
|
||||||
'My email is {Email}',
|
'My email is {example at efefegedd|Email}',
|
||||||
'Send replay to {Email}',
|
'Send replay to {example at abcdefg|Email}',
|
||||||
'My message is {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 = {};
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class App extends Component {
|
|||||||
constructor(props){
|
constructor(props){
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state={_id:'5a232fb86ce046c749739455',
|
this.state={_id:'5a5016e775becaef2015da10',
|
||||||
skillID:'',
|
skillID:'',
|
||||||
skillName:'',
|
skillName:'',
|
||||||
invocationName:'Saburly',
|
invocationName:'Saburly',
|
||||||
@@ -181,6 +181,7 @@ class App extends Component {
|
|||||||
updateSkill(this.createSkill(newAllIntents,newName,newAnswer,email,updateOnAmazon)).then(l=>l.text()).then(result=>{
|
updateSkill(this.createSkill(newAllIntents,newName,newAnswer,email,updateOnAmazon)).then(l=>l.text()).then(result=>{
|
||||||
let jResult = JSON.parse(result);
|
let jResult = JSON.parse(result);
|
||||||
if (jResult.result !== 0){
|
if (jResult.result !== 0){
|
||||||
|
console.log(jResult.result);
|
||||||
if (showPopUp) Popup.alert('Model was not saved. Please try again');
|
if (showPopUp) Popup.alert('Model was not saved. Please try again');
|
||||||
this.setState(rejectState);
|
this.setState(rejectState);
|
||||||
//reject('Error code : ' + jResult.result);
|
//reject('Error code : ' + jResult.result);
|
||||||
@@ -190,6 +191,7 @@ class App extends Component {
|
|||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
}).catch(e=>{
|
}).catch(e=>{
|
||||||
|
console.log('error : ' + e);
|
||||||
if (showPopUp) Popup.alert('Model was not saved. Please try again');
|
if (showPopUp) Popup.alert('Model was not saved. Please try again');
|
||||||
this.setState(rejectState);
|
this.setState(rejectState);
|
||||||
//reject(e);
|
//reject(e);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export const BASE_URL = 'localhost:5000';
|
export const BASE_URL = 'tellall.saburly.com';
|
||||||
|
|
||||||
export const INTENT_NAME_MAX_LENGTH = 30;
|
export const INTENT_NAME_MAX_LENGTH = 30;
|
||||||
export const QUESTION_MAX_LENGTH = 150;
|
export const QUESTION_MAX_LENGTH = 150;
|
||||||
|
|||||||
Reference in New Issue
Block a user