Skip to content

Add interactive turn detection visualizer to docs#616

Open
devin-ai-integration[bot] wants to merge 8 commits intomainfrom
devin/1770384450-turn-detection-visualizer
Open

Add interactive turn detection visualizer to docs#616
devin-ai-integration[bot] wants to merge 8 commits intomainfrom
devin/1770384450-turn-detection-visualizer

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Feb 6, 2026

Add interactive turn detection visualizer to docs

Summary

Adds an interactive React component (TurnDetectionVisualizer) to the turn detection docs page that visually demonstrates how the three turn detection parameters affect end-of-turn detection.

The component renders inline on the page (always visible, no toggle) under the "How it works" section:

  • Three preset buttons (Aggressive / Balanced / Conservative) matching the configs already on the page — no sliders; parameter values are displayed as a static code → value grid below the visualization
  • Speech waveforms rendered as procedurally generated bars for each segment, color-coded by whether confidence meets the threshold (darker = above, lighter = below), each labeled with its confidence score (0.85, 0.35, 0.92)
  • Silence wait bars showing the required silence duration after each segment (green for min_silence_when_confident path, amber for max_turn_silence fallback) — hidden when the silence period extends into the next speech segment
  • EoT markers as vertical lines with labels positioned above the lines showing the triggering parameter name (min_silence or max_silence) and "EoT" text — labels update when switching presets
  • "Turn continues" indicator — a connecting bar and italic label between segments where the required silence period overlaps the next speech segment, showing the turn is not ended
  • Legend using parameter names: "EoT (min_silence_when_confident)" and "EoT (max_turn_silence)"

The two EoT conditions are modeled:

  1. confidence ≥ threshold → EoT after min_end_of_turn_silence_when_confident
  2. confidence < threshold → EoT after max_turn_silence

When the computed EoT time for a segment falls after the next segment's start, the turn is not ended — this is visually highlighted, which is especially visible in Conservative mode where segment 2 (conf 0.35 < threshold 0.7) continues into segment 3.

Updates since last revision

  • Moved EoT labels above vertical lines: The "EoT" text and parameter name labels (min_silence / max_silence) are now positioned above the vertical marker lines instead of behind/below them. Labels use a two-line layout: parameter name (small, gray) on top, "EoT" (bold, colored) below, with the vertical line starting beneath. Container height increased to 140px and all internal elements shifted down to accommodate the labels at the top. This addresses feedback that labels were obscured by the lines.
  • Prior revisions (preserved for context):
    • Always-inline display — removed hyperlink toggle, component renders directly on the page
    • Renamed EoT labels from "Semantic EoT" / "Acoustic EoT" to actual parameter names
    • Removed sliders, preset-only UI with static parameter value grid
    • Restored speech waveforms with procedurally generated bars
    • Fixed turn continuation logic — Conservative mode no longer incorrectly shows EoT between segments 2 and 3
    • Redesigned from complex SVG waveform to simpler visualization
    • Fixed text overflow and "Something went wrong!" rendering error
  • Pre-existing CI failures (fern-check, lint) are unrelated to this PR — fern check confirms [docs]:✓ All checks passed.

Review & Testing Checklist for Human

  • Dark mode readability — EoT marker colors (#22c55e, #f59e0b), waveform bar colors (var(--accent-9), var(--accent-7)), and the "turn continues" bar (var(--accent-5)) should be verified in dark mode. Dark mode was not tested. This is the highest-risk item.
  • EoT label positioning — Verify the "EoT" text and parameter name labels (min_silence / max_silence) appear clearly above the vertical lines and do not overlap with the lines or waveform bars. Labels use absolute positioning at top: 0px within a 140px container; verify they don't clip or collide with content above the visualizer.
  • Turn continuation logic — In Conservative mode, verify that segment 2 (conf 0.35) does NOT show an EoT marker after it, and the "turn continues" indicator appears between segments 2 and 3. In Aggressive/Balanced modes, all 3 segments should show EoT markers.
  • Mobile / narrow viewport — The visualization area has minWidth: "500px" with overflowX: "auto", which will cause horizontal scrolling on small screens. Verify this is acceptable.

Recommended test plan: Run fern docs dev, open localhost:3000/docs/universal-streaming/turn-detection, scroll to "How it works" section. Try each preset button. Verify EoT labels are above the vertical lines. Specifically verify Conservative mode shows "turn continues" between segments 2 and 3 with no EoT marker there. Check in both light and dark mode, and resize browser to ~400px width to test overflow behavior.

Notes

  • Requested by Dan Ince
  • Link to Devin run
  • The component requires an explicit import in the MDX file (not auto-discovered by Fern).
  • Pre-existing lint errors in openapi.yml are unrelated to this PR.

Co-Authored-By: Dan Ince <dince@assemblyai.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Co-Authored-By: Dan Ince <dince@assemblyai.com>
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Co-Authored-By: Dan Ince <dince@assemblyai.com>
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Co-Authored-By: Dan Ince <dince@assemblyai.com>
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

- Replace sliders with preset-only buttons (Aggressive/Balanced/Conservative)
- Display parameter values as text instead of interactive sliders
- Restore speech waveform visualization with confidence-based coloring
- Fix EoT logic: when silence period extends into next speech segment, turn continues
- In conservative mode, segment 2 (conf 0.35 < threshold 0.7) correctly shows turn continuing into segment 3
- Add 'turn continues' indicator between connected segments

Co-Authored-By: Dan Ince <dince@assemblyai.com>
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Co-Authored-By: Dan Ince <dince@assemblyai.com>
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Co-Authored-By: Dan Ince <dince@assemblyai.com>
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Co-Authored-By: Dan Ince <dince@assemblyai.com>
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants