further fix for accumulating transcripts

This commit is contained in:
Dave Horton
2024-04-03 08:20:17 -04:00
parent ccc93b7a78
commit 31efaeb43c

View File

@@ -321,7 +321,7 @@ class TaskTranscribe extends SttTask {
this.logger.debug('Gather:_onTranscription - got UtteranceEnd event from deepgram, return buffered transcript'); this.logger.debug('Gather:_onTranscription - got UtteranceEnd event from deepgram, return buffered transcript');
evt = this.consolidateTranscripts(bufferedTranscripts, channel, this.language, this.vendor); evt = this.consolidateTranscripts(bufferedTranscripts, channel, this.language, this.vendor);
evt.is_final = true; evt.is_final = true;
bufferedTranscripts = []; this._bufferedTranscripts[channel - 1] = [];
this._resolve(channel, evt); this._resolve(channel, evt);
} }
return; return;
@@ -392,7 +392,7 @@ class TaskTranscribe extends SttTask {
/* deepgram can send an empty and final transcript; only if we have any buffered should we resolve */ /* deepgram can send an empty and final transcript; only if we have any buffered should we resolve */
if (bufferedTranscripts.length === 0) return; if (bufferedTranscripts.length === 0) return;
evt = this.consolidateTranscripts(bufferedTranscripts, channel, this.language); evt = this.consolidateTranscripts(bufferedTranscripts, channel, this.language);
bufferedTranscripts = []; this._bufferedTranscripts[channel - 1] = [];
} }
/* here is where we return a final transcript */ /* here is where we return a final transcript */