diff --git a/qwen3-tts-frontend/src/components/tts/CustomVoiceForm.tsx b/qwen3-tts-frontend/src/components/tts/CustomVoiceForm.tsx index e162264..82071a7 100644 --- a/qwen3-tts-frontend/src/components/tts/CustomVoiceForm.tsx +++ b/qwen3-tts-frontend/src/components/tts/CustomVoiceForm.tsx @@ -58,6 +58,13 @@ const CustomVoiceForm = forwardRef((_props, ref) => { const { refresh } = useHistoryContext() const { preferences } = useUserPreferences() + const selectedSpeaker = useMemo(() => + unifiedSpeakers.find(s => s.id === selectedSpeakerId), + [unifiedSpeakers, selectedSpeakerId] + ) + + const isInstructDisabled = selectedSpeaker?.source === 'saved-design' + const { register, handleSubmit, @@ -139,6 +146,12 @@ const CustomVoiceForm = forwardRef((_props, ref) => { fetchData() }, [preferences?.default_backend]) + useEffect(() => { + if (selectedSpeaker?.source === 'saved-design' && selectedSpeaker.instruct) { + setValue('instruct', selectedSpeaker.instruct) + } + }, [selectedSpeakerId, selectedSpeaker, setValue]) + const onSubmit = async (data: FormData) => { setIsLoading(true) @@ -208,10 +221,16 @@ const CustomVoiceForm = forwardRef((_props, ref) => {