mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-09-15 04:40:40 -07:00
Refactor useGenerationForm to streamline model download handling
- Removed unnecessary isDownloading variable and related logic. - Consolidated model download state reset to the finally block for improved clarity and reliability. - Enhanced error handling by ensuring model download state is reset in case of failure.
This commit is contained in:
@@ -70,7 +70,6 @@ export function useGenerationForm(options: UseGenerationFormOptions = {}) {
|
||||
const modelName = `qwen-tts-${data.modelSize}`;
|
||||
const displayName = data.modelSize === '1.7B' ? 'Qwen TTS 1.7B' : 'Qwen TTS 0.6B';
|
||||
|
||||
let isDownloading = false;
|
||||
try {
|
||||
const modelStatus = await apiClient.getModelStatus();
|
||||
const model = modelStatus.models.find((m) => m.model_name === modelName);
|
||||
@@ -78,7 +77,6 @@ export function useGenerationForm(options: UseGenerationFormOptions = {}) {
|
||||
if (model && !model.downloaded) {
|
||||
setDownloadingModelName(modelName);
|
||||
setDownloadingDisplayName(displayName);
|
||||
isDownloading = true;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to check model status:', error);
|
||||
@@ -103,21 +101,16 @@ export function useGenerationForm(options: UseGenerationFormOptions = {}) {
|
||||
|
||||
form.reset();
|
||||
options.onSuccess?.(result.id);
|
||||
|
||||
if (isDownloading) {
|
||||
setDownloadingModelName(null);
|
||||
setDownloadingDisplayName(null);
|
||||
}
|
||||
} catch (error) {
|
||||
toast({
|
||||
title: 'Generation failed',
|
||||
description: error instanceof Error ? error.message : 'Failed to generate audio',
|
||||
variant: 'destructive',
|
||||
});
|
||||
setDownloadingModelName(null);
|
||||
setDownloadingDisplayName(null);
|
||||
} finally {
|
||||
setIsGenerating(false);
|
||||
setDownloadingModelName(null);
|
||||
setDownloadingDisplayName(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
[phases.setup]
|
||||
nixPkgs = ["nodejs_20", "bun"]
|
||||
|
||||
[phases.install]
|
||||
cmds = ["bun install"]
|
||||
|
||||
[phases.build]
|
||||
cmds = ["bun run build"]
|
||||
|
||||
[start]
|
||||
cmd = "bun run start"
|
||||
@@ -4,6 +4,8 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "mintlify dev",
|
||||
"build": "mintlify build",
|
||||
"start": "mintlify serve",
|
||||
"install:mintlify": "bun add -g mintlify"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -228,6 +228,29 @@ export default function Home() {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Description Section */}
|
||||
<section className="py-12 sm:py-16 md:py-20">
|
||||
<div className="container mx-auto px-4 sm:px-6 lg:px-8 max-w-4xl">
|
||||
<h2 className="text-3xl sm:text-4xl md:text-5xl font-bold text-center mb-6 sm:mb-8">
|
||||
What is Voicebox?
|
||||
</h2>
|
||||
<div className="space-y-6 text-lg text-foreground/80 text-center">
|
||||
<p>
|
||||
Voicebox is a <strong>local-first voice cloning studio</strong> with DAW-like features
|
||||
for professional voice synthesis. Think of it as the <strong>Ollama for voice</strong>{' '}
|
||||
— download models, clone voices, and generate speech entirely on your machine.
|
||||
</p>
|
||||
<p>
|
||||
Unlike cloud services that lock your voice data behind subscriptions, Voicebox gives
|
||||
you complete privacy, professional tools, and native performance. Download a voice
|
||||
model, clone any voice from a few seconds of audio, and compose multi-voice projects
|
||||
with studio-grade editing tools.
|
||||
</p>
|
||||
<p className="text-foreground/60">No Python install required.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Demo Video Section */}
|
||||
<section className="py-12 sm:py-16 md:py-20">
|
||||
<div className="container mx-auto px-4 sm:px-6 lg:px-8 max-w-7xl">
|
||||
|
||||
Reference in New Issue
Block a user