mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-19 04:17:44 +00:00
wip
This commit is contained in:
@@ -87,6 +87,7 @@ class TaskTranscribe extends SttTask {
|
||||
|
||||
async exec(cs, obj) {
|
||||
try {
|
||||
this.hasFallbackAsrFromLastRun = cs.hasFallbackAsr;
|
||||
await this.handling(cs, obj);
|
||||
} catch (error) {
|
||||
if (error instanceof SpeechCredentialError) {
|
||||
@@ -905,10 +906,19 @@ class TaskTranscribe extends SttTask {
|
||||
// we want to keep track this on task level instead of endpoint level
|
||||
// because the endpoint instance is used across multiple tasks.
|
||||
canFallback(ep) {
|
||||
const isHandledByPrimaryProvider = ep === this.ep ?
|
||||
this.isHandledByPrimaryProviderForEp1 : ep === this.ep2 ?
|
||||
this.isHandledByPrimaryProviderForEp2 : this.isHandledByPrimaryProvider;
|
||||
return this.fallbackVendor && isHandledByPrimaryProvider && !this.cs.hasFallbackAsr;
|
||||
let isHandledByPrimaryProvider = this.isHandledByPrimaryProvider;
|
||||
if (ep === this.ep) {
|
||||
isHandledByPrimaryProvider = this.isHandledByPrimaryProviderForEp1;
|
||||
} else if (ep === this.ep2) {
|
||||
isHandledByPrimaryProvider = this.isHandledByPrimaryProviderForEp2;
|
||||
}
|
||||
|
||||
// fallback is configured
|
||||
return this.fallbackVendor &&
|
||||
// has this endpoint already fallen back
|
||||
isHandledByPrimaryProvider &&
|
||||
// in global level, is there any fallback is already happened
|
||||
!this.hasFallbackAsrFromLastRun;
|
||||
}
|
||||
|
||||
_initFallback(ep) {
|
||||
|
||||
Reference in New Issue
Block a user