Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Summary

When participants are specified for a session, the number of speakers in the transcript should not exceed the number of participants. This PR modifies the segment builder to clamp speaker_index values from STT providers using modulo when numSpeakers is specified.

How it works: If numSpeakers is 2 and the STT provider returns speaker_index values of 0, 1, 2, 3, they get mapped to 0, 1, 0, 1 respectively (using speaker_index % numSpeakers).

Files changed:

  • apps/desktop/src/utils/segment/index.ts - Added clamping logic in createSpeakerState
  • apps/desktop/src/utils/segment/segment.test.ts - Added 3 test cases for the new behavior

Review & Testing Checklist for Human

  • Verify modulo behavior is correct: The implementation uses modulo to wrap speaker indices. For example, with 2 participants, speaker 5 becomes speaker 1 (5 % 2 = 1). Confirm this is the desired behavior vs simply capping at the max index.
  • Test with actual recording: Create a session with 2 participants specified, then record audio with multiple speakers. Verify the transcript shows at most 2 distinct speakers.
  • Edge case: single participant: Test with numSpeakers = 1 to ensure all words are assigned to speaker 0.

Notes

  • The numSpeakers value comes from useSessionSpeakers hook which returns the count of session participants
  • When numSpeakers is undefined or 0, the behavior is unchanged (no clamping)

Requested by: @ComputelessComputer
Link to Devin run: https://app.devin.ai/sessions/f863e3124e784cf2bdd1f6d0ddf00982

@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 that start with 'DevinAI' or '@devin'.
  • 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

@netlify
Copy link

netlify bot commented Feb 1, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit d1b3545
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/697e9abcd3bafe0009f1343e

@netlify
Copy link

netlify bot commented Feb 1, 2026

Deploy Preview for hyprnote canceled.

Name Link
🔨 Latest commit d1b3545
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/697e9abca4e83e0008da37d0

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.

1 participant