mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2026-02-04 18:06:48 +00:00
- Import topics_to_webvtt_named and recordings controller - Add _get_is_multitrack helper function - Generate WebVTT context on WebSocket connection - Add get_context message type to retrieve WebVTT - Maintain backward compatibility with echo for other messages - Add test fixture and test for WebVTT context generation Implements task fn-1.2: WebVTT context generation for transcript chat
1.1 KiB
1.1 KiB
Task 2: WebVTT Context Generation
File: server/reflector/views/transcripts_chat.py (modify)
Lines: ~15
Dependencies: Task 1
Objective
Generate WebVTT transcript context on connection.
Implementation
from reflector.utils.transcript_formats import topics_to_webvtt_named
from reflector.views.transcripts import _get_is_multitrack
# Add after websocket.accept():
# Get WebVTT context
is_multitrack = await _get_is_multitrack(transcript)
webvtt = topics_to_webvtt_named(
transcript.topics,
transcript.participants,
is_multitrack
)
# Truncate if needed
webvtt_truncated = webvtt[:15000] if len(webvtt) > 15000 else webvtt
# Send to client for verification
await websocket.send_json({
"type": "context",
"webvtt": webvtt_truncated,
"truncated": len(webvtt) > 15000
})
Validation
- WebVTT generated on connection
- Truncated to 15k chars if needed
- Client receives context message
- Format matches WebVTT spec (timestamps, speaker names)
Notes
- Log if truncation occurs
- Keep echo functionality for testing