fix linting

This commit is contained in:
akirilyuk
2022-02-14 14:16:44 +01:00
parent 15f85c9730
commit d79c733aa2
2 changed files with 19 additions and 13 deletions

View File

@@ -10,7 +10,7 @@ const {
const makeTask = require('./make_task'); const makeTask = require('./make_task');
const assert = require('assert'); const assert = require('assert');
const GATHER_STABILITY_THRESHOLD = Number(process.env.JAMBONZ_GATHER_STABILITY_THRESHOLD || 0.7); const GATHER_STABILITY_THRESHOLD = Number(process.env.JAMBONZ_GATHER_STABILITY_THRESHOLD || 0.7);
class TaskGather extends Task { class TaskGather extends Task {
constructor(logger, opts, parentTask) { constructor(logger, opts, parentTask) {
@@ -54,10 +54,10 @@ class TaskGather extends Task {
if (this.say) this.sayTask = makeTask(this.logger, {say: this.say}, this); if (this.say) this.sayTask = makeTask(this.logger, {say: this.say}, this);
if (this.play) this.playTask = makeTask(this.logger, {play: this.play}, this); if (this.play) this.playTask = makeTask(this.logger, {play: this.play}, this);
if(this.sayTask || this.playTask){ if (this.sayTask || this.playTask) {
// this is specially for barge in where we want to make a bargebale promt // this is specially for barge in where we want to make a bargebale promt
// to a user without listening after the say task has finished // to a user without listening after the say task has finished
this.listenAfterSpeech = typeof this.data.listenAfterSpeech === "boolean" ? this.data.listenAfterSpeech : true; this.listenAfterSpeech = typeof this.data.listenAfterSpeech === 'boolean' ? this.data.listenAfterSpeech : true;
} }
this.parentTask = parentTask; this.parentTask = parentTask;
@@ -326,11 +326,11 @@ class TaskGather extends Task {
if (evt.is_final) this._resolve('speech', evt); if (evt.is_final) this._resolve('speech', evt);
else { else {
const recognizeSuccess = evt.stability > GATHER_STABILITY_THRESHOLD; const recognizeSuccess = evt.stability > GATHER_STABILITY_THRESHOLD;
/* /*
we need to make sure to only send something on barge in if we have we need to make sure to only send something on barge in if we have
something valid therefore we need to check the recognition something valid therefore we need to check the recognition
stability, which applies to GOOGLE stability, which applies to GOOGLE
for MS we will have a final event, meaning we will not run into for MS we will have a final event, meaning we will not run into
the current if else branch. the current if else branch.
For AWS we still need more testing For AWS we still need more testing

View File

@@ -21,15 +21,21 @@ class TaskSay extends Task {
const {updateSpeechCredentialLastUsed} = require('../utils/db-utils')(this.logger, srf); const {updateSpeechCredentialLastUsed} = require('../utils/db-utils')(this.logger, srf);
const {writeAlerts, AlertType, stats} = srf.locals; const {writeAlerts, AlertType, stats} = srf.locals;
const {synthAudio} = srf.locals.dbHelpers; const {synthAudio} = srf.locals.dbHelpers;
const vendor = this.synthesizer.vendor && this.synthesizer.vendor !== 'default' ? this.synthesizer.vendor : cs.speechSynthesisVendor; const vendor = this.synthesizer.vendor && this.synthesizer.vendor !== 'default'
const language = this.synthesizer.language && this.synthesizer.language !== 'default' ? this.synthesizer.language : cs.speechSynthesisLanguage ; ? this.synthesizer.vendor
const voice = this.synthesizer.voice && this.synthesizer.voice !== 'default' ? this.synthesizer.voice : cs.speechSynthesisVoice; : cs.speechSynthesisVendor;
const language = this.synthesizer.language && this.synthesizer.language !== 'default'
? this.synthesizer.language
: cs.speechSynthesisLanguage ;
const voice = this.synthesizer.voice && this.synthesizer.voice !== 'default'
? this.synthesizer.voice
: cs.speechSynthesisVoice;
const engine = this.synthesizer.engine || 'standard'; const engine = this.synthesizer.engine || 'standard';
const salt = cs.callSid; const salt = cs.callSid;
const credentials = cs.getSpeechCredentials(vendor, 'tts'); const credentials = cs.getSpeechCredentials(vendor, 'tts');
this.logger.info({language, this.logger.info({language,
voice, voice,
localSynthesizer: this.synthesizer, localSynthesizer: this.synthesizer,
speechSynthesisVendor: cs.speechSynthesisVendor, speechSynthesisVendor: cs.speechSynthesisVendor,
speechSynthesisLanguage: cs.speechSynthesisLanguage, speechSynthesisLanguage: cs.speechSynthesisLanguage,