mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-07-04 19:32:01 +00:00
wip
This commit is contained in:
+8
-5
@@ -762,7 +762,9 @@ 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();
|
||||
}
|
||||
@@ -773,10 +775,10 @@ class TaskGather extends SttTask {
|
||||
// if (this.vendor === 'deepgram') return; // no need
|
||||
assert(this.isContinuousAsr || this.vendor === 'houndify');
|
||||
this._clearAsrTimer();
|
||||
const timeoutMs = this.asrTimeout || 500;
|
||||
this._asrTimer = setTimeout(() => {
|
||||
this.logger.info('_startAsrTimer - asr timer went off');
|
||||
|
||||
/* houndify: timer is the cue to send Done; wait for real FinalTranscript */
|
||||
if (this.vendor === 'houndify') return this._sendHoundifyDone(this.ep);
|
||||
|
||||
const evt = this.consolidateTranscripts(this._bufferedTranscripts, 1, this.language, this.vendor);
|
||||
@@ -788,8 +790,8 @@ class TaskGather extends SttTask {
|
||||
return;
|
||||
}
|
||||
this._resolve(this._bufferedTranscripts.length > 0 ? 'speech' : 'timeout', evt);
|
||||
}, timeoutMs);
|
||||
this.logger.info(`_startAsrTimer: set for ${timeoutMs}ms`);
|
||||
}, this.asrTimeout);
|
||||
this.logger.info(`_startAsrTimer: set for ${this.asrTimeout}ms`);
|
||||
}
|
||||
|
||||
_clearAsrTimer() {
|
||||
@@ -1115,9 +1117,10 @@ class TaskGather extends SttTask {
|
||||
if (this.vendor === 'houndify') {
|
||||
const transcript = evt.alternatives[0]?.transcript;
|
||||
if (evt.is_partial_final && transcript) {
|
||||
/* mode segmentation ON: buffer FinalSegment + arm asrTimer (sends Done on expiry) */
|
||||
/* mode segmentation ON: buffer FinalSegment + send Done now (asrTimeout=0) or arm asrTimer */
|
||||
this._bufferedTranscripts.push(evt);
|
||||
this._startAsrTimer();
|
||||
if (!this.asrTimeout) this._sendHoundifyDone(this.ep);
|
||||
else this._startAsrTimer();
|
||||
} else if (transcript) {
|
||||
/* mode segmentation OFF: track last non-empty partial */
|
||||
this._houndifyLastPartial = evt;
|
||||
|
||||
@@ -649,9 +649,10 @@ class TaskTranscribe extends SttTask {
|
||||
else if (this.vendor === 'houndify') {
|
||||
const transcript = evt.alternatives[0]?.transcript;
|
||||
if (evt.is_partial_final && transcript) {
|
||||
/* mode segmentation ON: buffer FinalSegment + arm asrTimer */
|
||||
/* mode segmentation ON: buffer FinalSegment + send Done now (asrTimeout=0) or arm asrTimer */
|
||||
bufferedTranscripts.push(evt);
|
||||
this._startAsrTimer(channel);
|
||||
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 */
|
||||
this._houndifyLastPartial = this._houndifyLastPartial || [null, null];
|
||||
@@ -935,8 +936,10 @@ class TaskTranscribe extends SttTask {
|
||||
this._onVendorError(cs, _ep, {error: JSON.stringify(e)});
|
||||
}
|
||||
|
||||
/* houndify mode=none: FS detected eoq/vad, arm asrTimer for this channel */
|
||||
/* 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);
|
||||
}
|
||||
@@ -945,7 +948,6 @@ class TaskTranscribe extends SttTask {
|
||||
if (this.vendor === 'deepgram') return; // no need
|
||||
assert(this.isContinuousAsr || this.vendor === 'houndify');
|
||||
this._clearAsrTimer(channel);
|
||||
const timeoutMs = this.asrTimeout || 500;
|
||||
const timer = setTimeout(() => {
|
||||
this.logger.debug(`TaskTranscribe:_startAsrTimer - asr timer went off for channel: ${channel}`);
|
||||
if (this._asrTimers) this._asrTimers[channel - 1] = null;
|
||||
@@ -958,7 +960,7 @@ class TaskTranscribe extends SttTask {
|
||||
this._bufferedTranscripts[channel - 1], channel, this.language, this.vendor);
|
||||
this._bufferedTranscripts[channel - 1] = [];
|
||||
this._resolve(channel, evt);
|
||||
}, timeoutMs);
|
||||
}, this.asrTimeout);
|
||||
/* houndify: per-channel timers (stereo). Other vendors retain legacy single timer. */
|
||||
if (this.vendor === 'houndify') {
|
||||
this._asrTimers = this._asrTimers || [null, null];
|
||||
@@ -966,7 +968,7 @@ class TaskTranscribe extends SttTask {
|
||||
} else {
|
||||
this._asrTimer = timer;
|
||||
}
|
||||
this.logger.debug(`TaskTranscribe:_startAsrTimer: set for ${timeoutMs}ms for channel ${channel}`);
|
||||
this.logger.debug(`TaskTranscribe:_startAsrTimer: set for ${this.asrTimeout}ms for channel ${channel}`);
|
||||
}
|
||||
|
||||
_clearAsrTimer(channel) {
|
||||
|
||||
Reference in New Issue
Block a user