drop queue speech on barge in

This commit is contained in:
akirilyuk
2022-02-03 17:47:11 +01:00
parent a1c59a5f25
commit 7e9b6498c5
4 changed files with 58 additions and 14 deletions

View File

@@ -28,6 +28,19 @@ class SpeechConfig extends Emitter {
this.logger.debug({sessionLevel: this.sessionConfig}, 'SpeechConfig updated');
}
/**
* check if we should skip all nodes until next bot input
*/
get skipUntilBotInput(){
return this.sessionConfig.bargein?.skipUntilBotInput === false;
}
/**
* Check if barge is enabled on session level
*/
get bargeInEnabled(){
return this.sessionConfig.bargein?.enable?.length > 0;
}
makeSayTaskConfig({text, turnConfig = {}} = {}) {
const synthesizer = lodash.merge({}, this.sessionConfig.synthesizer, turnConfig.synthesizer);
return {
@@ -36,7 +49,7 @@ class SpeechConfig extends Emitter {
};
}
makeGatherTaskConfig({textPrompt, urlPrompt, turnConfig = {}} = {}) {
makeGatherTaskConfig({textPrompt, urlPrompt, turnConfig = {}, dontListenAfterSpeech} = {}) {
// we merge from top to bottom deeply so we wil have
// defaults from session config and then will override them via turn config
const opts = lodash.merge(
@@ -112,7 +125,8 @@ class SpeechConfig extends Emitter {
noInputRetries,
noInputSpeech,
noInputUrl
}
},
dontListenAfterSpeech
};
const final = stripNulls(config);