🐛(frontend) ensure transcript segments are sorted by their timestamp

Switching from Deepgram to our custom Kyutai implementation introduced changes
in how segment data is returned by the LiveKit agent, so the segment start time
is now treated as optional.
This commit is contained in:
lebaudantoine
2026-01-23 18:09:25 +01:00
committed by aleb_the_flash
parent 99a18b6e90
commit ff82bca9ec
2 changed files with 12 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ and this project adheres to
- ♿️(frontend) announce copy state in invite dialog #877 - ♿️(frontend) announce copy state in invite dialog #877
- 📝(frontend) align close dialog label in rooms locale #878 - 📝(frontend) align close dialog label in rooms locale #878
- 🩹(backend) use case-insensitive email matching in the external api #887 - 🩹(backend) use case-insensitive email matching in the external api #887
- 🐛(frontend) ensure transcript segments are sorted by their timestamp #899
## [1.3.0] - 2026-01-13 ## [1.3.0] - 2026-01-13

View File

@@ -13,7 +13,7 @@ export interface TranscriptionSegment {
id: string id: string
text: string text: string
language: string language: string
startTime: number startTime?: number
endTime: number endTime: number
final: boolean final: boolean
firstReceivedTime: number firstReceivedTime: number
@@ -24,8 +24,9 @@ export interface TranscriptionRow {
id: string id: string
participant: Participant participant: Participant
segments: TranscriptionSegment[] segments: TranscriptionSegment[]
startTime: number startTime?: number
lastUpdateTime: number lastUpdateTime: number
lastReceivedTime: number
} }
const useTranscriptionState = () => { const useTranscriptionState = () => {
@@ -72,7 +73,9 @@ const useTranscriptionState = () => {
id: `${participant.identity}-${now}`, id: `${participant.identity}-${now}`,
participant, participant,
segments: [...segments], segments: [...segments],
startTime: Math.min(...segments.map((s) => s.startTime)), lastReceivedTime: Math.min(
...segments.map((s) => s.lastReceivedTime)
),
lastUpdateTime: now, lastUpdateTime: now,
} }
updatedRows.push(newRow) updatedRows.push(newRow)
@@ -228,7 +231,11 @@ export const Subtitles = () => {
> >
{transcriptionRows {transcriptionRows
.slice() .slice()
.reverse() .sort(
(a, b) =>
(b.startTime ?? b.lastUpdateTime) -
(a.startTime ?? a.lastUpdateTime)
)
.map((row) => ( .map((row) => (
<Transcription key={row.id} row={row} /> <Transcription key={row.id} row={row} />
))} ))}