This commit is contained in:
xquanluu
2026-05-28 10:16:49 +07:00
parent b3f3736628
commit cc039865ad
2 changed files with 24 additions and 8 deletions
+10 -2
View File
@@ -1113,13 +1113,21 @@ class TaskGather extends SttTask {
if (!this.asrTimeout) this._sendHoundifyDone(this.ep);
else this._startAsrTimer();
} else if (transcript) {
/* 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) {
/* FS forwards two kinds of partials in mode OFF —
* end-of-turn (eoq >= threshold) → trigger Done / arm timer
* user-speaking (eoq < threshold) → reset asrTimer only */
const eoqThreshold = this.data.recognizer?.houndifyOptions?.eoqThreshold ?? 0.5;
const eoq = evt.vendor?.evt?.eoq;
const isEndOfTurn = typeof eoq === 'number' && eoq >= eoqThreshold;
if (isEndOfTurn) {
if (!this.asrTimeout) this._sendHoundifyDone(this.ep);
else this._startAsrTimer();
} else if (this.asrTimeout && this._asrTimer) {
this._startAsrTimer();
}
}
}
if (!transcript) emptyTranscript = true;
+10 -2
View File
@@ -652,15 +652,23 @@ 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: 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) {
/* FS forwards two kinds of partials in mode OFF —
* end-of-turn (eoq >= threshold) → trigger Done / arm timer
* user-speaking (eoq < threshold) → reset asrTimer only */
const eoqThreshold = this.data.recognizer?.houndifyOptions?.eoqThreshold ?? 0.5;
const eoq = evt.vendor?.evt?.eoq;
const isEndOfTurn = typeof eoq === 'number' && eoq >= eoqThreshold;
const ep = channel === 2 ? this.ep2 : this.ep;
if (isEndOfTurn) {
if (!this.asrTimeout) this._sendHoundifyDone(ep, channel);
else this._startAsrTimer(channel);
} else if (this.asrTimeout && this._asrTimers?.[channel - 1]) {
this._startAsrTimer(channel);
}
}
}
}