Skip to content

Commit 3c1d973

Browse files
authored
fix(core): dedupe transcriptions based on segment id (#1149)
1 parent 551aacb commit 3c1d973

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.changeset/popular-mugs-drive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@livekit/components-core": patch
3+
---
4+
5+
fix(core): dedupe transcriptions based on segment id

packages/core/src/components/textStream.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ export function setupTextStream(room: Room, topic: string): Observable<TextStrea
6868
// Subscribe to the stream and update our array when new chunks arrive
6969
streamObservable.subscribe((accumulatedText) => {
7070
// Find and update the stream in our array
71-
const index = textStreams.findIndex((stream) => stream.streamInfo.id === reader.info.id);
71+
const index = textStreams.findIndex(
72+
(stream) =>
73+
stream.streamInfo.id === reader.info.id ||
74+
stream.streamInfo.attributes?.['lk.segment_id'] ===
75+
reader.info.attributes?.['lk.segment_id'],
76+
);
7277
if (index !== -1) {
7378
textStreams[index] = {
7479
...textStreams[index],

0 commit comments

Comments
 (0)