Skip to content

Display speaker IDs starting from 1 instead of 0#4660

Merged
mdmohsin7 merged 4 commits intomainfrom
4490/speaker-count-from-one
Feb 8, 2026
Merged

Display speaker IDs starting from 1 instead of 0#4660
mdmohsin7 merged 4 commits intomainfrom
4490/speaker-count-from-one

Conversation

@mdmohsin7
Copy link
Member

Summary

  • Updated speaker ID display to start from 1 instead of 0 for better user experience
  • Users are not developers and are not used to counting from 0
  • Changed display in all user-facing locations (transcripts, dialogs, desktop UI)

Technical Details

This is a display-only change - no backend modifications required:

  • Backend continues to store speaker IDs as 0, 1, 2, etc.
  • Display layer adds 1 when showing speaker IDs to users
  • Affects: transcript segments, speaker tags, speaker assignment dialogs

Files Changed

  • app/lib/backend/schema/transcript_segment.dart: segmentsAsString method
  • app/lib/widgets/transcript.dart: speaker label in transcript widget
  • app/lib/desktop/pages/conversations/widgets/desktop_recording_widget.dart: desktop recording speaker labels
  • app/lib/pages/conversation_detail/widgets/name_speaker_sheet.dart: tag speaker dialog
  • app/lib/desktop/pages/conversations/widgets/desktop_name_speaker_dialog.dart: desktop tag speaker dialog
  • app/test/widgets/transcript_test.dart: updated test expectations

Test Plan

  • ✅ All existing tests pass
  • ✅ Updated test expectations to match new display format
  • Manual testing: verify speaker labels now show "Speaker 1", "Speaker 2", etc. instead of "Speaker 0", "Speaker 1", etc.

🤖 Generated with Claude Code

Updated all locations where speaker IDs are displayed to users:
- transcript_segment.dart: segmentsAsString method
- transcript.dart: speaker label in transcript widget
- desktop_recording_widget.dart: speaker label in desktop recording
- name_speaker_sheet.dart: tag speaker dialog title
- desktop_name_speaker_dialog.dart: tag speaker dialog title

Also updated tests to expect the new numbering.

Backend remains unchanged - speaker IDs are still stored as 0, 1, 2, etc.
Only the display layer adds 1 for user-facing representation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly implements the display of speaker IDs starting from 1 instead of 0, which improves user experience. The changes are applied consistently across various UI components. However, I've identified two instances where the 'Speaker' label is hardcoded instead of using the localization framework. This would prevent translation of these labels. I've added comments with suggestions to use the existing l10n keys to ensure full internationalization support.

speakerName = peopleMap[segment.personId]!;
} else {
speakerName = 'Speaker ${segment.speakerId}';
speakerName = 'Speaker ${segment.speakerId + 1}';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The string 'Speaker ' is hardcoded, which prevents localization. To ensure the app can be translated into other languages, you should use the internationalization key speakerWithId available through context.l10n.

This method is static and doesn't have access to BuildContext. Consider refactoring segmentsAsString and its callers (getLastTranscript, _processText) to accept a BuildContext to allow for localization.

Once refactored, this line could be:
speakerName = context.l10n.speakerWithId((segment.speakerId + 1).toString());

A similar issue exists on line 197 with the hardcoded string 'User'.

Comment on lines 529 to 531
data.speakerId == omiSpeakerId
? 'omi'
: (person?.name ?? 'Speaker ${data.speakerId + 1}'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The string 'Speaker ' is hardcoded here, which is not ideal for internationalization. You should use the speakerWithId localization key to support multiple languages, similar to how it's used in desktop_recording_widget.dart.

Suggested change
data.speakerId == omiSpeakerId
? 'omi'
: (person?.name ?? 'Speaker ${data.speakerId + 1}'),
data.speakerId == omiSpeakerId
? 'omi'
: (person?.name ?? context.l10n.speakerWithId((data.speakerId + 1).toString())),

mdmohsin7 and others added 3 commits February 7, 2026 19:37
…missing

Previously, speaker IDs were displayed by simply adding 1 (speaker 0 → "Speaker 1",
speaker 1 → "Speaker 2", etc.). This caused issues when a conversation didn't have
speaker 0 at all (e.g., only speakers 1, 2, 3), which would display as "Speaker 2,
Speaker 3, Speaker 4" and confuse users.

Now, speaker IDs are normalized based on the minimum speaker ID present in each
conversation, ensuring they always start from 1:
- Speakers [0, 1, 2] → Display [1, 2, 3] (unchanged)
- Speakers [1, 2, 3] → Display [1, 2, 3] (normalized)
- Speakers [5, 6] → Display [1, 2] (normalized)

Changes:
- Added TranscriptSegment.getDisplaySpeakerId() helper method that normalizes
  speaker IDs by finding the minimum speaker ID and adjusting all displays
- Updated all locations where speaker IDs are displayed to use the new helper:
  - transcript.dart: Main transcript display
  - transcript_segment.dart: Text export functionality
  - desktop_recording_widget.dart: Desktop live recording view
  - desktop_name_speaker_dialog.dart: Desktop speaker tagging dialog
  - name_speaker_sheet.dart: Mobile speaker tagging sheet

This change only affects UI display; backend speaker_id values remain unchanged,
ensuring speaker assignment functionality continues to work correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@mdmohsin7 mdmohsin7 merged commit d84fa69 into main Feb 8, 2026
1 check passed
@mdmohsin7 mdmohsin7 deleted the 4490/speaker-count-from-one branch February 8, 2026 12:45
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