AI media harness for planning, generating, and editing locally
TypeScript
Test Animate templates and video inputs
Bitti19f77017b7c7
diff --git a/src/components/workspace/GeneratorView.test.tsx b/src/components/workspace/GeneratorView.test.tsxindex 5c9fc6e..b8ff2e8 100644--- a/src/components/workspace/GeneratorView.test.tsx+++ b/src/components/workspace/GeneratorView.test.tsx@@ -7,7 +7,7 @@ import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "viteimport { createDraftGenerationJob, createProjectConfig, parseProjectConfig, sceneShots, type ProjectConfig } from "../../lib/project";import { cancelSlopfabGeneration, getEngineStatus, type SlopfabStatus } from "../../lib/runtime";import { GeneratorView } from "./GeneratorView";-import { minimaxOriginalTemplate, saveDebugOptionsEnabled } from "../../lib/settings";+import { minimaxOriginalTemplate, viggleAnimateTemplate, saveDebugOptionsEnabled } from "../../lib/settings";vi.mock("../../lib/runtime", async (importOriginal) => ({...await importOriginal<typeof import("../../lib/runtime")>(),@@ -35,6 +35,38 @@ it("has no selected generator when all templates still need downloads", () => {expect(screen.getByRole("combobox", { name: "Video generator template: No downloaded generators" })).toBeDisabled();});+it("animates a blank scene only after selecting a video and submits an empty prompt", () => {+ const template = viggleAnimateTemplate();+ template.paths = { transformer: "viggle.safetensors", textEncoder: "encoder", videoVae: "video", audioVae: "audio", tokenizer: "" };+ localStorage.setItem("slopus.loras.v1", JSON.stringify([{ id: template.loras![0].loraId, name: "Viggle", path: "distillation.safetensors", stepOverride: 4 }]));+ localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [template], defaultTemplateId: template.id, catalogVersion: 7 }));+ const initial = project();+ initial.generationJobs = [createDraftGenerationJob("", { id: "blank", title: "Blank scene" })];+ initial.references = [{ id: "motion", kind: "video", name: "Motion", description: "", intendedUse: [],+ sourcePath: "C:/motion.mp4", createdAt: "2026-09-15T00:00:00.000Z",+ video: { startSeconds: 1, durationSeconds: 3, includeAudio: false } }];+ const submitted = vi.fn();+ function Harness() {+ const [config, setConfig] = useState(initial);+ return <GeneratorView config={config} folderPath="C:/project" runtime={readyRuntime}+ onChange={setConfig} onGenerate={submitted} onOpenTimeline={() => undefined} />;+ }+ render(<Harness />);+ const generate = within(screen.getByRole("region", { name: "Blank scene" })).getByRole("button", { name: "Generate" });+ expect(generate).toBeDisabled();+ fireEvent.click(screen.getByRole("button", { name: "Generate All" }));+ expect(submitted.mock.calls.flatMap(([items]) => items)).toHaveLength(0);+ expect(screen.queryByLabelText("The sound of this scene")).toBeNull();+ fireEvent.change(screen.getByLabelText("Reference video for this scene"), { target: { value: "motion" } });+ expect(generate).toBeEnabled();+ fireEvent.click(generate);+ expect(submitted).toHaveBeenLastCalledWith([expect.objectContaining({ request: expect.objectContaining({+ prompt: "", referenceVideos: [{ name: "Motion", sourcePath: "C:/motion.mp4", startSeconds: 1, durationSeconds: 3, includeAudio: false }],+ }) })]);+ fireEvent.change(screen.getByLabelText("Reference video for this scene"), { target: { value: "" } });+ expect(generate).toBeDisabled();+});+const readyRuntime: SlopfabStatus = {state: "ready",dllPath: "test",@@ -436,7 +468,7 @@ describe("Generator scene controls", () => {fireEvent.click(screen.getByRole("option", { name: "Fast draft" }));await waitFor(() => expect(document.querySelector(".generator-runtime--modelsMissing > i")).not.toBeNull());- expect(getEngineStatus).toHaveBeenCalledWith(expect.objectContaining({ transformer: "draft.safetensors" }), "sage2", []);+ expect(getEngineStatus).toHaveBeenCalledWith(expect.objectContaining({ transformer: "draft.safetensors" }), "sage2", [], "prompt");expect(JSON.parse(localStorage.getItem("slopus.generator-templates.v1")!).defaultTemplateId).toBe("draft");expect(screen.queryByText("Video model files missing")).not.toBeInTheDocument();expect(template.closest(".generator-runtime--modelsMissing")).not.toBeNull();diff --git a/src/lib/loras.test.ts b/src/lib/loras.test.tsindex aa10f00..9681d67 100644--- a/src/lib/loras.test.ts+++ b/src/lib/loras.test.ts@@ -1,6 +1,6 @@// @vitest-environment jsdomimport { beforeEach, expect, it } from "vitest";-import { loadLoras, saveLoras, TAOMATE_LORA, TURBO_LORA } from "./loras";+import { loadLoras, saveLoras, TAOMATE_LORA, TURBO_LORA, VIGGLE_ANIMATE_LORA } from "./loras";import { createGeneratorTemplate, engineProviderSetting, generationStepsWithLoras, loadGeneratorTemplateSettings, saveGeneratorTemplateSettings, withEngineSettings } from "./settings";import { createProjectConfig } from "./project";@@ -41,9 +41,9 @@ it.each([0, 1, -3, 2.5, NaN, Infinity, 2147483648])("rejects invalid step overri});it("starts with TaoMate and Turbo and preserves the local library", () => {- expect(loadLoras()).toEqual([TAOMATE_LORA, TURBO_LORA]);+ expect(loadLoras()).toEqual([TAOMATE_LORA, TURBO_LORA, VIGGLE_ANIMATE_LORA]);saveLoras([{ ...TAOMATE_LORA, path: "C:/weights/TaoMate.safetensors" }, { id: "style", name: "Style", path: "D:/style.safetensors" }]);- expect(loadLoras().map(({ name }) => name)).toEqual(["TaoMate 3-Step", "Style", "Turbo"]);+ expect(loadLoras().map(({ name }) => name)).toEqual(["TaoMate 3-Step", "Style", "Turbo", "Viggle Animate Distillation"]);});it("round-trips template order, enabled flags and strengths, and sends only active adapters", () => {diff --git a/src/lib/settings.test.ts b/src/lib/settings.test.tsindex 0842c49..fcc321a 100644--- a/src/lib/settings.test.ts+++ b/src/lib/settings.test.ts@@ -1,7 +1,7 @@// @vitest-environment jsdomimport { beforeEach, describe, expect, it } from "vitest";-import { TURBO_LORA } from "./loras";+import { TURBO_LORA, VIGGLE_ANIMATE_LORA, loadLoras, saveLoras } from "./loras";import {agentEndpointProviderSettings,createGeneratorTemplate,@@ -16,6 +16,7 @@ import {minimaxReferencesTemplate,minimaxFastTemplate,minimaxSingularityTemplate,+ viggleAnimateTemplate,templateNeedsDownload,saveAgentEndpointSettings,saveGeneratorTemplateSettings,@@ -28,7 +29,7 @@ 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(5);+ expect(settings.templates).toHaveLength(6);expect(settings.templates[1].name).toBe("First/Last Frame");expect(settings.templates[0]).toMatchObject({id: "default",@@ -48,6 +49,27 @@ describe("generator templates", () => {}});+ it("migrates Animate once and preserves its mode, local weights and four-step adapter", () => {+ const custom = createGeneratorTemplate("Existing");+ saveGeneratorTemplateSettings({ templates: [custom], defaultTemplateId: custom.id, catalogVersion: 6 });+ const settings = loadGeneratorTemplateSettings();+ const template = settings.templates.find(({ id }) => id === "viggle-animate")!;+ expect(template).toEqual(viggleAnimateTemplate());+ expect(settings.defaultTemplateId).toBe(custom.id);+ expect(loadGeneratorTemplateSettings()).toEqual(settings);+ expect(template.paths.transformer).toBe("https://huggingface.co/DeepBeepMeep/MiniMax-H3/resolve/main/Viggle-Animate-pruned_rank8_int8_convrot.safetensors");+ expect(templateNeedsDownload(template)).toBe(true);+ template.name = "My animation";+ template.paths = { transformer: "local", textEncoder: "encoder", videoVae: "video", audioVae: "audio", tokenizer: "" };+ saveLoras(loadLoras().map((lora) => lora.id === VIGGLE_ANIMATE_LORA.id ? { ...lora, path: "adapter" } : lora));+ saveGeneratorTemplateSettings({ ...settings, defaultTemplateId: template.id });+ expect(loadGeneratorTemplateSettings().templates.find(({ id }) => id === template.id)).toEqual(template);+ const options = engineProviderSetting(loadEngineSettings()).options;+ expect(options).toMatchObject({ generationMode: "animate", stepOverride: 4 });+ expect(JSON.parse(options.loras as string)).toEqual([{ path: "adapter", strength: 1 }]);+ expect(engineProviderSetting(custom.paths, { enabled: true, model: null, options }, "sage2", [], "prompt").options).not.toHaveProperty("generationMode");+ });+it("adds References with the same settings and VRAM variants except for the main transformer URL", () => {const original = minimaxOriginalTemplate();const references = minimaxReferencesTemplate();@@ -57,7 +79,7 @@ describe("generator templates", () => {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", "Singularity"]);+ expect(loadGeneratorTemplateSettings().templates.map(({ name }) => name)).toEqual(["Default", "First/Last Frame", "References", "First/Last Frame Fast", "Singularity", "Animate"]);});it.each(["Minimax H3 Original", "My custom generator"])("migrates the saved %s template without changing its configuration", (name) => {@@ -74,7 +96,7 @@ describe("generator templates", () => {expect(settings.templates[2]).toEqual(minimaxFastTemplate());expect(settings.templates[3]).toEqual(minimaxSingularityTemplate());expect(settings.defaultTemplateId).toBe(template.id);- expect(settings.catalogVersion).toBe(6);+ expect(settings.catalogVersion).toBe(7);expect(loadGeneratorTemplateSettings()).toEqual(settings);saveGeneratorTemplateSettings({ ...settings, templates: [settings.templates[0]] });expect(loadGeneratorTemplateSettings().templates).toHaveLength(1);@@ -84,7 +106,7 @@ describe("generator templates", () => {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(), minimaxSingularityTemplate()]);+ expect(loadGeneratorTemplateSettings().templates).toEqual([references, minimaxFastTemplate(), minimaxSingularityTemplate(), viggleAnimateTemplate()]);});it("adds Singularity to the previous catalog once while preserving saved templates", () => {@@ -93,9 +115,9 @@ describe("generator templates", () => {custom.paths.transformer = "D:/Models/custom.safetensors";localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [custom], defaultTemplateId: custom.id, catalogVersion: 4 }));const settings = loadGeneratorTemplateSettings();- expect(settings.templates).toEqual([expect.objectContaining(custom), minimaxSingularityTemplate()]);+ expect(settings.templates).toEqual([expect.objectContaining(custom), minimaxSingularityTemplate(), viggleAnimateTemplate()]);expect(settings.defaultTemplateId).toBe(custom.id);- expect(settings.catalogVersion).toBe(6);+ expect(settings.catalogVersion).toBe(7);expect(loadGeneratorTemplateSettings()).toEqual(settings);saveGeneratorTemplateSettings({ ...settings, templates: [custom] });expect(loadGeneratorTemplateSettings().templates).toEqual([expect.objectContaining(custom)]);@@ -106,7 +128,7 @@ describe("generator templates", () => {template.defaultSteps = 8;template.paths.transformer = "D:/Models/singularity.safetensors";localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [template], catalogVersion: 4 }));- expect(loadGeneratorTemplateSettings().templates).toEqual([template]);+ expect(loadGeneratorTemplateSettings().templates).toEqual([template, viggleAnimateTemplate()]);});it("adds Turbo to saved Singularity once and preserves other adapters and settings", () => {@@ -116,7 +138,7 @@ describe("generator templates", () => {template.loras = [{ loraId: "custom", enabled: false, strength: 0.5 }];localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [template], defaultTemplateId: template.id, catalogVersion: 5 }));const settings = loadGeneratorTemplateSettings();- expect(settings.templates).toEqual([{ ...template, loras: [...template.loras, { loraId: TURBO_LORA.id, enabled: true, strength: 1 }] }]);+ expect(settings.templates).toEqual([{ ...template, loras: [...template.loras, { loraId: TURBO_LORA.id, enabled: true, strength: 1 }] }, viggleAnimateTemplate()]);expect(settings.defaultTemplateId).toBe("");expect(loadGeneratorTemplateSettings()).toEqual(settings);saveGeneratorTemplateSettings({ ...settings, templates: [template] });@@ -127,7 +149,7 @@ describe("generator templates", () => {const template = minimaxSingularityTemplate();template.loras = [{ loraId: TURBO_LORA.id, enabled: false, strength: 0.3 }];localStorage.setItem("slopus.generator-templates.v1", JSON.stringify({ templates: [template], catalogVersion: 5 }));- expect(loadGeneratorTemplateSettings().templates).toEqual([template]);+ expect(loadGeneratorTemplateSettings().templates).toEqual([template, viggleAnimateTemplate()]);});it("adds First/Last Frame Fast with six steps and its transformer URL", () => {@@ -149,7 +171,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(6);+ expect(settings.catalogVersion).toBe(7);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));@@ -164,7 +186,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, "minimax-h3-references", "minimax-h3-fast", "minimax-h3-singularity"]);+ expect(loadGeneratorTemplateSettings().templates.map(({ id }) => id)).toEqual([custom.id, "minimax-h3-references", "minimax-h3-fast", "minimax-h3-singularity", "viggle-animate"]);});it.each(["url", "downloaded", "original", "custom", "cached original"])("removes the incompatible encoder from saved templates using %s", (selection) => {@@ -184,7 +206,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(6);+ expect(settings.catalogVersion).toBe(7);expect(migrated.sources!.textEncoder).toEqual([{ url: originalUrl, gpuModel: "", minVramGb: 0, ...(selection === "cached original" ? { downloadedPath: cachedOriginal } : {}) },custom,diff --git a/src/lib/weightDownloads.test.ts b/src/lib/weightDownloads.test.tsindex 6822cb1..a6fef08 100644--- a/src/lib/weightDownloads.test.ts+++ b/src/lib/weightDownloads.test.ts@@ -1,7 +1,7 @@// @vitest-environment jsdomimport { invoke } from "@tauri-apps/api/core";import { cancelWeightDownload, downloadLora, removeLora, refreshDownloadedLoras, retryWeightDownload } from "./weightDownloads";-import { loadLoras, saveLoras, TAOMATE_LORA, TURBO_LORA } from "./loras";+import { loadLoras, saveLoras, TAOMATE_LORA, TURBO_LORA, VIGGLE_ANIMATE_LORA } from "./loras";import { beforeEach, expect, it, vi } from "vitest";import { chooseWeightSource, downloadTemplateWeights, getWeightDownloadState, refreshDownloadedWeights, removeTemplateWeights, updateWeightPath, weightDownloadProgress, type DownloadState } from "./weightDownloads";import { createGeneratorTemplate, defaultGeneratorTemplate, isDownloadUrl, loadGeneratorTemplateSettings, minimaxOriginalTemplate, minimaxSingularityTemplate, saveGeneratorTemplateSettings, templateNeedsDownload, type WeightSource } from "./settings";@@ -13,7 +13,18 @@ const files = new Set<string>();const source = (url: string, gpuModel = "", minVramGb = 0): WeightSource => ({ url, gpuModel, minVramGb });const saved = () => loadGeneratorTemplateSettings().templates.find((template) => template.id === "minimax-h3-original")!;-it.each([TAOMATE_LORA, TURBO_LORA])("downloads $name through the weight transfer and restores missing downloads", async (lora) => {+it("downloads Animate with its transformer and four-step distillation adapter", async () => {+ await downloadTemplateWeights("viggle-animate");+ const template = loadGeneratorTemplateSettings().templates.find(({ id }) => id === "viggle-animate")!;+ expect(templateNeedsDownload(template)).toBe(false);+ expect(template.paths.transformer).toBe("C:/Slopus/weights/Viggle-Animate-pruned_rank8_int8_convrot.safetensors");+ expect(invoke).toHaveBeenCalledWith("download_weight", expect.objectContaining({ url: VIGGLE_ANIMATE_LORA.url }));+ expect(loadLoras().find(({ id }) => id === VIGGLE_ANIMATE_LORA.id)).toMatchObject({+ path: "C:/Slopus/weights/viggle_animate_distillation_bf16.safetensors", stepOverride: 4,+ });+});++it.each([TAOMATE_LORA, TURBO_LORA, VIGGLE_ANIMATE_LORA])("downloads $name through the weight transfer and restores missing downloads", async (lora) => {const savedLora = () => loadLoras().find(({ id }) => id === lora.id)!;await downloadLora(lora.id);expect(invoke).toHaveBeenCalledWith("download_weight", { requestId: expect.any(String), url: lora.url });