@mulingai-npm/redis 2.5.6 → 2.6.0
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.
|
@@ -92,7 +92,7 @@ export declare class MulingstreamChunkManager {
|
|
|
92
92
|
status: StepStatus;
|
|
93
93
|
}>): Promise<boolean>;
|
|
94
94
|
discardStt(roomId: string, chunkNumber: number): Promise<boolean>;
|
|
95
|
-
updateFinalTranscription(roomId: string, chunkNumber: number, transcription: string, sttStatus: StepStatus): Promise<MulingstreamChunkData | null>;
|
|
95
|
+
updateFinalTranscription(roomId: string, chunkNumber: number, transcription: string | null, sttStatus: StepStatus | null): Promise<MulingstreamChunkData | null>;
|
|
96
96
|
/**
|
|
97
97
|
* Discards all post-STT steps for a given chunk:
|
|
98
98
|
* sets all translation[].status & tts[].status to "DISCARDED".
|
|
@@ -107,4 +107,5 @@ export declare class MulingstreamChunkManager {
|
|
|
107
107
|
status?: StepStatus;
|
|
108
108
|
}): Promise<boolean>;
|
|
109
109
|
updateTranslationInBulk(roomId: string, chunkNumber: number, translations: Record<string, string>, status?: StepStatus): Promise<MulingstreamChunkData | null>;
|
|
110
|
+
areTranslationsProcessed(roomId: string, chunkNumber: number): Promise<boolean>;
|
|
110
111
|
}
|
|
@@ -198,14 +198,17 @@ class MulingstreamChunkManager {
|
|
|
198
198
|
if (!chunks) {
|
|
199
199
|
return null;
|
|
200
200
|
}
|
|
201
|
-
// locate the chunk
|
|
202
201
|
const idx = chunks.findIndex((c) => c.chunkNumber === chunkNumber);
|
|
203
202
|
if (idx === -1) {
|
|
204
203
|
return null;
|
|
205
204
|
}
|
|
206
|
-
//
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
// mutate only when a non-null value is supplied
|
|
206
|
+
if (transcription !== null) {
|
|
207
|
+
chunks[idx].finalTranscription = transcription;
|
|
208
|
+
}
|
|
209
|
+
if (sttStatus !== null) {
|
|
210
|
+
chunks[idx].sttStatus = sttStatus;
|
|
211
|
+
}
|
|
209
212
|
await this.redisClient.jsonSet(`[${roomId}]`, '.', chunks);
|
|
210
213
|
return chunks[idx];
|
|
211
214
|
}
|
|
@@ -304,5 +307,12 @@ class MulingstreamChunkManager {
|
|
|
304
307
|
await this.redisClient.jsonSet(`[${roomId}]`, '.', chunks);
|
|
305
308
|
return chunk;
|
|
306
309
|
}
|
|
310
|
+
async areTranslationsProcessed(roomId, chunkNumber) {
|
|
311
|
+
const chunk = await this.getMulingstreamChunkById(roomId, chunkNumber);
|
|
312
|
+
if (!chunk) {
|
|
313
|
+
return false;
|
|
314
|
+
}
|
|
315
|
+
return Object.values(chunk.translation).every((t) => t.status !== 'INIT');
|
|
316
|
+
}
|
|
307
317
|
}
|
|
308
318
|
exports.MulingstreamChunkManager = MulingstreamChunkManager;
|