-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix: harden input validation, file safety, and error handling #227
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 2 commits
9c97815
a7e698a
888d5a5
10446f1
d983119
4447a87
ff9c08d
ae135ae
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 | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,13 +14,16 @@ import { Input } from '@/components/ui/input'; | |||||||||||||||||||||
| import { | ||||||||||||||||||||||
| Select, | ||||||||||||||||||||||
| SelectContent, | ||||||||||||||||||||||
| SelectGroup, | ||||||||||||||||||||||
| SelectItem, | ||||||||||||||||||||||
| SelectLabel, | ||||||||||||||||||||||
|
Comment on lines
+18
to
+20
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. Remove unused imports.
🧹 Proposed fix to remove unused imports import {
Select,
SelectContent,
- SelectGroup,
SelectItem,
- SelectLabel,
SelectTrigger,
SelectValue,
} from '@/components/ui/select';📝 Committable suggestion
Suggested change
🧰 Tools🪛 Biome (2.4.11)[error] 18-20: Several of these imports are unused. (lint/correctness/noUnusedImports) 🤖 Prompt for AI Agents |
||||||||||||||||||||||
| SelectTrigger, | ||||||||||||||||||||||
| SelectValue, | ||||||||||||||||||||||
| } from '@/components/ui/select'; | ||||||||||||||||||||||
| import { Textarea } from '@/components/ui/textarea'; | ||||||||||||||||||||||
| import { LANGUAGE_OPTIONS } from '@/lib/constants/languages'; | ||||||||||||||||||||||
| import { useGenerationForm } from '@/lib/hooks/useGenerationForm'; | ||||||||||||||||||||||
| import { useModelStatus } from '@/lib/hooks/useModelStatus'; | ||||||||||||||||||||||
| import { useProfile } from '@/lib/hooks/useProfiles'; | ||||||||||||||||||||||
| import { useUIStore } from '@/stores/uiStore'; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -30,6 +33,9 @@ export function GenerationForm() { | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| const { form, handleSubmit, isPending } = useGenerationForm(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Use shared hook for model status fetching and grouping | ||||||||||||||||||||||
| const { builtInModels, customModels } = useModelStatus(); | ||||||||||||||||||||||
|
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. Prevent built-in/custom option overlap from hook classification.
🔧 Proposed fix (in
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| async function onSubmit(data: Parameters<typeof handleSubmit>[0]) { | ||||||||||||||||||||||
| await handleSubmit(data, selectedProfileId); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
@@ -129,19 +135,46 @@ export function GenerationForm() { | |||||||||||||||||||||
| name="modelSize" | ||||||||||||||||||||||
| render={({ field }) => ( | ||||||||||||||||||||||
| <FormItem> | ||||||||||||||||||||||
| <FormLabel>Model Size</FormLabel> | ||||||||||||||||||||||
| <FormLabel>Model</FormLabel> | ||||||||||||||||||||||
| <Select onValueChange={field.onChange} defaultValue={field.value}> | ||||||||||||||||||||||
| <FormControl> | ||||||||||||||||||||||
| <SelectTrigger> | ||||||||||||||||||||||
| <SelectValue /> | ||||||||||||||||||||||
| </SelectTrigger> | ||||||||||||||||||||||
| </FormControl> | ||||||||||||||||||||||
| <SelectContent> | ||||||||||||||||||||||
| <SelectItem value="1.7B">Qwen TTS 1.7B (Higher Quality)</SelectItem> | ||||||||||||||||||||||
| <SelectItem value="0.6B">Qwen TTS 0.6B (Faster)</SelectItem> | ||||||||||||||||||||||
| <SelectGroup> | ||||||||||||||||||||||
| <SelectLabel>Built-in</SelectLabel> | ||||||||||||||||||||||
| {builtInModels.length > 0 ? ( | ||||||||||||||||||||||
| builtInModels.map((model) => { | ||||||||||||||||||||||
| // Map model_name (qwen-tts-1.7B) back to model_size value (1.7B) | ||||||||||||||||||||||
| const sizeValue = model.model_name.replace('qwen-tts-', ''); | ||||||||||||||||||||||
| return ( | ||||||||||||||||||||||
| <SelectItem key={model.model_name} value={sizeValue}> | ||||||||||||||||||||||
| {model.display_name} | ||||||||||||||||||||||
| </SelectItem> | ||||||||||||||||||||||
| ); | ||||||||||||||||||||||
| }) | ||||||||||||||||||||||
| ) : ( | ||||||||||||||||||||||
| <> | ||||||||||||||||||||||
| <SelectItem value="1.7B">Qwen TTS 1.7B (Higher Quality)</SelectItem> | ||||||||||||||||||||||
| <SelectItem value="0.6B">Qwen TTS 0.6B (Faster)</SelectItem> | ||||||||||||||||||||||
| </> | ||||||||||||||||||||||
| )} | ||||||||||||||||||||||
| </SelectGroup> | ||||||||||||||||||||||
| {customModels.length > 0 && ( | ||||||||||||||||||||||
| <SelectGroup> | ||||||||||||||||||||||
| <SelectLabel>Custom</SelectLabel> | ||||||||||||||||||||||
| {customModels.map((model) => ( | ||||||||||||||||||||||
| <SelectItem key={model.model_name} value={model.model_name}> | ||||||||||||||||||||||
| {model.display_name} | ||||||||||||||||||||||
| </SelectItem> | ||||||||||||||||||||||
| ))} | ||||||||||||||||||||||
| </SelectGroup> | ||||||||||||||||||||||
| )} | ||||||||||||||||||||||
| </SelectContent> | ||||||||||||||||||||||
| </Select> | ||||||||||||||||||||||
| <FormDescription>Larger models produce better quality</FormDescription> | ||||||||||||||||||||||
| <FormDescription>Select voice generation model</FormDescription> | ||||||||||||||||||||||
| <FormMessage /> | ||||||||||||||||||||||
| </FormItem> | ||||||||||||||||||||||
| )} | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
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.
Remove unused imports.
SelectGroupandSelectLabelare imported but never used in this component.🧹 Proposed fix to remove unused imports
import { Select, SelectContent, - SelectGroup, SelectItem, - SelectLabel, SelectTrigger, SelectValue, } from '@/components/ui/select';📝 Committable suggestion
🧰 Tools
🪛 Biome (2.4.11)
[error] 11-13: Several of these imports are unused.
(lint/correctness/noUnusedImports)
🤖 Prompt for AI Agents