@absolutejs/voice 0.0.22-beta.592 → 0.0.22-beta.594
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +20 -8
- package/dist/testing/index.js +20 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4639,6 +4639,13 @@ var createVoiceSession = (options) => {
|
|
|
4639
4639
|
if (!didComplete) {
|
|
4640
4640
|
return;
|
|
4641
4641
|
}
|
|
4642
|
+
if (shouldInvokeOnComplete) {
|
|
4643
|
+
await options.route.onComplete({
|
|
4644
|
+
api,
|
|
4645
|
+
context: options.context,
|
|
4646
|
+
session
|
|
4647
|
+
});
|
|
4648
|
+
}
|
|
4642
4649
|
if (disposition === "completed") {
|
|
4643
4650
|
await drainAssistantSpeech(lastTtsSendAt);
|
|
4644
4651
|
await assistantAudioQueue;
|
|
@@ -4701,13 +4708,6 @@ var createVoiceSession = (options) => {
|
|
|
4701
4708
|
session
|
|
4702
4709
|
});
|
|
4703
4710
|
}
|
|
4704
|
-
if (shouldInvokeOnComplete) {
|
|
4705
|
-
await options.route.onComplete({
|
|
4706
|
-
api,
|
|
4707
|
-
context: options.context,
|
|
4708
|
-
session
|
|
4709
|
-
});
|
|
4710
|
-
}
|
|
4711
4711
|
await options.route.onCallEnd?.({
|
|
4712
4712
|
api,
|
|
4713
4713
|
context: options.context,
|
|
@@ -6289,9 +6289,21 @@ var createVoiceSession = (options) => {
|
|
|
6289
6289
|
amdFirstAudioAt = Date.now();
|
|
6290
6290
|
}
|
|
6291
6291
|
speechDetected = true;
|
|
6292
|
-
clearSilenceTimer();
|
|
6293
6292
|
kickCallSilenceWatchdog();
|
|
6294
6293
|
backchannelDriver?.noteSpeech();
|
|
6294
|
+
const latest = await readSession();
|
|
6295
|
+
const sttQuietMs = latest.currentTurn.lastTranscriptAt !== undefined ? Date.now() - latest.currentTurn.lastTranscriptAt : Number.POSITIVE_INFINITY;
|
|
6296
|
+
const hasTurnTextDespiteNoise = Boolean(buildTurnText(latest.currentTurn.transcripts, latest.currentTurn.partialText, {
|
|
6297
|
+
partialEndedAtMs: latest.currentTurn.partialEndedAt,
|
|
6298
|
+
partialStartedAtMs: latest.currentTurn.partialStartedAt
|
|
6299
|
+
}));
|
|
6300
|
+
if (hasTurnTextDespiteNoise && sttQuietMs >= turnDetection.silenceMs) {
|
|
6301
|
+
if (!silenceTimer) {
|
|
6302
|
+
scheduleSilenceCommit(0);
|
|
6303
|
+
}
|
|
6304
|
+
} else {
|
|
6305
|
+
clearSilenceTimer();
|
|
6306
|
+
}
|
|
6295
6307
|
} else if (speechDetected) {
|
|
6296
6308
|
backchannelDriver?.noteSilence();
|
|
6297
6309
|
const currentSession = await readSession();
|
package/dist/testing/index.js
CHANGED
|
@@ -6866,6 +6866,13 @@ var createVoiceSession = (options) => {
|
|
|
6866
6866
|
if (!didComplete) {
|
|
6867
6867
|
return;
|
|
6868
6868
|
}
|
|
6869
|
+
if (shouldInvokeOnComplete) {
|
|
6870
|
+
await options.route.onComplete({
|
|
6871
|
+
api,
|
|
6872
|
+
context: options.context,
|
|
6873
|
+
session
|
|
6874
|
+
});
|
|
6875
|
+
}
|
|
6869
6876
|
if (disposition === "completed") {
|
|
6870
6877
|
await drainAssistantSpeech(lastTtsSendAt);
|
|
6871
6878
|
await assistantAudioQueue;
|
|
@@ -6928,13 +6935,6 @@ var createVoiceSession = (options) => {
|
|
|
6928
6935
|
session
|
|
6929
6936
|
});
|
|
6930
6937
|
}
|
|
6931
|
-
if (shouldInvokeOnComplete) {
|
|
6932
|
-
await options.route.onComplete({
|
|
6933
|
-
api,
|
|
6934
|
-
context: options.context,
|
|
6935
|
-
session
|
|
6936
|
-
});
|
|
6937
|
-
}
|
|
6938
6938
|
await options.route.onCallEnd?.({
|
|
6939
6939
|
api,
|
|
6940
6940
|
context: options.context,
|
|
@@ -8516,9 +8516,21 @@ var createVoiceSession = (options) => {
|
|
|
8516
8516
|
amdFirstAudioAt = Date.now();
|
|
8517
8517
|
}
|
|
8518
8518
|
speechDetected = true;
|
|
8519
|
-
clearSilenceTimer();
|
|
8520
8519
|
kickCallSilenceWatchdog();
|
|
8521
8520
|
backchannelDriver?.noteSpeech();
|
|
8521
|
+
const latest = await readSession();
|
|
8522
|
+
const sttQuietMs = latest.currentTurn.lastTranscriptAt !== undefined ? Date.now() - latest.currentTurn.lastTranscriptAt : Number.POSITIVE_INFINITY;
|
|
8523
|
+
const hasTurnTextDespiteNoise = Boolean(buildTurnText(latest.currentTurn.transcripts, latest.currentTurn.partialText, {
|
|
8524
|
+
partialEndedAtMs: latest.currentTurn.partialEndedAt,
|
|
8525
|
+
partialStartedAtMs: latest.currentTurn.partialStartedAt
|
|
8526
|
+
}));
|
|
8527
|
+
if (hasTurnTextDespiteNoise && sttQuietMs >= turnDetection.silenceMs) {
|
|
8528
|
+
if (!silenceTimer) {
|
|
8529
|
+
scheduleSilenceCommit(0);
|
|
8530
|
+
}
|
|
8531
|
+
} else {
|
|
8532
|
+
clearSilenceTimer();
|
|
8533
|
+
}
|
|
8522
8534
|
} else if (speechDetected) {
|
|
8523
8535
|
backchannelDriver?.noteSilence();
|
|
8524
8536
|
const currentSession = await readSession();
|