gather: dont resolve if deepgram sends final/empty transcript with no transcripts previously buffered (#618)

This commit is contained in:
Dave Horton
2024-01-17 10:59:37 -05:00
committed by GitHub
parent b423a51638
commit 6d5ef6a215

View File

@@ -686,6 +686,9 @@ class TaskGather extends SttTask {
this.logger.debug('TaskGather:_onTranscription - got speech_final waiting for UtteranceEnd event'); this.logger.debug('TaskGather:_onTranscription - got speech_final waiting for UtteranceEnd event');
return; return;
} }
/* deepgram can send an empty and final transcript; only if we have any buffered should we resolve */
if (this._bufferedTranscripts.length === 0) return;
this.logger.debug({evt}, 'TaskGather:_onTranscription - compiling deepgram transcripts'); this.logger.debug({evt}, 'TaskGather:_onTranscription - compiling deepgram transcripts');
evt = this.consolidateTranscripts(this._bufferedTranscripts, 1, this.language); evt = this.consolidateTranscripts(this._bufferedTranscripts, 1, this.language);
this._bufferedTranscripts = []; this._bufferedTranscripts = [];