improve var naming

This commit is contained in:
akirilyuk
2022-02-03 17:58:26 +01:00
parent 8163c33462
commit 53e5360ab3
4 changed files with 32 additions and 21 deletions

View File

@@ -87,7 +87,7 @@ class Cognigy extends Task {
}
this.logger.debug('say task executed from queue');
});
if(this.taskQueue.lastPromise){
if (this.taskQueue.lastPromise) {
// resolve the previous promise for cleanup
this.taskQueue.lastPromise.resolve({});
}
@@ -189,10 +189,10 @@ class Cognigy extends Task {
* Creates a promt which will be sent to the consumer. We will create a say task if bargein is disabled
* for session and nextTurn, else create a gather task.
*/
_createPromtTask({text, url, turnConfig, dontListenAfterSpeech} = {}){
const bargeInOnNextTurn = turnConfig?.bargein?.enable?.length>0;
_createPromtTask({text, url, turnConfig, dontListenAfterSpeech} = {}) {
const bargeInOnNextTurn = turnConfig?.bargein?.enable?.length > 0;
const bargeInSession = this.config.bargeInEnabled;
if(bargeInOnNextTurn || bargeInSession){
if (bargeInOnNextTurn || bargeInSession) {
return this._makeGatherTask({textPrompt: text, url, turnConfig, dontListenAfterSpeech});
}
return this._makeSayTask({text, turnConfig});
@@ -210,7 +210,7 @@ class Cognigy extends Task {
_makeSayTask({ text, turnConfig } = {}) {
this.logger.debug({text, turnConfig}, '_makeSayTask');
const config = this.config.makeSayTaskConfig({text, turnConfig });
this.logger.debug({config}, "created say task config");
this.logger.debug({config}, 'created say task config');
const say = makeTask(this.logger, { say: config }, this);
return say;
}
@@ -261,7 +261,7 @@ class Cognigy extends Task {
async _onBotFinalPing(cs, ep) {
this.logger.info({prompts: this.prompts}, 'Cognigy:_onBotFinalPing');
try {
// lets wait until we have finished processing the speech before
// lets wait until we have finished processing the speech before
// starting a gather...
await this.taskQueue.lastPromise;
const gatherTask = this._makeGatherTask();
@@ -357,10 +357,10 @@ class Cognigy extends Task {
const utterance = evt.alternatives[0].transcript;
//if we have barge in enabled AND we enabled skipping until next question
//then stop execution of currently queues bot output before sending the
//then stop execution of currently queues bot output before sending the
//response to waiting bot since otherwise we could stop upcoming bot output
if(this.config.skipUntilBotInput){
if (this.config.skipUntilBotInput) {
// clear task queue, resolve the last promise and cleanup;
this.taskQueue.end();
this.taskQueue.lastPromise.resolve();