@absolutejs/voice 0.0.22-beta.556 → 0.0.22-beta.558
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 -0
- package/dist/testing/index.js +20 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4273,6 +4273,17 @@ var createVoiceSession = (options) => {
|
|
|
4273
4273
|
turnId: cancelledTurnId
|
|
4274
4274
|
});
|
|
4275
4275
|
}
|
|
4276
|
+
try {
|
|
4277
|
+
ttsSession = null;
|
|
4278
|
+
ttsSessionPromise = null;
|
|
4279
|
+
await activeSession.close("post-cancel-reset");
|
|
4280
|
+
} catch (error) {
|
|
4281
|
+
logger.warn("voice tts adapter close-after-cancel failed", {
|
|
4282
|
+
error: toError(error).message,
|
|
4283
|
+
reason,
|
|
4284
|
+
sessionId: options.id
|
|
4285
|
+
});
|
|
4286
|
+
}
|
|
4276
4287
|
};
|
|
4277
4288
|
const sendAssistantAudio = async (chunk, input) => {
|
|
4278
4289
|
const normalizedChunk = chunk instanceof Uint8Array ? new Uint8Array(chunk) : chunk instanceof ArrayBuffer ? new Uint8Array(chunk.slice(0)) : new Uint8Array(chunk.buffer.slice(chunk.byteOffset, chunk.byteOffset + chunk.byteLength));
|
|
@@ -5182,6 +5193,15 @@ var createVoiceSession = (options) => {
|
|
|
5182
5193
|
if (!ttsSession2 || started && activeTTSTurnId !== turn.id)
|
|
5183
5194
|
return;
|
|
5184
5195
|
if (!started) {
|
|
5196
|
+
fillerToken += 1;
|
|
5197
|
+
if (fillerTimer) {
|
|
5198
|
+
clearTimeout(fillerTimer);
|
|
5199
|
+
fillerTimer = null;
|
|
5200
|
+
}
|
|
5201
|
+
if (fillerActive) {
|
|
5202
|
+
await cancelActiveTTS("filler-superseded").catch(() => {});
|
|
5203
|
+
fillerActive = false;
|
|
5204
|
+
}
|
|
5185
5205
|
activeTTSTurnId = turn.id;
|
|
5186
5206
|
await appendTurnLatencyStage({
|
|
5187
5207
|
at: ttsStartedAt,
|
package/dist/testing/index.js
CHANGED
|
@@ -6110,6 +6110,17 @@ var createVoiceSession = (options) => {
|
|
|
6110
6110
|
turnId: cancelledTurnId
|
|
6111
6111
|
});
|
|
6112
6112
|
}
|
|
6113
|
+
try {
|
|
6114
|
+
ttsSession = null;
|
|
6115
|
+
ttsSessionPromise = null;
|
|
6116
|
+
await activeSession.close("post-cancel-reset");
|
|
6117
|
+
} catch (error) {
|
|
6118
|
+
logger.warn("voice tts adapter close-after-cancel failed", {
|
|
6119
|
+
error: toError(error).message,
|
|
6120
|
+
reason,
|
|
6121
|
+
sessionId: options.id
|
|
6122
|
+
});
|
|
6123
|
+
}
|
|
6113
6124
|
};
|
|
6114
6125
|
const sendAssistantAudio = async (chunk, input) => {
|
|
6115
6126
|
const normalizedChunk = chunk instanceof Uint8Array ? new Uint8Array(chunk) : chunk instanceof ArrayBuffer ? new Uint8Array(chunk.slice(0)) : new Uint8Array(chunk.buffer.slice(chunk.byteOffset, chunk.byteOffset + chunk.byteLength));
|
|
@@ -7019,6 +7030,15 @@ var createVoiceSession = (options) => {
|
|
|
7019
7030
|
if (!ttsSession2 || started && activeTTSTurnId !== turn.id)
|
|
7020
7031
|
return;
|
|
7021
7032
|
if (!started) {
|
|
7033
|
+
fillerToken += 1;
|
|
7034
|
+
if (fillerTimer) {
|
|
7035
|
+
clearTimeout(fillerTimer);
|
|
7036
|
+
fillerTimer = null;
|
|
7037
|
+
}
|
|
7038
|
+
if (fillerActive) {
|
|
7039
|
+
await cancelActiveTTS("filler-superseded").catch(() => {});
|
|
7040
|
+
fillerActive = false;
|
|
7041
|
+
}
|
|
7022
7042
|
activeTTSTurnId = turn.id;
|
|
7023
7043
|
await appendTurnLatencyStage({
|
|
7024
7044
|
at: ttsStartedAt,
|