-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: add Qwen CustomVoice preset engine #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4e0c731
72c13fd
e6f419c
b108bb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import { useEffect } from 'react'; | ||
| import { Loader2, Mic } from 'lucide-react'; | ||
| import { Button } from '@/components/ui/button'; | ||
| import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; | ||
|
|
@@ -19,19 +20,41 @@ import { | |
| SelectValue, | ||
| } from '@/components/ui/select'; | ||
| import { Textarea } from '@/components/ui/textarea'; | ||
| import { getLanguageOptionsForEngine } from '@/lib/constants/languages'; | ||
| import { getLanguageOptionsForEngine, type LanguageCode } from '@/lib/constants/languages'; | ||
| import { useGenerationForm } from '@/lib/hooks/useGenerationForm'; | ||
| import { useProfile } from '@/lib/hooks/useProfiles'; | ||
| import { useUIStore } from '@/stores/uiStore'; | ||
| import { EngineModelSelector, getEngineDescription } from './EngineModelSelector'; | ||
| import { EngineModelSelector, applyEngineSelection, getEngineDescription } from './EngineModelSelector'; | ||
| import { ParalinguisticInput } from './ParalinguisticInput'; | ||
|
|
||
| function getEngineSelectValue(engine: string): string { | ||
| if (engine === 'qwen') return 'qwen:1.7B'; | ||
| if (engine === 'qwen_custom_voice') return 'qwen_custom_voice:1.7B'; | ||
| if (engine === 'tada') return 'tada:1B'; | ||
| return engine; | ||
| } | ||
|
Comment on lines
+30
to
+35
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don’t resolve Profiles only persist Suggested fix-function getEngineSelectValue(engine: string): string {
+function getEngineSelectValue(engine: string, profileLanguage?: string): string {
if (engine === 'qwen') return 'qwen:1.7B';
if (engine === 'qwen_custom_voice') return 'qwen_custom_voice:1.7B';
- if (engine === 'tada') return 'tada:1B';
+ if (engine === 'tada') return profileLanguage === 'en' ? 'tada:1B' : 'tada:3B';
return engine;
}
@@
- applyEngineSelection(form, getEngineSelectValue(preferredEngine));
+ applyEngineSelection(
+ form,
+ getEngineSelectValue(preferredEngine, selectedProfile.language),
+ );Also applies to: 52-55 🤖 Prompt for AI Agents |
||
|
|
||
| export function GenerationForm() { | ||
| const selectedProfileId = useUIStore((state) => state.selectedProfileId); | ||
| const { data: selectedProfile } = useProfile(selectedProfileId || ''); | ||
|
|
||
| const { form, handleSubmit, isPending } = useGenerationForm(); | ||
|
|
||
| useEffect(() => { | ||
| if (!selectedProfile) { | ||
| return; | ||
| } | ||
|
|
||
| if (selectedProfile.language) { | ||
| form.setValue('language', selectedProfile.language as LanguageCode); | ||
| } | ||
|
|
||
| const preferredEngine = selectedProfile.default_engine || selectedProfile.preset_engine; | ||
| if (preferredEngine) { | ||
| applyEngineSelection(form, getEngineSelectValue(preferredEngine)); | ||
| } | ||
| }, [form, selectedProfile]); | ||
|
|
||
| async function onSubmit(data: Parameters<typeof handleSubmit>[0]) { | ||
| await handleSubmit(data, selectedProfileId); | ||
| } | ||
|
|
@@ -91,7 +114,7 @@ export function GenerationForm() { | |
| )} | ||
| /> | ||
|
|
||
| {form.watch('engine') === 'qwen' && ( | ||
| {(form.watch('engine') === 'qwen' || form.watch('engine') === 'qwen_custom_voice') && ( | ||
| <FormField | ||
| control={form.control} | ||
| name="instruct" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,12 @@ import { useDeleteProfile, useExportProfile } from '@/lib/hooks/useProfiles'; | |
| import { cn } from '@/lib/utils/cn'; | ||
| import { useUIStore } from '@/stores/uiStore'; | ||
|
|
||
| /** Human-readable display names for preset engine badges. */ | ||
| const ENGINE_DISPLAY_NAMES: Record<string, string> = { | ||
| kokoro: 'Kokoro', | ||
| qwen_custom_voice: 'CustomVoice', | ||
| }; | ||
|
Comment on lines
+20
to
+24
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use the same
Also applies to: 108-108 🤖 Prompt for AI Agents |
||
|
|
||
| interface ProfileCardProps { | ||
| profile: VoiceProfileResponse; | ||
| } | ||
|
|
@@ -99,7 +105,7 @@ export function ProfileCard({ profile }: ProfileCardProps) { | |
| </Badge> | ||
| {profile.voice_type === 'preset' && ( | ||
| <Badge variant="secondary" className="text-xs h-5 px-1.5"> | ||
| {profile.preset_engine} | ||
| {ENGINE_DISPLAY_NAMES[profile.preset_engine ?? ''] ?? profile.preset_engine} | ||
| </Badge> | ||
| )} | ||
| {profile.voice_type === 'designed' && ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restore
selectedProfileinEngineModelSelectorto keep profile-engine compatibility checks active.Dropping
selectedProfilehere bypasses profile-aware engine filtering and auto-correction in the floating flow, so users can keep incompatible engine/profile combinations (behavior now differs fromGenerationForm).🔧 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents