client-sdk-js
efd56285 - IMPORTANT(transcription): add TranscriptionStreamConverter

Commit
7 days ago
IMPORTANT(transcription): add TranscriptionStreamConverter Agents send transcriptions on the lk.transcription topic as text streams. This module turns those streams back into the Transcription messages that the legacy data packet carried. The events that applications listen to then stay the same. Two stream shapes arrive on the topic: - Agent speech uses one stream for each segment. Each chunk adds more text. The closing trailer carries the finality attribute. - User speech-to-text uses a new stream for each update. All of the streams share one segment id. Each stream carries the full text. The header carries the finality attribute. Thus a new stream id for a segment that is already open replaces the text. It does not add to it. The module trusts the lk.transcription_final attribute when the attribute is present. The end of a stream means final only when the attribute is absent. If the module made every stream end final, it would wrongly finalize each interim user transcript. The module has no dependency on Room or on RTCEngine. It reports each update through a callback. REVIEWER ATTENTION: The rule for replace, and the three states of the finality attribute, are the most difficult parts of this change. Read the loop in handleTextStream and the isFinal method together.
Author
Committer
Parents
Loading