This commit is contained in:
xquanluu
2026-05-24 13:45:49 +07:00
parent bd5fe8c2b0
commit b3f3736628
3 changed files with 16 additions and 23 deletions
+7 -10
View File
@@ -593,8 +593,6 @@ class TaskGather extends SttTask {
this._onVendorConnectFailure.bind(this, cs, ep));
this.addCustomEventListener(ep, HoundifyTranscriptionEvents.Connect,
this._onVendorConnect.bind(this, cs, ep));
this.addCustomEventListener(ep, HoundifyTranscriptionEvents.EoqVadTriggered,
this._onHoundifyEoqVadTriggered.bind(this, cs, ep));
break;
case 'voxist':
@@ -762,13 +760,6 @@ class TaskGather extends SttTask {
return false;
}
/* houndify mode=none: FS detected eoq/vad — send Done now if asrTimeout=0, else arm asrTimer. */
_onHoundifyEoqVadTriggered(_cs, _ep, _evt, _fsEvent) {
if (!this.asrTimeout) return this._sendHoundifyDone(this.ep);
if (this._asrTimer) return;
this._startAsrTimer();
}
_startAsrTimer() {
// Deepgram has a case that UtteranceEnd is not sent to cover the last word end time.
// So we need to wait for the asrTimeout to be sure that the last word is sent.
@@ -1122,8 +1113,14 @@ class TaskGather extends SttTask {
if (!this.asrTimeout) this._sendHoundifyDone(this.ep);
else this._startAsrTimer();
} else if (transcript) {
/* mode segmentation OFF: track last non-empty partial */
/* mode segmentation OFF: FS module filters partials by eoq/vad threshold,
* so any partial arriving here is an end-of-turn signal. */
this._houndifyLastPartial = evt;
const segMode = this.data.recognizer?.houndifyOptions?.requestInfo?.segmentation?.mode !== 'none';
if (!segMode) {
if (!this.asrTimeout) this._sendHoundifyDone(this.ep);
else this._startAsrTimer();
}
}
if (!transcript) emptyTranscript = true;
}
+8 -11
View File
@@ -353,8 +353,6 @@ class TaskTranscribe extends SttTask {
this._onVendorConnectFailure.bind(this, cs, ep, channel));
this.addCustomEventListener(ep, HoundifyTranscriptionEvents.Connect,
this._onVendorConnect.bind(this, cs, ep));
this.addCustomEventListener(ep, HoundifyTranscriptionEvents.EoqVadTriggered,
this._onHoundifyEoqVadTriggered.bind(this, cs, ep, channel));
break;
case 'voxist':
@@ -654,9 +652,16 @@ class TaskTranscribe extends SttTask {
if (!this.asrTimeout) this._sendHoundifyDone(channel === 2 ? this.ep2 : this.ep, channel);
else this._startAsrTimer(channel);
} else if (transcript) {
/* mode segmentation OFF: track last non-empty partial per channel */
/* mode segmentation OFF: FS module filters partials by eoq/vad threshold,
* so any partial arriving here is an end-of-turn signal. */
this._houndifyLastPartial = this._houndifyLastPartial || [null, null];
this._houndifyLastPartial[channel - 1] = evt;
const segMode = this.data.recognizer?.houndifyOptions?.requestInfo?.segmentation?.mode !== 'none';
if (!segMode) {
const ep = channel === 2 ? this.ep2 : this.ep;
if (!this.asrTimeout) this._sendHoundifyDone(ep, channel);
else this._startAsrTimer(channel);
}
}
}
@@ -936,14 +941,6 @@ class TaskTranscribe extends SttTask {
this._onVendorError(cs, _ep, {error: JSON.stringify(e)});
}
/* houndify mode=none: FS detected eoq/vad — send Done now if asrTimeout=0, else arm asrTimer. */
_onHoundifyEoqVadTriggered(_cs, _ep, channel, _evt, _fsEvent) {
const ep = channel === 2 ? this.ep2 : this.ep;
if (!this.asrTimeout) return this._sendHoundifyDone(ep, channel);
if (this._asrTimers?.[channel - 1]) return; /* idempotent per channel */
this._startAsrTimer(channel);
}
_startAsrTimer(channel) {
if (this.vendor === 'deepgram') return; // no need
assert(this.isContinuousAsr || this.vendor === 'houndify');
+1 -2
View File
@@ -179,8 +179,7 @@
"Transcription": "houndify_transcribe::transcription",
"Error": "houndify_transcribe::error",
"ConnectFailure": "houndify_transcribe::connect_failed",
"Connect": "houndify_transcribe::connect",
"EoqVadTriggered": "houndify_transcribe::eoq_vad_triggered"
"Connect": "houndify_transcribe::connect"
},
"VoxistTranscriptionEvents": {
"Transcription": "voxist_transcribe::transcription",