Skip to content

Feat/azure ai services#372

Open
jaumemir wants to merge 8 commits intoTHU-MAIC:mainfrom
jaumemir:feat/azure-ai-services
Open

Feat/azure ai services#372
jaumemir wants to merge 8 commits intoTHU-MAIC:mainfrom
jaumemir:feat/azure-ai-services

Conversation

@jaumemir
Copy link
Copy Markdown

@jaumemir jaumemir commented Apr 4, 2026

Summary

Adds a new azure-foundry-tts TTS provider for Azure AI Foundry (multi-service Cognitive Services endpoints), including support for premium DragonHD Neural voices. Also fixes a pre-existing bug in generateAzureTTS where xml:lang was hardcoded to zh-CN regardless of the selected voice.

Related Issues

Changes

  • lib/audio/types.ts — Added 'azure-foundry-tts' to the TTSProviderId union
  • lib/audio/constants.ts — Registered the new provider with 20 voices: standard Neural, Multilingual Neural (AvaMultilingual, AndrewMultilingual, AdamMultilingual), and premium DragonHD Neural (en-US-Ava:DragonHDLatestNeural, etc.) covering en-US, zh-CN, ca-ES, es-ES
  • lib/audio/tts-providers.ts — Added getVoiceLanguage() helper to extract BCP-47 from any Azure voice ID; fixed xml:lang hardcoding bug in generateAzureTTS; added generateAzureFoundryTTS() using the custom domain path /tts/cognitiveservices/v1 (required for *.cognitiveservices.azure.com endpoints per Microsoft docs); added case 'azure-foundry-tts' to the generateTTS() dispatch switch
  • lib/store/settings.ts — Added 'azure-foundry-tts' entry in default ttsProvidersConfig
  • lib/server/provider-config.ts — Added TTS_AZURE_FOUNDRY: 'azure-foundry-tts' to TTS_ENV_MAP (enables TTS_AZURE_FOUNDRY_API_KEY / TTS_AZURE_FOUNDRY_BASE_URL env vars)
  • lib/i18n/settings.ts — Added providerAzureFoundryTTS: 'Azure AI Foundry TTS' to all locale exports
  • components/settings/tts-settings.tsx — Added voice selector dropdown; added URL preview for azure-foundry-tts; provider label mapping
  • components/settings/audio-settings.tsx — Added voice selector for all providers with voices defined in constants
  • components/settings/index.tsx / components/generation/media-popover.tsx — Added provider label mapping

Type of Change

  • Bug fix (non-breaking change that fixes an issue) — xml:lang hardcoding in generateAzureTTS
  • New feature (non-breaking change that adds functionality) — azure-foundry-tts provider

Verification

Steps to reproduce / test

  1. Go to Settings → TTS → select "Azure AI Foundry TTS"
  2. Enter the API Key and Base URL (https://<your-resource>.cognitiveservices.azure.com)
  3. Verify the Request URL preview shows .../tts/cognitiveservices/v1
  4. Select a voice from the dropdown (e.g. en-US-Ava:DragonHDLatestNeural)
  5. Click "Test TTS" — audio should play successfully
  6. Switch back to "Azure TTS" with a non-Chinese voice — verify xml:lang in the SSML now matches the voice locale

What you personally verified

  • Provider appears in all TTS provider lists with the correct label
  • Voice selector shows all 20 voices grouped by standard/multilingual/DragonHD
  • TTS synthesis works end-to-end against a real Azure AI Foundry resource (Sweden Central)
  • Correct endpoint path /tts/cognitiveservices/v1 resolves the Resource Not Found 404 that affected custom domain endpoints
  • Error messages are descriptive when Base URL is unconfigured or the API key is missing

Evidence

  • CI passes (pnpm check && pnpm lint && npx tsc --noEmit)
  • Manually tested locally against Azure AI Foundry (Sweden Central)
  • Screenshots / recordings attached (if UI changes)

Development

Development realized by Claude Code, under supervision of Author.

Miralles Solé and others added 8 commits April 4, 2026 00:06
- Add 'azure-foundry-tts' to TTSProviderId union type
- Register azure-foundry-tts provider in constants.ts with standard Neural
  and premium DragonHD voices (en-US, zh-CN, ca-ES, es-ES)
- Add getVoiceLanguage() helper to extract BCP-47 locale from Azure voice ID
- Fix xml:lang hardcoded 'zh-CN' bug in generateAzureTTS (now dynamic)
- Add generateAzureFoundryTTS() using multi-service Cognitive Services URL
- Wire new provider into generateTTS() switch, settings store, env map and i18n

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…mponents

The provider name mapping in audio-settings.tsx, settings/index.tsx and
media-popover.tsx was missing the 'azure-foundry-tts' entry, causing the
sidebar label to appear blank.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…y-tts voices

- Add voice Select dropdown to audio-settings.tsx for all providers with
  voices defined in constants (excludes azure-tts which uses its own
  locale-filter + big JSON approach)
- Add Multilingual Neural voices: AvaMultilingual, AndrewMultilingual,
  AdamMultilingual
- Add Adam:DragonHDLatestNeural HD voice
- Voices list now totals 20 entries covering en-US, zh-CN, ca-ES, es-ES

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s URL preview

- Add voice Select dropdown to tts-settings.tsx for all providers with
  voices in constants (syncs to global store when provider is active,
  uses local state when testing a non-active provider)
- Add 'azure-foundry-tts' to URL preview switch (/cognitiveservices/v1)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Detect unconfigured {resource} placeholder and throw clear message
- Validate API key presence before making the request
- Include HTTP status code, response body and actual endpoint URL in errors
- Strip trailing slash from base URL before appending path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rvices/v1

Custom domain endpoints (*.cognitiveservices.azure.com) require the /tts/
prefix before /cognitiveservices/v1, unlike regional endpoints which use
just /cognitiveservices/v1 directly on the TTS subdomain.

Ref: https://learn.microsoft.com/azure/ai-services/speech-service/speech-services-private-link
Standard: {region}.tts.speech.microsoft.com/cognitiveservices/v1
Custom:   {custom}.cognitiveservices.azure.com/tts/cognitiveservices/v1

Also update URL preview in tts-settings.tsx to show the correct path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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