Skip to content

Fix TTS voice/lang defaults using names instead of slugs#11

Merged
dawidope merged 2 commits intomainfrom
fix/tts-voice-lang-slug-resolve
Feb 24, 2026
Merged

Fix TTS voice/lang defaults using names instead of slugs#11
dawidope merged 2 commits intomainfrom
fix/tts-voice-lang-slug-resolve

Conversation

@dawidope
Copy link
Contributor

API model defaults return display names (e.g. "English", "Vivian") but select dropdowns use slugs as values. This caused lang/voice not matching any option on startup, and the voice fallback showing all voices from all languages with duplicate React keys.

  • Add resolveLangSlug/resolveVoiceSlug helpers that match by slug OR name
  • Apply resolution in both auto-defaults effect and handleSetDefaults
  • Match language by slug or name when filtering voices
  • Remove all-voices fallback (return empty until lang is set by effect)

Description

Brief description of changes.

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactoring

Testing

How was this tested?

Checklist

  • Code follows project style guidelines
  • No debug code left in
  • Tested locally
  • Updated README if needed

API model defaults return display names (e.g. "English", "Vivian") but
select dropdowns use slugs as values. This caused lang/voice not matching
any option on startup, and the voice fallback showing all voices from all
languages with duplicate React keys.

- Add resolveLangSlug/resolveVoiceSlug helpers that match by slug OR name
- Apply resolution in both auto-defaults effect and handleSetDefaults
- Match language by slug or name when filtering voices
- Remove all-voices fallback (return empty until lang is set by effect)

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

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes TTS language/voice default selection mismatches by resolving API-provided display names to the slug values used by the form selects, preventing invalid initial selections and duplicate-key issues from the previous “all voices” fallback.

Changes:

  • Added resolveLangSlug / resolveVoiceSlug helpers to map defaults by slug or display name.
  • Applied slug resolution when auto-applying model defaults and when the user clicks “Set defaults”.
  • Updated voice option filtering to match language by slug or name, and removed the “all voices” fallback (returns empty until a language is selected).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Address PR review: replace typeof selectedModel with DeApiModel | undefined
for clarity, and use resolveLangSlug inside resolveVoiceSlug to handle
cases where langSlug is a display name instead of a slug.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dawidope dawidope merged commit fd02337 into main Feb 24, 2026
2 checks passed
@dawidope dawidope deleted the fix/tts-voice-lang-slug-resolve branch February 24, 2026 10:26
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.

3 participants