Skip to content

Commit b9b83fe

Browse files
fix(stage-*): unable to test voice with openai and cosyvoice-v2 in speech module (#579)
1 parent 8d9abc1 commit b9b83fe

File tree

6 files changed

+57
-2
lines changed

6 files changed

+57
-2
lines changed

apps/stage-web/src/pages/settings/modules/speech.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,9 @@ function updateCustomModelName(value: string) {
319319
<VoiceCardManySelect
320320
v-model:search-query="voiceSearchQuery"
321321
v-model:voice-id="activeSpeechVoiceId"
322-
:voices="availableVoices[activeSpeechProvider]?.map(voice => ({
322+
:voices="availableVoices[activeSpeechProvider]?.filter(voice => {
323+
return !voice.compatibleModels || voice.compatibleModels.includes(activeSpeechModel)
324+
}).map(voice => ({
323325
id: voice.id,
324326
name: voice.name,
325327
description: voice.description,
@@ -331,6 +333,8 @@ function updateCustomModelName(value: string) {
331333
:search-no-results-title="t('settings.pages.modules.speech.sections.section.provider-voice-selection.no_voices')"
332334
:search-no-results-description="t('settings.pages.modules.speech.sections.section.provider-voice-selection.no_voices_description')"
333335
:search-results-text="t('settings.pages.modules.speech.sections.section.provider-voice-selection.search_voices_results', { count: 0, total: 0 })"
336+
:unsupported-voice-warning-title="t('settings.pages.modules.speech.sections.section.provider-voice-selection.unsupported_voice_warning_title')"
337+
:unsupported-voice-warning-content="t('settings.pages.modules.speech.sections.section.provider-voice-selection.unsupported_voice_warning_content')"
334338
:custom-input-placeholder="t('settings.pages.modules.speech.sections.section.provider-voice-selection.custom_voice_placeholder')"
335339
:expand-button-text="t('settings.pages.modules.speech.sections.section.provider-voice-selection.show_more')"
336340
:collapse-button-text="t('settings.pages.modules.speech.sections.section.provider-voice-selection.show_less')"

packages/i18n/src/locales/en/settings.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ pages:
239239
search_models_results: Found {count} of {total} models
240240
search_voices_placeholder: Search voices...
241241
search_voices_results: Found {count} of {total} voices
242+
unsupported_voice_warning_title: No supported voices
243+
unsupported_voice_warning_content: Try a different model or provider. We are working on supporting all the voice for this model as quickly as possible. If you need it urgently, please let us know on GitHub at https://github.com/moeru-ai/airi/issues.
242244
show_less: Show less
243245
show_more: Show more
244246
title: Provider

packages/i18n/src/locales/zh-Hans/settings.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ pages:
214214
search_models_results: 找到 {count} / {total} 个模型
215215
search_voices_placeholder: 搜索声线...
216216
search_voices_results: 找到 {count} / {total} 个声线
217+
unsupported_voice_warning_title: 没有支持的声线
218+
unsupported_voice_warning_content: 我们正在尽快支持该模型的所有音色,如果你迫切希望支持该模型音色,请在 GitHub 上联系我们 https://github.com/moeru-ai/airi/issues
217219
show_less: 显示更少
218220
show_more: 显示更多
219221
title: 选择语音合成服务来源

packages/stage-ui/src/components/Menu/VoiceCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ function togglePlayback() {
151151
v-else
152152
class="mt-auto w-full flex items-center justify-center bg-neutral-50 py-3 text-xs text-neutral-400 italic dark:bg-neutral-800/50 dark:text-neutral-600"
153153
>
154-
No preview available
154+
No preview available. You can select it and test voice on the right experiment.
155155
</div>
156156

157157
<!-- Voice info -->

packages/stage-ui/src/components/Menu/VoiceCardManySelect.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ interface Props {
3434
searchNoResultsTitle?: string
3535
searchNoResultsDescription?: string
3636
searchResultsText?: string
37+
unsupportedVoiceWarningTitle?: string
38+
unsupportedVoiceWarningContent?: string
3739
customInputPlaceholder?: string
3840
expandButtonText?: string
3941
collapseButtonText?: string
@@ -49,6 +51,8 @@ const props = withDefaults(defineProps<Props>(), {
4951
searchNoResultsTitle: 'No voices found',
5052
searchNoResultsDescription: 'Try a different search term',
5153
searchResultsText: '{count} of {total} voices',
54+
unsupportedVoiceWarningTitle: 'No voices',
55+
unsupportedVoiceWarningContent: 'Try a different model or provider. We are working on supporting all the voice for this model as quickly as possible. If you need it urgently, please let us know on GitHub.',
5256
customInputPlaceholder: 'Enter custom voice name',
5357
expandButtonText: 'Show more',
5458
collapseButtonText: 'Show less',
@@ -350,6 +354,16 @@ const customVoiceName = ref('')
350354
transition="all duration-200 ease-in-out"
351355
style="scroll-snap-type: x mandatory;"
352356
>
357+
<!-- Not support voices warning -->
358+
<Alert v-if="!searchQuery && filteredVoices.length === 0" type="warning">
359+
<template #title>
360+
{{ unsupportedVoiceWarningTitle }}
361+
</template>
362+
<template #content>
363+
{{ unsupportedVoiceWarningContent }}
364+
</template>
365+
</Alert>
366+
353367
<!-- Voice card with preview button -->
354368
<VoiceCard
355369
v-for="voice in filteredVoices"

packages/stage-ui/src/stores/providers.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ export interface VoiceInfo {
153153
id: string
154154
name: string
155155
provider: string
156+
compatibleModels?: string[]
156157
description?: string
157158
gender?: string
158159
deprecated?: boolean
@@ -769,69 +770,100 @@ export const useProvidersStore = defineStore('providers', () => {
769770
name: 'Alloy',
770771
provider: 'openai-audio-speech',
771772
languages: [],
773+
compatibleModels: ['tts-1', 'tts-1-hd'],
772774
},
773775
{
774776
id: 'ash',
775777
name: 'Ash',
776778
provider: 'openai-audio-speech',
777779
languages: [],
780+
compatibleModels: ['tts-1', 'tts-1-hd'],
778781
},
779782
{
780783
id: 'ballad',
781784
name: 'Ballad',
782785
provider: 'openai-audio-speech',
783786
languages: [],
787+
compatibleModels: ['tts-1', 'tts-1-hd'],
784788
},
785789
{
786790
id: 'coral',
787791
name: 'Coral',
788792
provider: 'openai-audio-speech',
789793
languages: [],
794+
compatibleModels: ['tts-1', 'tts-1-hd'],
790795
},
791796
{
792797
id: 'echo',
793798
name: 'Echo',
794799
provider: 'openai-audio-speech',
795800
languages: [],
801+
compatibleModels: ['tts-1', 'tts-1-hd'],
796802
},
797803
{
798804
id: 'fable',
799805
name: 'Fable',
800806
provider: 'openai-audio-speech',
801807
languages: [],
808+
compatibleModels: ['tts-1', 'tts-1-hd'],
802809
},
803810
{
804811
id: 'onyx',
805812
name: 'Onyx',
806813
provider: 'openai-audio-speech',
807814
languages: [],
815+
compatibleModels: ['tts-1', 'tts-1-hd'],
808816
},
809817
{
810818
id: 'nova',
811819
name: 'Nova',
812820
provider: 'openai-audio-speech',
813821
languages: [],
822+
compatibleModels: ['tts-1', 'tts-1-hd'],
814823
},
815824
{
816825
id: 'sage',
817826
name: 'Sage',
818827
provider: 'openai-audio-speech',
819828
languages: [],
829+
compatibleModels: ['tts-1', 'tts-1-hd'],
820830
},
821831
{
822832
id: 'shimmer',
823833
name: 'Shimmer',
824834
provider: 'openai-audio-speech',
825835
languages: [],
836+
compatibleModels: ['tts-1', 'tts-1-hd'],
826837
},
827838
{
828839
id: 'verse',
829840
name: 'Verse',
830841
provider: 'openai-audio-speech',
831842
languages: [],
843+
compatibleModels: ['tts-1', 'tts-1-hd'],
832844
},
833845
] satisfies VoiceInfo[]
834846
},
847+
listModels: async () => {
848+
return [
849+
{
850+
id: 'tts-1',
851+
name: 'TTS-1',
852+
provider: 'openai-audio-speech',
853+
description: '',
854+
contextLength: 0,
855+
deprecated: false,
856+
},
857+
{
858+
id: 'tts-1-hd',
859+
name: 'TTS-1-HD',
860+
provider: 'openai-audio-speech',
861+
description: '',
862+
contextLength: 0,
863+
deprecated: false,
864+
},
865+
]
866+
},
835867
},
836868
validators: {
837869
validateProviderConfig: (config) => {
@@ -1244,6 +1276,7 @@ export const useProvidersStore = defineStore('providers', () => {
12441276
id: voice.id,
12451277
name: voice.name,
12461278
provider: 'alibaba-cloud-model-studio',
1279+
compatibleModels: voice.compatible_models,
12471280
previewURL: voice.preview_audio_url,
12481281
languages: voice.languages,
12491282
gender: voice.labels?.gender,

0 commit comments

Comments
 (0)