"""Renders a call's full transcript as attention-shaded HTML, driven by the per-turn attention_weight values exported by src/evaluation/export_dashboard_data.py.""" import html from theme import BORDER_HAIRLINE, TEXT_SECONDARY SECTION_LABELS = { "operator_transition": "Operator", "prepared_remarks": "Prepared Remarks", "qa": "Q&A", } def _intensity_color(weight: float, max_weight: float) -> str: """Accent-tinted background, opacity scaled by relative attention weight.""" if max_weight <= 0: return "transparent" frac = min(weight / max_weight, 1.0) alpha = 0.05 + 0.30 * frac r, g, b = 255, 87, 34 return f"rgba({r},{g},{b},{alpha:.3f})" def render_full_transcript(turns: list[dict], selected_turn: int | None = None) -> str: """Full ordered transcript, grouped into sections, each turn background-shaded by its own attention weight relative to the call's max. `selected_turn`, when set, adds the `fl-timeline-selected` class to that turn's block (used by the Workspace tab to sync highlighting with the Timeline/Evidence panel).""" if not turns: return "
No transcript available.
" max_w = max(t["attention_weight"] for t in turns) blocks = [] current_section = None for t in turns: section = SECTION_LABELS.get(t["segment_type"], t["segment_type"]) if section != current_section: blocks.append(f'