Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Separate downloadable generators in settings

Bitti0eb114d0046e
diff --git a/docs/generator-weights.md b/docs/generator-weights.md
index 156eba1..4f3527a 100644
--- a/docs/generator-weights.md
+++ b/docs/generator-weights.md
@@ -4,7 +4,12 @@ In Settings → Generator, edit a template and enter local paths or HTTP/HTTPS
download URLs. Hugging Face `blob` links are converted to direct file downloads.
The bundled **Minimax H3 Original** template contains the four supplied model URLs.
-Open **Download variants** under a weight to add alternative URLs. Each variant
+Templates awaiting downloads appear under **Downloadable generators**. Once their
+weights are downloaded, they move into **Generators**. Removing or losing their
+downloaded files moves them back to **Downloadable generators**.
+
+Enable **Show advanced options** at the end of the template editor, then open
+**Download variants** under a weight to add alternative URLs. Each variant
can specify part of a GPU model name and a minimum VRAM capacity in GB. Selection
prefers a matching GPU-specific variant, then the highest memory tier that fits;
ties preserve the listed order. Leave the GPU field blank and VRAM at zero for a
diff --git a/src/components/SettingsView.downloads.test.tsx b/src/components/SettingsView.downloads.test.tsx
index 31b371a..12430a8 100644
--- a/src/components/SettingsView.downloads.test.tsx
+++ b/src/components/SettingsView.downloads.test.tsx
@@ -49,6 +49,8 @@ it("keeps downloading with Settings closed and restores progress in the template
act(() => progress({ payload: { requestId: pending[0].requestId, downloaded: 50, total: 100 } }));
const fill = screen.getByRole("progressbar", { name: "Downloading Minimax H3 Original weights" });
expect(fill.closest(".generator-template-item")).not.toBeNull();
+ expect(within(screen.getByRole("list", { name: "Downloadable generators" })).getByRole("progressbar")).toBe(fill);
+ expect(within(screen.getByRole("list", { name: "Generators" })).queryByText("Minimax H3 Original")).toBeNull();
expect(fill).toHaveStyle({ width: "12.5%" });
fireEvent.click(screen.getByRole("button", { name: "Close settings" }));
await act(async () => pending[0].finish());
@@ -77,15 +79,21 @@ it("keeps downloading with Settings closed and restores progress in the template
it("downloads the sample, enables its default choice, and removes only weights to restore the download action", async () => {
render(<SettingsView onClose={() => undefined} />);
const radio = () => screen.getByRole("radio", { name: "Use Minimax H3 Original as the default generator" });
+ expect(within(screen.getByRole("list", { name: "Generators" })).getByText("Default")).toBeInTheDocument();
+ expect(within(screen.getByRole("list", { name: "Downloadable generators" })).getByText("Minimax H3 Original")).toBeInTheDocument();
expect(radio()).toBeDisabled();
expect(screen.queryByRole("button", { name: "Remove generator Minimax H3 Original" })).toBeNull();
fireEvent.click(screen.getByRole("button", { name: "Download generator Minimax H3 Original" }));
const remove = await screen.findByRole("button", { name: "Remove downloaded weights for Minimax H3 Original" });
+ expect(within(screen.getByRole("list", { name: "Generators" })).getByText("Minimax H3 Original")).toBeInTheDocument();
+ expect(screen.queryByRole("list", { name: "Downloadable generators" })).toBeNull();
expect(radio()).toBeEnabled();
fireEvent.click(radio());
await waitFor(() => expect(loadGeneratorTemplateSettings().defaultTemplateId).toBe("minimax-h3-original"));
fireEvent.click(remove);
expect(await screen.findByRole("button", { name: "Download generator Minimax H3 Original" })).toBeEnabled();
+ expect(within(screen.getByRole("list", { name: "Downloadable generators" })).getByText("Minimax H3 Original")).toBeInTheDocument();
+ expect(within(screen.getByRole("list", { name: "Generators" })).queryByText("Minimax H3 Original")).toBeNull();
expect(radio()).toBeDisabled();
expect(files.size).toBe(0);
expect(loadGeneratorTemplateSettings().templates.find((template) => template.id === "minimax-h3-original")?.paths.transformer).toMatch(/^https:/);
@@ -103,6 +111,11 @@ it("restores a deleted downloaded file when Settings regains focus", async () =>
it("stores multiple variants and their GPU and VRAM criteria in the editor", async () => {
render(<SettingsView onClose={() => undefined} />);
fireEvent.click(screen.getByRole("button", { name: "Edit Minimax H3 Original generator" }));
+ const advanced = screen.getByRole("checkbox", { name: "Show advanced options" });
+ expect(advanced).not.toBeChecked();
+ expect(screen.queryByText(/Download variants/)).toBeNull();
+ expect(advanced.closest(".generator-editor")?.lastElementChild).toBe(advanced.closest("label"));
+ fireEvent.click(advanced);
const weight = screen.getByLabelText("Transformer weights").closest(".settings-path")!;
const details = weight.querySelector("details")!;
fireEvent.click(within(weight as HTMLElement).getByText("Download variants (1)"));
@@ -114,4 +127,12 @@ it("stores multiple variants and their GPU and VRAM criteria in the editor", asy
fireEvent.blur(gpu);
fireEvent.change(screen.getByLabelText("Transformer weights variant 2 minimum VRAM"), { target: { value: "32" } });
await waitFor(() => expect(loadGeneratorTemplateSettings().templates.find((template) => template.id === "minimax-h3-original")?.sources?.transformer?.[1]).toMatchObject({ url: "https://example.com/larger.safetensors", gpuModel: "RTX 5090", minVramGb: 32 }));
+ fireEvent.click(advanced);
+ expect(screen.queryByText(/Download variants/)).toBeNull();
+ fireEvent.click(advanced);
+ expect(screen.getByLabelText("Transformer weights variant 2 GPU model")).toHaveValue("RTX 5090");
+ fireEvent.click(screen.getByRole("button", { name: "Generators" }));
+ fireEvent.click(screen.getByRole("button", { name: "Edit Default generator" }));
+ expect(screen.getByRole("checkbox", { name: "Show advanced options" })).not.toBeChecked();
+ expect(screen.queryByText(/Download variants/)).toBeNull();
});
diff --git a/src/components/SettingsView.tsx b/src/components/SettingsView.tsx
index 8f4fb5b..1af0472 100644
--- a/src/components/SettingsView.tsx
+++ b/src/components/SettingsView.tsx
@@ -261,6 +261,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl
const downloadState = useSyncExternalStore(subscribeWeightDownloads, getWeightDownloadState);
const downloadPercent = downloadState ? weightDownloadProgress(downloadState) : 0;
const [editingTemplateId, setEditingTemplateId] = useState<string | null>(null);
+ const [showAdvancedOptions, setShowAdvancedOptions] = useState(false);
const [status, setStatus] = useState<SlopfabStatus | null>(null);
const probeRevision = useRef(0);
const [error, setError] = useState<string | null>(null);
@@ -271,6 +272,12 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl
?? defaultTemplate;
const settings = selectedTemplate.paths;
const downloading = downloadState?.active && downloadState.templateId === selectedTemplate.id;
+ const generatorSections = [
+ { id: "generators", title: "Generators", templates: templateSettings.templates.filter((template) => !templateNeedsDownload(template)) },
+ { id: "downloadable-generators", title: "Downloadable generators", templates: templateSettings.templates.filter(templateNeedsDownload) },
+ ];
+
+ useEffect(() => setShowAdvancedOptions(false), [editingTemplateId]);
useEffect(() => subscribeGeneratorTemplates(() => setTemplateSettings(loadGeneratorTemplateSettings())), []);
useEffect(() => {
@@ -480,16 +487,16 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl
aria-labelledby={editingTemplateId ? "generator-editor-heading" : "settings-tab-engine"}
>
{!editingTemplateId && <ReferenceIconSetting />}
- {!editingTemplateId ? <section className="generator-templates" aria-labelledby="generators-heading">
+ {!editingTemplateId ? <>{generatorSections.filter((section) => section.id === "generators" || section.templates.length > 0).map((section) => <section key={section.id} className="generator-templates" aria-labelledby={`${section.id}-heading`}>
<header>
<div>
- <h2 id="generators-heading">Generators</h2>
- <p>Choose the generator used by default, or open one to edit its model setup.</p>
+ <h2 id={`${section.id}-heading`}>{section.title}</h2>
+ {section.id === "generators" && <p>Choose the generator used by default, or open one to edit its model setup.</p>}
</div>
- <button type="button" className="secondary-button" onClick={addTemplate}><Plus size={16} /> New generator</button>
+ {section.id === "generators" && <button type="button" className="secondary-button" onClick={addTemplate}><Plus size={16} /> New generator</button>}
</header>
- <div className="generator-template-list" role="list" aria-label="Generators">
- {templateSettings.templates.map((template) => (
+ <div className="generator-template-list" role="list" aria-label={section.title}>
+ {section.templates.map((template) => (
<div className={`generator-template-item${template.id === templateSettings.defaultTemplateId ? " generator-template-item--selected" : ""}`} role="listitem" key={template.id}>
{downloadState?.active && downloadState.templateId === template.id && <span
className="generator-template-item__progress"
@@ -515,7 +522,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl
</div>
))}
</div>
- </section> : <div className="generator-editor">
+ </section>)}</> : <div className="generator-editor">
<header className="generator-editor__head">
<div>
<h2 id="generator-editor-heading">Edit generator</h2>
@@ -579,10 +586,14 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl
{stateLabel[state]}
</span>
</div>
- <WeightSourcesEditor label={field.label} sources={selectedTemplate.sources?.[field.id] ?? []} disabled={Boolean(downloading)} onChange={(sources) => updateSources(field.id, sources)} />
+ {showAdvancedOptions && <WeightSourcesEditor label={field.label} sources={selectedTemplate.sources?.[field.id] ?? []} disabled={Boolean(downloading)} onChange={(sources) => updateSources(field.id, sources)} />}
</div>
);
})}
+ <label className="generator-editor__advanced">
+ <input type="checkbox" checked={showAdvancedOptions} onChange={(event) => setShowAdvancedOptions(event.target.checked)} />
+ <span>Show advanced options</span>
+ </label>
</div>}
</section>}
</div>
diff --git a/src/styles/shell.css b/src/styles/shell.css
index f12f271..21f2ab0 100644
--- a/src/styles/shell.css
+++ b/src/styles/shell.css
@@ -353,6 +353,16 @@
margin-bottom: var(--space-4);
}
+.generator-editor__advanced {
+ display: flex;
+ align-items: center;
+ gap: var(--space-2);
+ margin-top: var(--space-3);
+ color: var(--text-secondary);
+ font-size: var(--text-sm);
+ cursor: pointer;
+}
+
.diagnostics-backend {
grid-template-columns: 180px minmax(0, 1fr);
align-items: center;