mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
fix stt default vendor cannot be mapped to correct value (#588)
This commit is contained in:
@@ -56,6 +56,27 @@ class SttTask extends Task {
|
||||
super.exec(cs);
|
||||
this.ep = ep;
|
||||
this.ep2 = ep2;
|
||||
// copy all value from config verb to this object.
|
||||
if (cs.recognizer) {
|
||||
for (const k in cs.recognizer) {
|
||||
if (Array.isArray(this.data.recognizer[k]) ||
|
||||
Array.isArray(cs.recognizer[k])) {
|
||||
this.data.recognizer[k] = [
|
||||
...this.data.recognizer[k],
|
||||
...cs.recognizer[k]
|
||||
];
|
||||
} else if (typeof this.data.recognizer[k] === 'object' ||
|
||||
typeof cs.recognizer[k] === 'object'
|
||||
) {
|
||||
this.data.recognizer[k] = {
|
||||
...this.data.recognizer[k],
|
||||
...cs.recognizer[k]
|
||||
};
|
||||
} else {
|
||||
this.data.recognizer[k] = cs.recognizer[k] || this.data.recognizer[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ('default' === this.vendor || !this.vendor) {
|
||||
this.vendor = cs.speechRecognizerVendor;
|
||||
if (this.data.recognizer) this.data.recognizer.vendor = this.vendor;
|
||||
@@ -89,27 +110,6 @@ class SttTask extends Task {
|
||||
this.data.recognizer.model = cs.speechRecognizerLanguage;
|
||||
}
|
||||
|
||||
if (cs.recognizer) {
|
||||
for (const k in cs.recognizer) {
|
||||
if (Array.isArray(this.data.recognizer[k]) ||
|
||||
Array.isArray(cs.recognizer[k])) {
|
||||
this.data.recognizer[k] = [
|
||||
...this.data.recognizer[k],
|
||||
...cs.recognizer[k]
|
||||
];
|
||||
} else if (typeof this.data.recognizer[k] === 'object' ||
|
||||
typeof cs.recognizer[k] === 'object'
|
||||
) {
|
||||
this.data.recognizer[k] = {
|
||||
...this.data.recognizer[k],
|
||||
...cs.recognizer[k]
|
||||
};
|
||||
} else {
|
||||
this.data.recognizer[k] = cs.recognizer[k] || this.data.recognizer[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.sttCredentials) {
|
||||
try {
|
||||
this.sttCredentials = await this._initSpeechCredentials(this.cs, this.vendor, this.label);
|
||||
|
||||
Reference in New Issue
Block a user