mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 17:17:58 +00:00
make barge in disableable
This commit is contained in:
@@ -16,14 +16,23 @@ class SpeechConfig extends Emitter {
|
||||
this.update(opts);
|
||||
}
|
||||
|
||||
update(session) {
|
||||
// TODO validation of session params?
|
||||
if (session) {
|
||||
this.sessionConfig = lodash.merge(
|
||||
_mergeConfig(changedConfig = {}){
|
||||
const merged = lodash.merge(
|
||||
{},
|
||||
this.sessionConfig,
|
||||
session
|
||||
);
|
||||
merged.bargein.enable = changedConfig.bargein?.enable?.length === 0 ? [] : changedConfig.bargein?.enable;
|
||||
|
||||
// should we override hints with empty array or leave it as it is once saved?
|
||||
// merged.recognizer.hints = changedConfig.recognizer?.hints
|
||||
|
||||
}
|
||||
|
||||
update(session) {
|
||||
// TODO validation of session params?
|
||||
if (session) {
|
||||
this.sessionConfig = this._mergeConfig(session);
|
||||
}
|
||||
this.logger.debug({sessionLevel: this.sessionConfig}, 'SpeechConfig updated');
|
||||
}
|
||||
@@ -49,24 +58,10 @@ class SpeechConfig extends Emitter {
|
||||
};
|
||||
}
|
||||
|
||||
makeGatherTaskConfig({textPrompt, urlPrompt, turnConfig = {}, dontListenAfterSpeech} = {}) {
|
||||
makeGatherTaskConfig({textPrompt, urlPrompt, turnConfig = {}, listenAfterSpeech} = {}) {
|
||||
// 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(
|
||||
{},
|
||||
this.sessionConfig || {}, // this should not be undefined ever
|
||||
turnConfig
|
||||
);
|
||||
|
||||
/*
|
||||
const nextTurnKeys = Object.keys(this.turnConfig || {});
|
||||
const newKeys = nextTurnKeys.filter((k) => !(k in opts));
|
||||
const bothKeys = nextTurnKeys.filter((k) => k in opts);
|
||||
|
||||
for (const key of newKeys) opts[key] = this.turnConfig[key];
|
||||
for (const key of bothKeys) opts[key] = {...opts[key], ...this.turnConfig[key]};
|
||||
|
||||
*/
|
||||
const opts = this._mergeConfig(turnConfig);
|
||||
|
||||
this.logger.debug({
|
||||
opts,
|
||||
@@ -126,7 +121,7 @@ class SpeechConfig extends Emitter {
|
||||
noInputSpeech,
|
||||
noInputUrl
|
||||
},
|
||||
listenAfterSpeech: !dontListenAfterSpeech
|
||||
listenAfterSpeech
|
||||
};
|
||||
|
||||
const final = stripNulls(config);
|
||||
|
||||
Reference in New Issue
Block a user