From d0b2cb29c49731da8b3a87914fb48b3eb8329cfe Mon Sep 17 00:00:00 2001 From: bdim404 Date: Wed, 4 Feb 2026 19:09:42 +0800 Subject: [PATCH] feat: Enhance CustomVoiceForm and VoiceDesignForm with user preferences integration --- .../src/components/tts/CustomVoiceForm.tsx | 53 ++++++++++++++----- .../src/components/tts/VoiceDesignForm.tsx | 4 +- 2 files changed, 42 insertions(+), 15 deletions(-) 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) => {