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.SKILL_ID = 'amzn1.ask.skill.efbf0564-a732-4ba9-958f-57939138adae';
|
||||
//config.SKILL_DB_ID = '5a5016e775becaef2015da10'; //for server
|
||||
config.SKILL_DB_ID = '5a232fb86ce046c749739455'; //for local
|
||||
config.SKILL_DB_ID = '5a5016e775becaef2015da10'; //for server
|
||||
//config.SKILL_DB_ID = '5a232fb86ce046c749739455'; //for local
|
||||
|
||||
config.CLIENT_ID = 'amzn1.application-oa2-client.c748ca56ded04a95b236979898585ff7';
|
||||
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
|
||||
alexaApp.intent('EmailIntent',{
|
||||
slots:{
|
||||
'Name':'AMAZON.Person',
|
||||
'Name':'AMAZON.US_FIRST_NAME',
|
||||
'Email' : 'AMAZON.LITERAL',
|
||||
'Message': 'AMAZON.LITERAL',
|
||||
'Data': 'AMAZON.LITERAL'
|
||||
},
|
||||
utterances: [
|
||||
'My name is {Name}',
|
||||
'I am {Name}',
|
||||
'{Data}',
|
||||
'My email is {Email}',
|
||||
'Send replay to {Email}',
|
||||
'My message is {Message}'
|
||||
'My name is {-|Name}',
|
||||
'I am {-|Name}',
|
||||
'{dawdw at dwd wdw|Data}',
|
||||
'My email is {wadwwdw at wadwwd wdw|Email}',
|
||||
'Send replay to {fkofkeofe at dppfam wd|Email}',
|
||||
'My message is {Quick brown fox jumps over lazy dog|Message}'
|
||||
]
|
||||
},
|
||||
function(request,response){
|
||||
if (!Name) Name = response.slots['Name'];
|
||||
if (!Email) Email = response.slots['Email'];
|
||||
if (!Message) Message = response.slots['Message'];
|
||||
let Data = reponse.slots['Data'];
|
||||
let Data = undefined;
|
||||
try{if (!Name) Name = request.slot('Name');}catch(e){console.log('Error. No name slot ');Name=undefined;}
|
||||
try{if (!Email) Email = request.slot('Email');}catch(e){console.log('Error. No Email slot');Email=undefined;}
|
||||
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 ?
|
||||
|
||||
@@ -118,6 +120,7 @@ var updateIntentsJSON = function () {
|
||||
//Was waiting for name, so if Name is null, name is probably in Data
|
||||
if ((!Name && Data) || Name){
|
||||
//got the name, let's continue for the email
|
||||
if (!Name) Name = Data;
|
||||
State = 2;
|
||||
return response.say('Ok ' + Name + '. What is your email ?').shouldEndSession(false);
|
||||
}else{
|
||||
@@ -128,7 +131,7 @@ var updateIntentsJSON = function () {
|
||||
//was waiting for email, so if Email is null, email is probably in Data
|
||||
if ((!Email && Data) || Email){
|
||||
//Got the email, first verify email and than continue to message
|
||||
|
||||
if (!Email) Email = Data;
|
||||
//TODO : verify email
|
||||
State = 3;
|
||||
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
|
||||
if ((!Message && Data) || Message){
|
||||
//Ok, we got all informations. Exit email intent
|
||||
if (!Message) Message=Data;
|
||||
State = 0;
|
||||
//TODO : Send email
|
||||
console.log('Name : ' + Name + ' | Email : ' + Email + ' | Message : ' + Message);
|
||||
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 (updateOnAmazon){
|
||||
amazonHelper.updateSkill(skill).then(amazonResult=>{
|
||||
console.log('Amazon : ' + amazonResult);
|
||||
if (amazonResult === 200 || amazonResult === 202) {
|
||||
//Skill uploaded, it's ok to update databaseI
|
||||
databaseHelper
|
||||
@@ -208,7 +219,9 @@ router.post ('/updateSkill/:id', async (req, res, next) => {
|
||||
.catch (e => {
|
||||
res.json ({result: -1, message: 'error'});
|
||||
});
|
||||
}
|
||||
}else{
|
||||
res.json({result: -1, message: 'amazon error : ' + amazonResult});
|
||||
}
|
||||
}).catch(e=>{
|
||||
res.json ({result: -1, message: e});
|
||||
});
|
||||
|
||||
@@ -49,6 +49,9 @@ var refreshTokens = function () {
|
||||
parsedResponse.access_token,
|
||||
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});
|
||||
});
|
||||
|
||||
|
||||
//Special Email Intents :
|
||||
allIntents.push({
|
||||
name: 'EmailIntentLaunch',
|
||||
@@ -92,36 +96,40 @@ var generateInteractionModel = function (skill) {
|
||||
'Leave a message'
|
||||
]
|
||||
});
|
||||
|
||||
allIntents.push({
|
||||
name: 'EmailIntent',
|
||||
slots:[
|
||||
{
|
||||
name: 'Name',
|
||||
type: 'AMAZON.Person'
|
||||
'name': 'Name',
|
||||
'type': 'AMAZON.US_FIRST_NAME'
|
||||
},
|
||||
{
|
||||
name: 'Email',
|
||||
type: 'AMAZON.LITERAL'
|
||||
'name': 'Email',
|
||||
'type': 'AMAZON.LITERAL'
|
||||
},
|
||||
{
|
||||
name: 'Message',
|
||||
type: 'AMAZON.LITERAL'
|
||||
'name': 'Message',
|
||||
'type': 'AMAZON.LITERAL'
|
||||
},
|
||||
{
|
||||
name: 'Data',
|
||||
type: 'AMAZON.LITERAL'
|
||||
'name': 'Data',
|
||||
'type': 'AMAZON.LITERAL'
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
samples: [
|
||||
'My name is {Name}',
|
||||
'I am {Name}',
|
||||
'{Data}',
|
||||
'My email is {Email}',
|
||||
'Send replay to {Email}',
|
||||
'My message is {Message}'
|
||||
'{exampleww at wwdwdw|Data}',
|
||||
'My email is {example at efefegedd|Email}',
|
||||
'Send replay to {example at abcdefg|Email}',
|
||||
'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.languageModel = {
|
||||
|
||||
@@ -17,7 +17,7 @@ class App extends Component {
|
||||
constructor(props){
|
||||
super(props);
|
||||
|
||||
this.state={_id:'5a232fb86ce046c749739455',
|
||||
this.state={_id:'5a5016e775becaef2015da10',
|
||||
skillID:'',
|
||||
skillName:'',
|
||||
invocationName:'Saburly',
|
||||
@@ -181,6 +181,7 @@ class App extends Component {
|
||||
updateSkill(this.createSkill(newAllIntents,newName,newAnswer,email,updateOnAmazon)).then(l=>l.text()).then(result=>{
|
||||
let jResult = JSON.parse(result);
|
||||
if (jResult.result !== 0){
|
||||
console.log(jResult.result);
|
||||
if (showPopUp) Popup.alert('Model was not saved. Please try again');
|
||||
this.setState(rejectState);
|
||||
//reject('Error code : ' + jResult.result);
|
||||
@@ -190,6 +191,7 @@ class App extends Component {
|
||||
resolve();
|
||||
}
|
||||
}).catch(e=>{
|
||||
console.log('error : ' + e);
|
||||
if (showPopUp) Popup.alert('Model was not saved. Please try again');
|
||||
this.setState(rejectState);
|
||||
//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 QUESTION_MAX_LENGTH = 150;
|
||||
@@ -14,4 +14,4 @@ export const EMAIL_MAX_LENGTH = 100;
|
||||
|
||||
export const NEW_INTENT_SELECTED_INDEX = -1;
|
||||
export const LAUNCH_REQUEST_SELECTED_INDEX = -2;
|
||||
export const CONTACT_SELECTED_INDEX = -3;
|
||||
export const CONTACT_SELECTED_INDEX = -3;
|
||||
|
||||
Reference in New Issue
Block a user