AI media harness for planning, generating, and editing locally
TypeScript
Add named Minimax generator variants
Bittib3bdbb65e71b
diff --git a/docs/generator-weights.md b/docs/generator-weights.mdindex 3d5e70a..e2af00e 100644--- a/docs/generator-weights.md+++ b/docs/generator-weights.md@@ -2,13 +2,19 @@In Settings → Generator, edit a template and enter local paths or HTTP/HTTPSdownload URLs. Hugging Face `blob` links are converted to direct file downloads.-The bundled **Minimax H3 Original** template downloads four model files.-Its text encoder download uses the original Qwen3-VL 32B encoder on all GPUs.+The bundled **First/Last Frame** (formerly **Minimax H3 Original**),+**References**, and **First/Last Frame Fast** templates each download four model files. References has the same+settings, with the `minimax_h3_ref2va_pruned_int8_convrot.safetensors` transformer+in place of the First/Last Frame `minimax_h3_fl2va_pruned_int8_convrot.safetensors`.+First/Last Frame Fast uses `minimax_h3_fl2va_fasth3_dense_pruned_int8_convrot.safetensors`+and defaults to **6 steps**; its other settings are identical. The other two+templates default to 20 steps.+All three text encoder downloads use the original Qwen3-VL 32B encoder on all GPUs.The incompatible 4B INT4 ConvRot option is removed from saved Minimax templates;templates using its downloaded file switch back to the original encoder, whichmay need downloading. The old file is left on disk.-Its transformer uses the hybrid W4A8 model at 20 GB or less-and the original INT8 model above 20 GB; unknown hardware uses the W4A8 fallback.+All three templates use the hybrid W4A8 transformer at 20 GB or less+and their respective INT8 transformer above 20 GB; unknown hardware uses the W4A8 fallback.Other local weights and customized download variants are preserved.Templates awaiting downloads appear under **Download**. Once theirdiff --git a/src/components/SettingsView.downloads.test.tsx b/src/components/SettingsView.downloads.test.tsxindex 8d5f89c..a9ca201 100644--- a/src/components/SettingsView.downloads.test.tsx+++ b/src/components/SettingsView.downloads.test.tsx@@ -44,13 +44,13 @@ it("keeps downloading with Settings closed and restores progress in the template} }));});const settings = render(<SettingsView onClose={() => settings.unmount()} />);- fireEvent.click(screen.getByRole("button", { name: "Download generator Minimax H3 Original" }));+ fireEvent.click(screen.getByRole("button", { name: "Download generator First/Last Frame" }));await waitFor(() => expect(pending).toHaveLength(1));act(() => progress({ payload: { requestId: pending[0].requestId, downloaded: 50, total: 100 } }));- const fill = screen.getByRole("progressbar", { name: "Downloading Minimax H3 Original weights" });+ const fill = screen.getByRole("progressbar", { name: "Downloading First/Last Frame weights" });expect(fill.closest(".generator-template-item")).not.toBeNull();expect(within(screen.getByRole("list", { name: "Download" })).getByRole("progressbar")).toBe(fill);- expect(within(screen.getByRole("list", { name: "Generators" })).queryByText("Minimax H3 Original")).toBeNull();+ expect(within(screen.getByRole("list", { name: "Generators" })).queryByText("First/Last Frame")).toBeNull();expect(fill).toHaveStyle({ width: "12.5%" });fireEvent.click(screen.getByRole("button", { name: "Close settings" }));await act(async () => pending[0].finish());@@ -58,12 +58,12 @@ it("keeps downloading with Settings closed and restores progress in the templateact(() => progress({ payload: { requestId: pending[1].requestId, downloaded: 50, total: 100 } }));const queue = new WorkQueue(async (record) => record);const panel = render(<WorkQueuePanel queue={queue} items={[]} onClose={() => panel.unmount()} />);- expect(screen.getByRole("region", { name: "Weight downloads" })).toHaveTextContent("Minimax H3 Original");- expect(screen.getByRole("progressbar", { name: "Minimax H3 Original download progress" })).toHaveAttribute("value", "37.5");+ expect(screen.getByRole("region", { name: "Weight downloads" })).toHaveTextContent("First/Last Frame");+ expect(screen.getByRole("progressbar", { name: "First/Last Frame download progress" })).toHaveAttribute("value", "37.5");expect(screen.queryByText("No work yet")).toBeNull();fireEvent.click(screen.getByRole("button", { name: "Close work queue" }));const reopened = render(<SettingsView onClose={() => reopened.unmount()} />);- expect(screen.getByRole("progressbar", { name: "Downloading Minimax H3 Original weights" })).toHaveStyle({ width: "37.5%" });+ expect(screen.getByRole("progressbar", { name: "Downloading First/Last Frame weights" })).toHaveStyle({ width: "37.5%" });reopened.unmount();for (let index = 1; index < 4; index++) {await waitFor(() => expect(pending.length).toBe(index + 1));@@ -78,22 +78,23 @@ it("keeps downloading with Settings closed and restores progress in the templateit("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" });+ const radio = () => screen.getByRole("radio", { name: "Use First/Last Frame as the default generator" });expect(within(screen.getByRole("list", { name: "Generators" })).getByText("Default")).toBeInTheDocument();- expect(within(screen.getByRole("list", { name: "Download" })).getByText("Minimax H3 Original")).toBeInTheDocument();+ expect(within(screen.getByRole("list", { name: "Download" })).getByText("First/Last Frame")).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: "Download" })).toBeNull();+ expect(screen.queryByRole("button", { name: "Remove generator First/Last Frame" })).toBeNull();+ fireEvent.click(screen.getByRole("button", { name: "Download generator First/Last Frame" }));+ const remove = await screen.findByRole("button", { name: "Remove downloaded weights for First/Last Frame" });+ expect(within(screen.getByRole("list", { name: "Generators" })).getByText("First/Last Frame")).toBeInTheDocument();+ expect(within(screen.getByRole("list", { name: "Download" })).queryByText("First/Last Frame")).toBeNull();+ expect(within(screen.getByRole("list", { name: "Download" })).getByText("References")).toBeInTheDocument();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: "Download" })).getByText("Minimax H3 Original")).toBeInTheDocument();- expect(within(screen.getByRole("list", { name: "Generators" })).queryByText("Minimax H3 Original")).toBeNull();+ expect(await screen.findByRole("button", { name: "Download generator First/Last Frame" })).toBeEnabled();+ expect(within(screen.getByRole("list", { name: "Download" })).getByText("First/Last Frame")).toBeInTheDocument();+ expect(within(screen.getByRole("list", { name: "Generators" })).queryByText("First/Last Frame")).toBeNull();expect(radio()).toBeDisabled();expect(files.size).toBe(0);expect(loadGeneratorTemplateSettings().templates.find((template) => template.id === "minimax-h3-original")?.paths.transformer).toMatch(/^https:/);@@ -101,16 +102,16 @@ it("downloads the sample, enables its default choice, and removes only weights tit("restores a deleted downloaded file when Settings regains focus", async () => {render(<SettingsView onClose={() => undefined} />);- fireEvent.click(screen.getByRole("button", { name: "Download generator Minimax H3 Original" }));- await screen.findByRole("button", { name: "Remove downloaded weights for Minimax H3 Original" });+ fireEvent.click(screen.getByRole("button", { name: "Download generator First/Last Frame" }));+ await screen.findByRole("button", { name: "Remove downloaded weights for First/Last Frame" });files.clear();fireEvent.focus(window);- expect(await screen.findByRole("button", { name: "Download generator Minimax H3 Original" })).toBeEnabled();+ expect(await screen.findByRole("button", { name: "Download generator First/Last Frame" })).toBeEnabled();});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" }));+ fireEvent.click(screen.getByRole("button", { name: "Edit First/Last Frame generator" }));const advanced = screen.getByRole("checkbox", { name: "Show advanced options" });expect(advanced).not.toBeChecked();expect(screen.queryByText(/Download variants/)).toBeNull();diff --git a/src/components/workspace/GeneratorView.test.tsx b/src/components/workspace/GeneratorView.test.tsxindex 424f11f..6126107 100644--- a/src/components/workspace/GeneratorView.test.tsx+++ b/src/components/workspace/GeneratorView.test.tsx@@ -26,7 +26,7 @@ it("hides unfinished templates from the generator picker", () => {setup();fireEvent.click(screen.getByRole("combobox", { name: /Video generator template/ }));expect(screen.getByRole("option", { name: "Default" })).toBeInTheDocument();- expect(screen.queryByRole("option", { name: "Minimax H3 Original" })).toBeNull();+ expect(screen.queryByRole("option", { name: "First/Last Frame" })).toBeNull();});it("has no selected generator when all templates still need downloads", () => {diff --git a/src/lib/settings.test.ts b/src/lib/settings.test.tsindex cbe842f..da42e67 100644--- a/src/lib/settings.test.ts+++ b/src/lib/settings.test.ts@@ -12,6 +12,8 @@ import {loadEngineSettings,loadGeneratorTemplateSettings,minimaxOriginalTemplate,+ minimaxReferencesTemplate,+ minimaxFastTemplate,templateNeedsDownload,saveAgentEndpointSettings,saveGeneratorTemplateSettings,@@ -24,8 +26,8 @@ describe("generator templates", () => {localStorage.setItem("slopus.engine-paths.v1", JSON.stringify({ transformer: "D:\\Models\\main.safetensors" }));const settings = loadGeneratorTemplateSettings();expect(settings.defaultTemplateId).toBe("default");- expect(settings.templates).toHaveLength(2);- expect(settings.templates[1].name).toBe("Minimax H3 Original");+ expect(settings.templates).toHaveLength(4);+ expect(settings.templates[1].name).toBe("First/Last Frame");expect(settings.templates[0]).toMatchObject({id: "default",name: "Default",@@ -44,6 +46,56 @@ describe("generator templates", () => {}});+ it("adds References with the same settings and VRAM variants except for the main transformer URL", () => {+ const original = minimaxOriginalTemplate();+ const references = minimaxReferencesTemplate();+ const transformer = "https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/diffusion_models/minimax_h3_ref2va_pruned_int8_convrot.safetensors";+ expect(original.name).toBe("First/Last Frame");+ expect(references).toEqual({ ...original, id: "minimax-h3-references", name: "References",+ paths: { ...original.paths, transformer },+ sources: { ...original.sources, transformer: [{ ...original.sources!.transformer![0], url: transformer }, original.sources!.transformer![1]] },+ });+ expect(loadGeneratorTemplateSettings().templates.map(({ name }) => name)).toEqual(["Default", "First/Last Frame", "References", "First/Last Frame Fast"]);+ });++ it.each(["Minimax H3 Original", "My custom generator"])("migrates the saved %s template without changing its configuration", (name) => {+ const template = minimaxOriginalTemplate();+ template.name = name;+ template.defaultSteps = 12;+ template.attention = "exact";+ template.paths = { transformer: "transformer", textEncoder: "encoder", videoVae: "video", audioVae: "audio", tokenizer: "" };+ template.sources!.transformer![0].downloadedPath = "transformer";+ localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [template], defaultTemplateId: template.id, catalogVersion: 3 }));+ const settings = loadGeneratorTemplateSettings();+ expect(settings.templates[0]).toEqual({ ...template, name: name === "Minimax H3 Original" ? "First/Last Frame" : name });+ expect(settings.templates[1]).toEqual(minimaxReferencesTemplate());+ expect(settings.templates[2]).toEqual(minimaxFastTemplate());+ expect(settings.defaultTemplateId).toBe(template.id);+ expect(settings.catalogVersion).toBe(4);+ expect(loadGeneratorTemplateSettings()).toEqual(settings);+ saveGeneratorTemplateSettings({ ...settings, templates: [settings.templates[0]] });+ expect(loadGeneratorTemplateSettings().templates).toHaveLength(1);+ });++ it("preserves an existing References template during catalog migration", () => {+ const references = minimaxReferencesTemplate();+ references.paths.transformer = "D:/Models/custom.safetensors";+ localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [references], catalogVersion: 3 }));+ expect(loadGeneratorTemplateSettings().templates).toEqual([references, minimaxFastTemplate()]);+ });++ it("adds First/Last Frame Fast with six steps and its transformer URL", () => {+ const original = minimaxOriginalTemplate();+ const fast = minimaxFastTemplate();+ const transformer = "https://huggingface.co/datasets/jacokon/fasth3-live/resolve/main/minimax_h3_fl2va_fasth3_dense_pruned_int8_convrot.safetensors";+ expect(fast).toEqual({ ...original, id: "minimax-h3-fast", name: "First/Last Frame Fast", defaultSteps: 6,+ paths: { ...original.paths, transformer },+ sources: { ...original.sources, transformer: [{ ...original.sources!.transformer![0], url: transformer }, original.sources!.transformer![1]] },+ });+ saveGeneratorTemplateSettings({ templates: [fast], defaultTemplateId: "", catalogVersion: 4 });+ expect(loadGeneratorTemplateSettings().templates[0].defaultSteps).toBe(6);+ });+it.each(["textEncoder", "transformer"] as const)("upgrades saved Minimax %s variants once and preserves downloaded weights", (field) => {const template = minimaxOriginalTemplate();const downloadedPath = "D:/Models/encoder.safetensors";@@ -51,7 +103,7 @@ describe("generator templates", () => {template.paths[field] = downloadedPath;localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [template], catalogVersion: 1 }));const settings = loadGeneratorTemplateSettings();- expect(settings.catalogVersion).toBe(3);+ expect(settings.catalogVersion).toBe(4);expect(settings.templates[0].paths[field]).toBe(downloadedPath);expect(settings.templates[0].sources![field]).toEqual(minimaxOriginalTemplate().sources![field]!.map((source, index) =>index === 0 ? { ...source, downloadedPath } : source));@@ -66,7 +118,7 @@ describe("generator templates", () => {expect(loadGeneratorTemplateSettings().templates[0].sources![field]).toEqual(template.sources![field]);const custom = createGeneratorTemplate();localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [custom], catalogVersion: 1 }));- expect(loadGeneratorTemplateSettings().templates.map(({ id }) => id)).toEqual([custom.id]);+ expect(loadGeneratorTemplateSettings().templates.map(({ id }) => id)).toEqual([custom.id, "minimax-h3-references", "minimax-h3-fast"]);});it.each(["url", "downloaded", "original", "custom", "cached original"])("removes the incompatible encoder from saved templates using %s", (selection) => {@@ -86,7 +138,7 @@ describe("generator templates", () => {localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [template], defaultTemplateId: template.id, catalogVersion: 2 }));const settings = loadGeneratorTemplateSettings();const migrated = settings.templates[0];- expect(settings.catalogVersion).toBe(3);+ expect(settings.catalogVersion).toBe(4);expect(migrated.sources!.textEncoder).toEqual([{ url: originalUrl, gpuModel: "", minVramGb: 0, ...(selection === "cached original" ? { downloadedPath: cachedOriginal } : {}) },custom,diff --git a/src/lib/settings.ts b/src/lib/settings.tsindex dc243bb..35eb481 100644--- a/src/lib/settings.ts+++ b/src/lib/settings.ts@@ -162,13 +162,32 @@ export function minimaxOriginalTemplate(): GeneratorTemplate {{ url: paths.transformer, gpuModel: "", minVramGb: 21 },{ url: "https://huggingface.co/koongrizzly/MiniMax_H3_int4_W4A8_ConvRot_Pruned/resolve/main/diffusion_models/minimax_h3_ref2va_hybrid_b20-49_pruned_w4a8_mixed.safetensors", gpuModel: "", minVramGb: 0 },];- return { id: "minimax-h3-original", name: "Minimax H3 Original", defaultSteps: 20, attention: "sage2", paths, sources };+ return { id: "minimax-h3-original", name: "First/Last Frame", defaultSteps: 20, attention: "sage2", paths, sources };+}++function minimaxVariantTemplate(id: string, name: string, transformer: string, defaultSteps = 20): GeneratorTemplate {+ const template = minimaxOriginalTemplate();+ return { ...template, id, name, defaultSteps,+ paths: { ...template.paths, transformer },+ sources: { ...template.sources, transformer: template.sources!.transformer!.map((source) =>+ source.url === template.paths.transformer ? { ...source, url: transformer } : source) },+ };+}++export function minimaxReferencesTemplate(): GeneratorTemplate {+ return minimaxVariantTemplate("minimax-h3-references", "References",+ "https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/diffusion_models/minimax_h3_ref2va_pruned_int8_convrot.safetensors");+}++export function minimaxFastTemplate(): GeneratorTemplate {+ return minimaxVariantTemplate("minimax-h3-fast", "First/Last Frame Fast",+ "https://huggingface.co/datasets/jacokon/fasth3-live/resolve/main/minimax_h3_fl2va_fasth3_dense_pruned_int8_convrot.safetensors", 6);}const initialTemplateSettings = (paths = EMPTY_ENGINE_SETTINGS): GeneratorTemplateSettings => ({- templates: [{ id: "default", name: "Default", defaultSteps: DEFAULT_GENERATION_STEPS, attention: "sage2", paths: copyPaths(paths) }, minimaxOriginalTemplate()],+ templates: [{ id: "default", name: "Default", defaultSteps: DEFAULT_GENERATION_STEPS, attention: "sage2", paths: copyPaths(paths) }, minimaxOriginalTemplate(), minimaxReferencesTemplate(), minimaxFastTemplate()],defaultTemplateId: "default",- catalogVersion: 3,+ catalogVersion: 4,});const normalizeTemplateSettings = (value: unknown): GeneratorTemplateSettings | null => {@@ -213,7 +232,7 @@ const normalizeTemplateSettings = (value: unknown): GeneratorTemplateSettings |templates,defaultTemplateId: templates.find((template) => template.id === requestedDefault && !templateNeedsDownload(template))?.id?? templates.find((template) => !templateNeedsDownload(template))?.id ?? "",- catalogVersion: record.catalogVersion === 3 ? 3 : record.catalogVersion === 2 ? 2 : record.catalogVersion === 1 ? 1 : 0,+ catalogVersion: typeof record.catalogVersion === "number" && [1, 2, 3, 4].includes(record.catalogVersion) ? record.catalogVersion : 0,};};@@ -224,7 +243,7 @@ export function loadGeneratorTemplateSettings(): GeneratorTemplateSettings {try {const stored = migratedStorageItem(GENERATOR_TEMPLATES_KEY, LEGACY_GENERATOR_TEMPLATES_KEY);if (stored) {- const normalized = normalizeTemplateSettings(JSON.parse(stored));+ let normalized = normalizeTemplateSettings(JSON.parse(stored));if (normalized) {if ((normalized.catalogVersion ?? 0) < 2) {const bundled = minimaxOriginalTemplate();@@ -240,7 +259,6 @@ export function loadGeneratorTemplateSettings(): GeneratorTemplateSettings {}}normalized.catalogVersion = 2;- localStorage.setItem(GENERATOR_TEMPLATES_KEY, JSON.stringify(normalized));}if ((normalized.catalogVersion ?? 0) < 3) {const bundled = minimaxOriginalTemplate();@@ -263,9 +281,16 @@ export function loadGeneratorTemplateSettings(): GeneratorTemplateSettings {existing.sources!.textEncoder = retained;}// A replaced local encoder may now need downloading and cannot remain the default.- const migrated = normalizeTemplateSettings({ ...normalized, catalogVersion: 3 })!;- localStorage.setItem(GENERATOR_TEMPLATES_KEY, JSON.stringify(migrated));- return migrated;+ normalized = normalizeTemplateSettings({ ...normalized, catalogVersion: 3 })!;+ }+ if ((normalized.catalogVersion ?? 0) < 4) {+ const original = normalized.templates.find((template) => template.id === "minimax-h3-original");+ if (original?.name === "Minimax H3 Original") original.name = "First/Last Frame";+ for (const template of [minimaxReferencesTemplate(), minimaxFastTemplate()]) {+ if (!normalized.templates.some(({ id }) => id === template.id)) normalized.templates.push(template);+ }+ normalized.catalogVersion = 4;+ localStorage.setItem(GENERATOR_TEMPLATES_KEY, JSON.stringify(normalized));}return normalized;}diff --git a/src/lib/weightDownloads.test.ts b/src/lib/weightDownloads.test.tsindex 6d72791..98d20e8 100644--- a/src/lib/weightDownloads.test.ts+++ b/src/lib/weightDownloads.test.ts@@ -77,6 +77,29 @@ it.each([8, 11.4, 12, 12.01, 16, 19.4, 20, 20.01, 24, 32])("selects the Minimax}));});+it.each([12, 20, 24])("downloads the References transformer for %s GiB of VRAM", async (vram) => {+ const original = vi.mocked(invoke).getMockImplementation()!;+ vi.mocked(invoke).mockImplementation(async (command, args) => command === "weight_download_hardware"+ ? [{ name: "GPU", memoryBytes: vram * 1024 ** 3 }] : original(command, args));+ await downloadTemplateWeights("minimax-h3-references");+ expect(getWeightDownloadState()).toMatchObject({ active: false, completed: 4, error: null });+ expect(invoke).toHaveBeenCalledWith("download_weight", expect.objectContaining({ url: vram <= 20+ ? "https://huggingface.co/koongrizzly/MiniMax_H3_int4_W4A8_ConvRot_Pruned/resolve/main/diffusion_models/minimax_h3_ref2va_hybrid_b20-49_pruned_w4a8_mixed.safetensors"+ : "https://huggingface.co/Comfy-Org/MiniMax-H3/resolve/main/diffusion_models/minimax_h3_ref2va_pruned_int8_convrot.safetensors" }));+ expect(templateNeedsDownload(loadGeneratorTemplateSettings().templates.find(({ id }) => id === "minimax-h3-references")!)).toBe(false);+});++it("downloads the fast transformer and retains its six-step default", async () => {+ await downloadTemplateWeights("minimax-h3-fast");+ expect(getWeightDownloadState()).toMatchObject({ active: false, completed: 4, error: null });+ expect(invoke).toHaveBeenCalledWith("download_weight", expect.objectContaining({+ url: "https://huggingface.co/datasets/jacokon/fasth3-live/resolve/main/minimax_h3_fl2va_fasth3_dense_pruned_int8_convrot.safetensors",+ }));+ const template = loadGeneratorTemplateSettings().templates.find(({ id }) => id === "minimax-h3-fast")!;+ expect(template.defaultSteps).toBe(6);+ expect(templateNeedsDownload(template)).toBe(false);+});+it("replaces a URL being typed instead of accumulating partial download sources", () => {let template = createGeneratorTemplate();for (const value of ["https://", "https://e", "https://example.com/model"]) template = updateWeightPath(template, "transformer", value);