-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Open
ankit1999
wants to merge
11
commits into
jamiepine:main
Choose a base branch
from
ankit1999:fix/code-review-hardening
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
9c97815
feat: add custom HuggingFace voice model support
ankit1999 a7e698a
fix: harden input validation, file safety, and error handling
ankit1999 888d5a5
fix(review): address second round of code review feedback
ankit1999 10446f1
fix(review): address third round of code review feedback
ankit1999 d983119
fix(review): address fourth round of code review feedback
ankit1999 4447a87
fix(review): address fifth round of code review feedback
ankit1999 ff9c08d
Merge origin/main into feat/custom-voice-models
ankit1999 ae135ae
chore: remove workflow files (will be added separately with workflow …
ankit1999 b7c1200
fix(review): address CodeRabbit feedback on routes/models.py
ankit1999 f338e35
Merge origin/main (catch up with upstream fixes)
ankit1999 c49aec4
fix: resolve PR #225 compilation issues in ModelManagement.tsx
ankit1999 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| 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> | ||
| )} | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.