mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
lex changes
This commit is contained in:
@@ -15,7 +15,8 @@ class Lex extends Task {
|
||||
this.alias = this.data.botAlias;
|
||||
this.region = this.data.region;
|
||||
this.locale = this.data.locale || 'en_US';
|
||||
this.intent = this.data.intent;
|
||||
this.intent = this.data.intent || {};
|
||||
this.metadata = this.data.metadata;
|
||||
this.welcomeMessage = this.data.welcomeMessage;
|
||||
this.bargein = this.data.bargein || false;
|
||||
this.passDtmf = this.data.passDtmf || false;
|
||||
@@ -49,10 +50,20 @@ class Lex extends Task {
|
||||
try {
|
||||
await this.init(cs, ep);
|
||||
|
||||
this.logger.debug(`starting lex bot ${this.botName} with locale ${this.locale}`);
|
||||
|
||||
// kick it off
|
||||
this.ep.api('aws_lex_start', `${this.ep.uuid} ${this.bot} ${this.alias} ${this.region} ${this.locale}`)
|
||||
const obj = {};
|
||||
let cmd = `${this.ep.uuid} ${this.bot} ${this.alias} ${this.region} ${this.locale} `;
|
||||
|
||||
if (this.metadata) Object.assign(obj, this.metadata);
|
||||
if (this.intent.name) {
|
||||
cmd += this.intent.name;
|
||||
if (this.intent.slots) Object.assign(obj, {slots: this.intent.slots});
|
||||
}
|
||||
|
||||
if (Object.keys(obj).length > 0) cmd += ` '${JSON.stringify(obj)}'`;
|
||||
|
||||
this.logger.debug({cmd}, `starting lex bot ${this.botName} with locale ${this.locale}`);
|
||||
this.ep.api('aws_lex_start', cmd)
|
||||
.catch((err) => {
|
||||
this.logger.error({err}, `Error starting lex bot ${this.botName}`);
|
||||
this.notifyTaskDone();
|
||||
@@ -114,7 +125,7 @@ class Lex extends Task {
|
||||
});
|
||||
}
|
||||
if (this.vendor) Object.assign(channelVars, {LEX_USE_TTS: 1});
|
||||
if (this.intent && this.intent.length) Object.assign(channelVars, {LEX_WELCOME_INTENT: this.intent});
|
||||
//if (this.intent.name) Object.assign(channelVars, {LEX_WELCOME_INTENT: this.intent});
|
||||
if (this.welcomeMessage && this.welcomeMessage.length) {
|
||||
Object.assign(channelVars, {LEX_WELCOME_MESSAGE: this.welcomeMessage});
|
||||
}
|
||||
|
||||
@@ -157,8 +157,9 @@
|
||||
"credentials": "object",
|
||||
"region": "string",
|
||||
"locale": "string",
|
||||
"intent": "string",
|
||||
"intent": "#lexIntent",
|
||||
"welcomeMessage": "string",
|
||||
"metadata": "object",
|
||||
"bargein": "boolean",
|
||||
"passDtmf": "boolean",
|
||||
"actionHook": "object|string",
|
||||
@@ -336,5 +337,14 @@
|
||||
"required": [
|
||||
"vendor"
|
||||
]
|
||||
},
|
||||
"lexIntent": {
|
||||
"properties": {
|
||||
"name": "string",
|
||||
"slots": "object"
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user