fix setting initial config

This commit is contained in:
akirilyuk
2022-02-04 08:12:53 +01:00
parent eb418a42e9
commit 418baa20df
3 changed files with 29 additions and 32 deletions

View File

@@ -7,9 +7,6 @@ const stripNulls = (obj) => {
return obj;
};
const defaultSpeechConfig
class SpeechConfig extends Emitter {
constructor({logger, ep, opts = {}}) {
super();
@@ -19,16 +16,16 @@ class SpeechConfig extends Emitter {
this.update(opts);
}
_mergeConfig(changedConfig = {}){
_mergeConfig(changedConfig = {}) {
const merged = lodash.merge(
{},
this.sessionConfig,
changedConfig
);
merged.bargein.enable = changedConfig.bargein?.enable?.length === 0 ? [] : changedConfig.bargein?.enable;
this.logger.debug({merged, sessionConfig: this.sessionConfig, changedConfig}, 'merged config');
// should we override hints with empty array or leave it as it is once saved?
// merged.recognizer.hints = changedConfig.recognizer?.hints
{},
this.sessionConfig,
changedConfig
);
merged.bargein.enable = changedConfig.bargein?.enable?.length === 0 ? [] : changedConfig.bargein?.enable;
this.logger.debug({merged, sessionConfig: this.sessionConfig, changedConfig}, 'merged config');
// should we override hints with empty array or leave it as it is once saved?
// merged.recognizer.hints = changedConfig.recognizer?.hints
}
update(session) {