add a bit more info logging to gather (#1211)

This commit is contained in:
Dave Horton
2025-05-26 09:34:21 -04:00
committed by GitHub
parent f670626cf7
commit 603dd482bc

View File

@@ -612,7 +612,7 @@ class TaskGather extends SttTask {
} }
_startTranscribing(ep) { _startTranscribing(ep) {
this.logger.debug({ this.logger.info({
vendor: this.vendor, vendor: this.vendor,
locale: this.language, locale: this.language,
interim: this.interim, interim: this.interim,
@@ -691,7 +691,7 @@ class TaskGather extends SttTask {
assert(this.isContinuousAsr); assert(this.isContinuousAsr);
this._clearAsrTimer(); this._clearAsrTimer();
this._asrTimer = setTimeout(() => { this._asrTimer = setTimeout(() => {
this.logger.debug('_startAsrTimer - asr timer went off'); this.logger.info('_startAsrTimer - asr timer went off');
const evt = this.consolidateTranscripts(this._bufferedTranscripts, 1, this.language, this.vendor); const evt = this.consolidateTranscripts(this._bufferedTranscripts, 1, this.language, this.vendor);
/* special case for speechmatics - keep listening if we dont have any transcripts */ /* special case for speechmatics - keep listening if we dont have any transcripts */
@@ -702,7 +702,7 @@ class TaskGather extends SttTask {
} }
this._resolve(this._bufferedTranscripts.length > 0 ? 'speech' : 'timeout', evt); this._resolve(this._bufferedTranscripts.length > 0 ? 'speech' : 'timeout', evt);
}, this.asrTimeout); }, this.asrTimeout);
this.logger.debug(`_startAsrTimer: set for ${this.asrTimeout}ms`); this.logger.info(`_startAsrTimer: set for ${this.asrTimeout}ms`);
} }
_clearAsrTimer() { _clearAsrTimer() {
@@ -714,7 +714,7 @@ class TaskGather extends SttTask {
} }
_hangupCall() { _hangupCall() {
this.logger.debug('_hangupCall'); this.logger.debug('TaskGather:_hangupCall');
this.cs.hangup(); this.cs.hangup();
} }
@@ -737,7 +737,7 @@ class TaskGather extends SttTask {
_startFinalAsrTimer() { _startFinalAsrTimer() {
this._clearFinalAsrTimer(); this._clearFinalAsrTimer();
this._finalAsrTimer = setTimeout(() => { this._finalAsrTimer = setTimeout(() => {
this.logger.debug('_startFinalAsrTimer - final asr timer went off'); this.logger.info('_startFinalAsrTimer - final asr timer went off');
const evt = this.consolidateTranscripts(this._bufferedTranscripts, 1, this.language, this.vendor); const evt = this.consolidateTranscripts(this._bufferedTranscripts, 1, this.language, this.vendor);
this._resolve(this._bufferedTranscripts.length > 0 ? 'speech' : 'timeout', evt); this._resolve(this._bufferedTranscripts.length > 0 ? 'speech' : 'timeout', evt);
}, 1000); }, 1000);
@@ -833,7 +833,7 @@ class TaskGather extends SttTask {
const finished = fsEvent.getHeader('transcription-session-finished'); const finished = fsEvent.getHeader('transcription-session-finished');
this.logger.debug({evt, bugname, finished, vendor: this.vendor}, 'Gather:_onTranscription raw transcript'); this.logger.debug({evt, bugname, finished, vendor: this.vendor}, 'Gather:_onTranscription raw transcript');
if (bugname && this.bugname !== bugname) { if (bugname && this.bugname !== bugname) {
this.logger.debug( this.logger.info(
`Gather:_onTranscription - ignoring transcript from ${bugname} because our bug is ${this.bugname}`); `Gather:_onTranscription - ignoring transcript from ${bugname} because our bug is ${this.bugname}`);
return; return;
} }
@@ -843,16 +843,16 @@ class TaskGather extends SttTask {
if (this.vendor === 'deepgram' && evt.type === 'UtteranceEnd') { if (this.vendor === 'deepgram' && evt.type === 'UtteranceEnd') {
/* we will only get this when we have set utterance_end_ms */ /* we will only get this when we have set utterance_end_ms */
if (this._bufferedTranscripts.length === 0) { if (this._bufferedTranscripts.length === 0) {
this.logger.debug('Gather:_onTranscription - got UtteranceEnd event from deepgram but no buffered transcripts'); this.logger.info('Gather:_onTranscription - got UtteranceEnd event from deepgram but no buffered transcripts');
} }
else { else {
const utteranceTime = evt.last_word_end; const utteranceTime = evt.last_word_end;
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
if (utteranceTime && this._dgTimeOfLastUnprocessedWord && utteranceTime < this._dgTimeOfLastUnprocessedWord && utteranceTime != -1) { if (utteranceTime && this._dgTimeOfLastUnprocessedWord && utteranceTime < this._dgTimeOfLastUnprocessedWord && utteranceTime != -1) {
this.logger.debug('Gather:_onTranscription - got UtteranceEnd with unprocessed words, continue listening'); this.logger.info('Gather:_onTranscription - got UtteranceEnd with unprocessed words, continue listening');
} }
else { else {
this.logger.debug('Gather:_onTranscription - got UtteranceEnd from deepgram, return buffered transcript'); this.logger.info('Gather:_onTranscription - got UtteranceEnd from deepgram, return buffered transcript');
evt = this.consolidateTranscripts(this._bufferedTranscripts, 1, this.language, this.vendor); evt = this.consolidateTranscripts(this._bufferedTranscripts, 1, this.language, this.vendor);
this._bufferedTranscripts = []; this._bufferedTranscripts = [];
this._resolve('speech', evt); this._resolve('speech', evt);
@@ -1208,7 +1208,7 @@ class TaskGather extends SttTask {
} }
async _resolve(reason, evt) { async _resolve(reason, evt) {
this.logger.debug(`TaskGather:resolve with reason ${reason}`); this.logger.info({evt}, `TaskGather:resolve with reason ${reason}`);
if (this.needsStt && this.ep && this.ep.connected) { if (this.needsStt && this.ep && this.ep.connected) {
this.ep.stopTranscription({ this.ep.stopTranscription({
vendor: this.vendor, vendor: this.vendor,
@@ -1244,7 +1244,7 @@ class TaskGather extends SttTask {
}); });
if (this.callSession && this.callSession.callGone) { if (this.callSession && this.callSession.callGone) {
this.logger.debug('TaskGather:_resolve - call is gone, not invoking web callback'); this.logger.info('TaskGather:_resolve - call is gone, not invoking web callback');
this.notifyTaskDone(); this.notifyTaskDone();
return; return;
} }