@mulingai-npm/redis 2.5.3 → 2.5.5

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<boolean>;
95
+ updateFinalTranscription(roomId: string, chunkNumber: number, transcription: string, sttStatus: StepStatus): 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".
@@ -195,17 +195,19 @@ class MulingstreamChunkManager {
195
195
  }
196
196
  async updateFinalTranscription(roomId, chunkNumber, transcription, sttStatus) {
197
197
  const chunks = await this.getMulingstreamChunksByRoom(roomId);
198
- if (!chunks)
199
- return false;
200
- // Find the chunk
201
- const chunkIndex = chunks.findIndex((c) => c.chunkNumber === chunkNumber);
202
- if (chunkIndex === -1)
203
- return false;
204
- chunks[chunkIndex].finalTranscription = transcription;
205
- chunks[chunkIndex].sttStatus = sttStatus;
206
- // Write back
198
+ if (!chunks) {
199
+ return null;
200
+ }
201
+ // locate the chunk
202
+ const idx = chunks.findIndex((c) => c.chunkNumber === chunkNumber);
203
+ if (idx === -1) {
204
+ return null;
205
+ }
206
+ // update fields
207
+ chunks[idx].finalTranscription = transcription;
208
+ chunks[idx].sttStatus = sttStatus;
207
209
  await this.redisClient.jsonSet(`[${roomId}]`, '.', chunks);
208
- return true;
210
+ return chunks[idx];
209
211
  }
210
212
  /**
211
213
  * Discards all post-STT steps for a given chunk:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mulingai-npm/redis",
3
- "version": "2.5.3",
3
+ "version": "2.5.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {