sera-ai 1.0.12 → 1.0.13
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 +15 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3084,11 +3084,14 @@ var useAudioRecorder = ({
|
|
|
3084
3084
|
processorRef.current?.port.postMessage({ command: "resetUploadChunk" });
|
|
3085
3085
|
if (audioData && localSessionIdRef.current && !retry) {
|
|
3086
3086
|
try {
|
|
3087
|
+
console.log(`[DB] Saving chunk ${sequence} to IndexedDB session ${localSessionIdRef.current}`);
|
|
3087
3088
|
await appendAudioToSession(localSessionIdRef.current, audioData, sequence);
|
|
3088
|
-
console.log(`[
|
|
3089
|
+
console.log(`[DB] \u2713 Successfully saved audio chunk ${sequence} to IndexedDB (${audioData.length} samples)`);
|
|
3089
3090
|
} catch (error2) {
|
|
3090
|
-
console.error(`[
|
|
3091
|
+
console.error(`[DB] \u2717 Failed to save audio chunk ${sequence} to IndexedDB:`, error2);
|
|
3091
3092
|
}
|
|
3093
|
+
} else {
|
|
3094
|
+
console.log(`[DB] Skipping IndexedDB save: audioData=${!!audioData}, sessionId=${localSessionIdRef.current}, retry=${retry}`);
|
|
3092
3095
|
}
|
|
3093
3096
|
try {
|
|
3094
3097
|
const data = await pRetry__default.default(
|
|
@@ -3481,16 +3484,19 @@ var useAudioRecorder = ({
|
|
|
3481
3484
|
totalRecordingTime,
|
|
3482
3485
|
lastAudioTime
|
|
3483
3486
|
} = event.data;
|
|
3484
|
-
const sequence = sequenceCounterRef.current++;
|
|
3485
3487
|
if (command === "finalChunk" && audioBuffer) {
|
|
3488
|
+
const sequence = sequenceCounterRef.current++;
|
|
3486
3489
|
const audioArray = new Float32Array(audioBuffer);
|
|
3487
|
-
console.log(`
|
|
3490
|
+
console.log(`[RECEIVE] Final chunk: ${audioArray.length} samples, sequence: ${sequence}`);
|
|
3488
3491
|
enqueueChunk(audioArray, true, sequence);
|
|
3489
|
-
} else if (command === "
|
|
3492
|
+
} else if (command === "chunk" && audioBuffer) {
|
|
3493
|
+
const sequence = sequenceCounterRef.current++;
|
|
3490
3494
|
const audioArray = new Float32Array(audioBuffer);
|
|
3495
|
+
console.log(`[RECEIVE] Chunk: ${audioArray.length} samples, sequence: ${sequence}`);
|
|
3491
3496
|
enqueueChunk(audioArray, false, sequence);
|
|
3492
3497
|
} else if (command === "pauseChunk" && audioBuffer) {
|
|
3493
|
-
|
|
3498
|
+
const sequence = sequenceCounterRef.current++;
|
|
3499
|
+
console.log(`[RECEIVE] Pause chunk with audioBuffer, sequence: ${sequence}`);
|
|
3494
3500
|
enqueueChunk(new Float32Array(audioBuffer), false, sequence, true);
|
|
3495
3501
|
} else if (command === "audioLevel") {
|
|
3496
3502
|
setAudioLevel(level);
|
|
@@ -3644,16 +3650,18 @@ var useAudioRecorder = ({
|
|
|
3644
3650
|
const processNextChunkInQueue = React3__namespace.default.useCallback(() => {
|
|
3645
3651
|
if (isProcessingQueueRef.current || chunkQueueRef.current.length === 0) return;
|
|
3646
3652
|
const { chunk, isFinal, sequence, isPaused: isPaused2 = false } = chunkQueueRef.current.shift();
|
|
3653
|
+
console.log(`[QUEUE] Processing chunk ${sequence} from queue, remaining: ${chunkQueueRef.current.length}`);
|
|
3647
3654
|
isProcessingQueueRef.current = true;
|
|
3648
3655
|
uploadChunkToServer(chunk, isFinal, sequence, false, isPaused2).finally(() => {
|
|
3656
|
+
console.log(`[QUEUE] Finished processing chunk ${sequence}`);
|
|
3649
3657
|
isProcessingQueueRef.current = false;
|
|
3650
3658
|
processNextChunkInQueue();
|
|
3651
3659
|
});
|
|
3652
3660
|
}, [uploadChunkToServer, isLoaded]);
|
|
3653
3661
|
const enqueueChunk = React3__namespace.default.useCallback(
|
|
3654
3662
|
(audioData, isFinalChunk, sequence, isPausedChunk = false) => {
|
|
3663
|
+
console.log(`[QUEUE] Enqueuing ${isFinalChunk ? "FINAL" : isPausedChunk ? "PAUSED" : "regular"} chunk ${sequence}, samples: ${audioData?.length || 0}, queue size: ${chunkQueueRef.current.length}`);
|
|
3655
3664
|
if (isFinalChunk) {
|
|
3656
|
-
console.log("Enqueuing final chunk:", sequence);
|
|
3657
3665
|
setIsProcessing(true);
|
|
3658
3666
|
}
|
|
3659
3667
|
chunkQueueRef.current.push({
|