Skip to content

Commit d960d6c

Browse files
authored
feat: add transcription participants stats at the end of the meeting (#249)
1 parent 9595457 commit d960d6c

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

skynet/modules/stt/streaming_whisper/connection_manager.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,19 @@ async def send(self, connection: MeetingConnection, results: list[utils.Transcri
6464
log.error(f'Meeting {connection.meeting_id}: exception while sending transcription results {ex}')
6565

6666
async def disconnect(self, connection: MeetingConnection, already_closed=False):
67+
# Build participant audio distribution string
68+
participant_stats = []
69+
for participant_id, state in connection.participants.items():
70+
participant_stats.append(f"{participant_id}: {state.total_audio_received_s:.1f}s")
71+
72+
participants_str = " | ".join(participant_stats) if participant_stats else "none"
73+
6774
log.info(
6875
f"Closed {connection.meeting_id} | Audio: {connection.total_audio_received_s}s | "
6976
+ f"Interims: {connection.total_interims} | Finals: {connection.total_finals}"
7077
)
78+
log.info(f"Participant audio distribution: {participants_str}")
79+
7180
try:
7281
self.connections.remove(connection)
7382
except ValueError:

skynet/modules/stt/streaming_whisper/meeting_connection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ async def force_transcription(self, participant_id: str):
8484
if participant_id in self.participants:
8585
payloads = await self.participants[participant_id].force_transcription(self.previous_transcription_tokens)
8686
if payloads:
87+
await self.update_connection_summary_stats(payloads)
8788
await self.update_initial_prompt(payloads)
8889
return payloads
8990
return None

skynet/modules/stt/streaming_whisper/state.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class State:
2222
working_audio_starts_at: int
2323
last_received_chunk: int
2424
last_speech_timestamp: float
25+
total_audio_received_s: float
2526

2627
def __init__(
2728
self,
@@ -40,6 +41,7 @@ def __init__(
4041
self.last_received_chunk = utils.now()
4142
self.is_transcribing = False
4243
self.last_speech_timestamp = 0.0
44+
self.total_audio_received_s = 0.0
4345

4446
def _extract_transcriptions(
4547
self, last_pause: utils.CutMark, ts_result: utils.WhisperResult
@@ -140,6 +142,7 @@ async def process(self, chunk: Chunk, previous_tokens: list[int]) -> List[utils.
140142
async def add_to_store(self, chunk: Chunk, tmp_working_audio: bytes = b''):
141143
now_millis = utils.now()
142144
self.chunk_count += 1
145+
self.total_audio_received_s += chunk.duration
143146
# if the working audio is empty, set the start timestamp
144147
if not self.working_audio:
145148
self.working_audio_starts_at = chunk.timestamp - int(chunk.duration * 1000)

0 commit comments

Comments
 (0)