From 6d5ef6a2157efcbe6dbfb559e07d2940d0180dfe Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Wed, 17 Jan 2024 10:59:37 -0500 Subject: [PATCH] gather: dont resolve if deepgram sends final/empty transcript with no transcripts previously buffered (#618) --- lib/tasks/gather.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index a7e1d7e2..d19a3b3c 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -686,6 +686,9 @@ class TaskGather extends SttTask { this.logger.debug('TaskGather:_onTranscription - got speech_final waiting for UtteranceEnd event'); 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'); evt = this.consolidateTranscripts(this._bufferedTranscripts, 1, this.language); this._bufferedTranscripts = [];