diff --git a/packages/stage-pages/src/pages/settings/modules/speech.vue b/packages/stage-pages/src/pages/settings/modules/speech.vue index c24ba2db9..2874a0655 100644 --- a/packages/stage-pages/src/pages/settings/modules/speech.vue +++ b/packages/stage-pages/src/pages/settings/modules/speech.vue @@ -15,7 +15,7 @@ import { import { useAnalytics } from '@proj-airi/stage-ui/composables' import { OFFICIAL_SPEECH_PROVIDER_ID } from '@proj-airi/stage-ui/libs/providers/providers/official' import { useAiriCardStore, useVoicePacksStore } from '@proj-airi/stage-ui/stores' -import { useSpeechStore } from '@proj-airi/stage-ui/stores/modules/speech' +import { useSpeechStore, voicePackForSpeechProvider } from '@proj-airi/stage-ui/stores/modules/speech' import { useProvidersStore } from '@proj-airi/stage-ui/stores/providers' import { FieldCheckbox, @@ -26,7 +26,7 @@ import { } from '@proj-airi/ui' import { generateSpeech } from '@xsai/generate-speech' import { storeToRefs } from 'pinia' -import { onMounted, onUnmounted, ref, watch } from 'vue' +import { computed, onMounted, onUnmounted, ref, watch } from 'vue' import { useI18n } from 'vue-i18n' import { RouterLink } from 'vue-router' @@ -66,6 +66,12 @@ const audioUrl = ref('') const audioPlayer = ref(null) const errorMessage = ref('') +const supportsVoicePackSelection = computed(() => activeSpeechProvider.value === OFFICIAL_SPEECH_PROVIDER_ID) +const shouldShowVoicePackSection = computed(() => + supportsVoicePackSelection.value + && (isLoadingVoicePacks.value || voicePacksError.value != null || voicePacks.value.length > 0), +) + function createVoicePackVoice(voicePack: VoicePackSnapshot): VoiceInfo { return { id: voicePack.voiceId, @@ -186,7 +192,7 @@ async function generateTestSpeech() { } } - const voicePack = activeCard.value?.extensions.airi.modules.speech.voicePack + const voicePack = voicePackForSpeechProvider(activeSpeechProvider.value, activeCard.value?.extensions.airi.modules.speech.voicePack) if (voicePack) { model = voicePack.ttsModelId if (!voice || voice.id !== voicePack.voiceId) @@ -318,61 +324,57 @@ function handleDeleteProvider(providerId: string) {
-
-

- {{ t('settings.pages.modules.speech.sections.section.voice-pack.title') }} -

-
- {{ t('settings.pages.modules.speech.sections.section.voice-pack.description') }} -
-
- -
-
- {{ t('settings.pages.modules.speech.sections.section.voice-pack.loading') }} -
- - - -
-