Skip to content

Commit a506295

Browse files
committed
Add index to textstreamupdate
1 parent 15f100c commit a506295

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

livekit-rtc/livekit/rtc/data_stream.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class TextStreamInfo(BaseStreamInfo):
4949
@dataclass
5050
class TextStreamUpdate:
5151
current: str
52+
index: int
5253
collected: str
5354

5455

@@ -86,7 +87,9 @@ async def __anext__(self) -> TextStreamUpdate:
8687
chunk_list = list(self._chunks.values())
8788
chunk_list.sort(key=lambda chunk: chunk.chunk_index)
8889
collected: str = "".join(map(lambda chunk: chunk.content.decode(), chunk_list))
89-
return TextStreamUpdate(current=decodedStr, collected=collected)
90+
return TextStreamUpdate(
91+
current=decodedStr, index=item.chunk_index, collected=collected
92+
)
9093

9194
@property
9295
def info(self) -> TextStreamInfo:

0 commit comments

Comments
 (0)