AI media harness for planning, generating, and editing locally
TypeScript
Organize generators and LoRAs by model
Bittic0e99dc69f68
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 19ed3a5..a821855 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -4,6 +4,8 @@ This alpha update adds Prompt video scenes, agent image drafts, Sol attention an## What's new+- **Generator model pages.** Open MiniMax H3, MOSS or Other from Generator settings. Each model has its own generators and LoRAs; Other contains the existing extra weights. New generators use the selected model.+- **Image generation count.** Open the arrow beside Generate to queue up to 100 images with different seeds. Count applies to one click, resets afterward and is not saved in the project.- **Generation effects.** Add LCS color steering, tone, sharpness and color stabilization from the video Scene or image root inspector. Effects run during generation, with bypass, reset, step ranges and optional regions. VAE calibration is automatic, cached and cancellable. MOSS disables these controls through the shared model capabilities.diff --git a/src/App.tsx b/src/App.tsxindex 0938c51..f14e791 100644--- a/src/App.tsx+++ b/src/App.tsx@@ -218,7 +218,7 @@ function App() {const navigateFromQueue = (target: WorkQueueTarget) => {if (target.kind === "download") {openSettings();- setSettingsNavigation({ templateId: target.download.templateId, loraId: target.download.loraId });+ setSettingsNavigation({ templateId: target.download.templateId, loraId: target.download.loraId, otherWeightId: target.download.otherWeightId });return;}const record = target.kind === "work" ? workQueue.projectRecord(target.item.projectKey)diff --git a/src/components/GeneratorSharing.test.tsx b/src/components/GeneratorSharing.test.tsxindex 5505e3a..0d61b78 100644--- a/src/components/GeneratorSharing.test.tsx+++ b/src/components/GeneratorSharing.test.tsx@@ -38,6 +38,7 @@ it("imports from the Generators page and updates its list without downloading orvi.mocked(invoke).mockImplementation(async (command) => command === "import_slop_file" ? serializeGeneratorSlop([shared]) : null as never);const previous = loadGeneratorTemplateSettings();render(<SettingsView onClose={() => undefined} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "Import" }));await screen.findByText("Added 1 generator template.");expect(screen.getByRole("button", { name: "Edit Shared generator generator" })).toBeTruthy();diff --git a/src/components/LoraSettings.tsx b/src/components/LoraSettings.tsxindex 236512f..80e653a 100644--- a/src/components/LoraSettings.tsx+++ b/src/components/LoraSettings.tsx@@ -3,6 +3,7 @@ import { Add20, ArrowDown16, ArrowUp16, Delete16, Download16, Lora20, Spinner16,import "../styles/loras.css";import { useEffect, useRef, useState, useSyncExternalStore } from "react";import { highestLoraStepOverride, loraSigmaShiftOverrides, isLoraStepOverride, loadLoras, saveLoras, subscribeLoras, type Lora, type TemplateLora } from "../lib/loras";+import { generatorModel } from "../lib/generatorModels";import { MAX_GENERATION_STEPS } from "../lib/project";import { isTauri } from "../lib/persistence";import { chooseEnginePath } from "../lib/runtime";@@ -16,8 +17,9 @@ function useLoras() {return loras;}-export function LoraLibrary({ onAdd, onEdit }: { onAdd: () => void; onEdit: (id: string) => void }) {- const loras = useLoras();+export function LoraLibrary({ modelType, onAdd, onEdit }: { modelType: string; onAdd: () => void; onEdit: (id: string) => void }) {+ const loras = useLoras().filter((lora) => (lora.modelType ?? "minimax-h3") === modelType);+ const supported = generatorModel(modelType).loras;const download = useSyncExternalStore(subscribeWeightDownloads, getWeightDownloadState);const queuedDownloads = useSyncExternalStore(subscribeWeightDownloads, getQueuedWeightDownloads);const [error, setError] = useState<string | null>(null);@@ -30,9 +32,9 @@ export function LoraLibrary({ onAdd, onEdit }: { onAdd: () => void; onEdit: (id:return () => { window.removeEventListener("focus", refresh); window.clearInterval(timer); };}, []);return <SettingsGroup heading="LoRAs">- <SettingsCard icon={<Add20 />} header="Add a LoRA" description="Download adapters or add local files, then turn them on in a generator">+ {supported ? <SettingsCard icon={<Add20 />} header="Add a LoRA" description="Download adapters or add local files, then turn them on in a generator"><button className="secondary-button" type="button" onClick={onAdd}>Add LoRA</button>- </SettingsCard>+ </SettingsCard> : <p className="settings-caption">This model does not support LoRAs.</p>}<div className="settings-card-list" role="list" aria-label="LoRAs">{loras.map((lora) => {const active = download?.active && download.loraId === lora.id;@@ -55,7 +57,7 @@ export function LoraLibrary({ onAdd, onEdit }: { onAdd: () => void; onEdit: (id:</SettingsGroup>;}-export function LoraEditor({ loraId, onDone }: { loraId: string; onDone: () => void }) {+export function LoraEditor({ loraId, modelType, onDone }: { loraId: string; modelType: string; onDone: () => void }) {const existing = loadLoras().find(({ id }) => id === loraId);const [name, setName] = useState(existing?.name ?? "");const [path, setPath] = useState(existing?.path ?? "");@@ -91,7 +93,7 @@ export function LoraEditor({ loraId, onDone }: { loraId: string; onDone: () => vawait prepareLora({ id: loraId, name: name.trim(), path: path.trim() }, allowDownload);}const library = loadLoras();- const entry: Lora = { ...library.find(({ id }) => id === loraId), id: loraId, name: name.trim(), path: path.trim(), samplingPreset, stepOverride: !samplingPreset && override ? Number(steps) : undefined,+ const entry: Lora = { ...library.find(({ id }) => id === loraId), id: loraId, name: name.trim(), modelType: existing ? existing.modelType ?? "minimax-h3" : modelType, path: path.trim(), samplingPreset, stepOverride: !samplingPreset && override ? Number(steps) : undefined,videoSigmaShiftOverride: !samplingPreset && videoShift !== "" ? Number(videoShift) : undefined,audioSigmaShiftOverride: !samplingPreset && audioShift !== "" ? Number(audioShift) : undefined,...(path.trim() !== existing?.path ? { needsPreparation: undefined } : {}) };@@ -126,14 +128,14 @@ export function LoraEditor({ loraId, onDone }: { loraId: string; onDone: () => v</ContentDialog>;}-export function TemplateLorasEditor({ value, onChange }: { value: TemplateLora[]; onChange: (value: TemplateLora[]) => void }) {+export function TemplateLorasEditor({ modelType, value, onChange }: { modelType: string; value: TemplateLora[]; onChange: (value: TemplateLora[]) => void }) {const library = useLoras();const active = value.filter((entry) => entry.enabled && entry.strength !== 0);const dmad = active.some((entry) => library.find(({ id }) => id === entry.loraId)?.samplingPreset === "dmad-4step");const stepOverride = highestLoraStepOverride(active.flatMap((entry) => library.filter(({ id }) => id === entry.loraId)));const shifts = loraSigmaShiftOverrides(active.flatMap((entry) => library.filter(({ id }) => id === entry.loraId)));- const available = library.filter((entry) => (entry.path || entry.url) && !value.some(({ loraId }) => loraId === entry.id));+ const available = library.filter((entry) => (entry.modelType ?? "minimax-h3") === modelType && (entry.path || entry.url) && !value.some(({ loraId }) => loraId === entry.id));const update = (index: number, patch: Partial<TemplateLora>) => onChange(value.map((entry, i) => i === index ? { ...entry, ...patch } : entry));const move = (index: number, delta: number) => {const next = [...value];diff --git a/src/components/SettingsView.agent.test.tsx b/src/components/SettingsView.agent.test.tsxindex 0a6ae3c..9d9fa76 100644--- a/src/components/SettingsView.agent.test.tsx+++ b/src/components/SettingsView.agent.test.tsx@@ -51,6 +51,7 @@ it("applies generator changes from settings without opening or saving a project"? { ...template, name: "Local weights", paths: { ...template.paths, transformer: "D:/weights/model.safetensors" } } : template) } } as never;});render(<SettingsView onClose={vi.fn()} providers={providers} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "Agent" }));fireEvent.change(screen.getByRole("textbox", { name: "Ask Slop about settings" }), { target: { value: "Use my local model weights" } });fireEvent.click(screen.getByRole("button", { name: "Send to Slop" }));diff --git a/src/components/SettingsView.downloads.test.tsx b/src/components/SettingsView.downloads.test.tsxindex ce087fc..6b60457 100644--- a/src/components/SettingsView.downloads.test.tsx+++ b/src/components/SettingsView.downloads.test.tsx@@ -22,6 +22,7 @@ const card = (openLabel: string) => screen.getByRole("button", { name: openLabelit("downloads DMAD, preserves its sampling recipe when edited, and explains its fixed grid", async () => {render(<SettingsView onClose={() => undefined} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "Edit DMAD 4-Step LoRA" }));expect(screen.getByRole("combobox", { name: "LoRA sampling recipe" })).toHaveTextContent("DMAD 4-Step");expect(screen.queryByLabelText("Override step count")).not.toBeInTheDocument();@@ -44,6 +45,7 @@ it("keeps a failed local import editable and supports local-only preparation", areturn normal(command, args);});render(<SettingsView onClose={() => undefined} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "Add LoRA" }));fireEvent.change(screen.getByLabelText("LoRA name"), { target: { value: "Offline style" } });fireEvent.change(screen.getByLabelText("LoRA path"), { target: { value: "D:/style.safetensors" } });@@ -67,6 +69,7 @@ it("prepares an existing adapter with a busy state and no unsupported cancel actvi.mocked(invoke).mockImplementation(async (command, args) => command === "prepare_lora"? new Promise<void>((resolve) => { finish = resolve; }) : normal(command, args));render(<SettingsView onClose={() => undefined} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "Prepare LoRA Existing style" }));expect(screen.getByRole("button", { name: "Prepare LoRA Existing style" })).toBeDisabled();expect(screen.getByRole("button", { name: "Remove LoRA Existing style" })).toBeDisabled();@@ -96,6 +99,7 @@ afterEach(() => { cleanup(); delete (window as Window & { __TAURI_INTERNALS__?:it("adds and downloads an additional safetensor from a generator's settings", async () => {render(<SettingsView onClose={() => undefined} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "Edit Default generator" }));fireEvent.change(screen.getByLabelText("Add additional safetensor URL"), { target: { value: "https://example.com/extra.safetensors" } });fireEvent.click(screen.getByRole("button", { name: "Add file" }));@@ -118,6 +122,7 @@ it("discovers Singularity's existing weights on opening Settings and downloads ovi.mocked(invoke).mockImplementation(async (command, args) => command === "find_downloaded_weights"? Object.fromEntries((args as { urls: string[] }).urls.filter((url) => cached[url]).map((url) => [url, cached[url]])) : normal(command, args));render(<SettingsView onClose={() => undefined} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));await waitFor(() => expect(loadGeneratorTemplateSettings().templates.find(({ id }) => id === "minimax-h3-singularity")?.paths.transformer).toMatch(/^D:\/Projects\/weights\//));expect(screen.getByRole("button", { name: "Download generator Singularity" })).toBeEnabled();expect(card("Edit Singularity generator")).toHaveTextContent("Needs Turbo LoRA");@@ -143,6 +148,7 @@ it("shows discovered model files as Found even when an active LoRA is missing",return normal(command, args);});render(<SettingsView onClose={() => undefined} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "Edit Singularity generator" }));await waitFor(() => expect(screen.getAllByText("Found")).toHaveLength(4));expect(screen.queryByText("Checking this computer…")).not.toBeInTheDocument();@@ -153,6 +159,7 @@ it("shows discovered model files as Found even when an active LoRA is missing",it("selects an undownloaded LoRA in a generator and downloads it from that generator", async () => {render(<SettingsView onClose={() => undefined} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "Edit Default generator" }));fireEvent.click(screen.getByRole("combobox", { name: "Add LoRA to generator" }));expect(screen.getByRole("option", { name: "Turbo" })).toBeInTheDocument();@@ -163,7 +170,7 @@ it("selects an undownloaded LoRA in a generator and downloads it from that generawait waitFor(() => expect(getWeightDownloadState()).toMatchObject({ templateId: "default", active: false, completed: 1, error: null }));expect(loadLoras().find(({ id }) => id === TURBO_LORA.id)?.path).not.toBe("");expect(screen.queryByRole("button", { name: "Download weights" })).not.toBeInTheDocument();- fireEvent.click(screen.getByRole("button", { name: "Generators" }));+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));expect(within(screen.getByRole("list", { name: "Generators" })).getByText("Default")).toBeInTheDocument();expect(card("Edit Default generator")).toHaveTextContent("Used by default");fireEvent.click(screen.getByRole("button", { name: "Remove LoRA Turbo" }));@@ -174,6 +181,7 @@ it("selects an undownloaded LoRA in a generator and downloads it from that generit("downloads TaoMate and persists manual adapters, activation, strength and order per template", async () => {const settings = render(<SettingsView onClose={() => undefined} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "Download LoRA TaoMate 3-Step" }));await waitFor(() => expect(loadLoras()[0].path).not.toBe(""));fireEvent.click(screen.getByRole("button", { name: "Add LoRA" }));@@ -209,6 +217,7 @@ it("downloads TaoMate and persists manual adapters, activation, strength and ordexpect(loadGeneratorTemplateSettings().templates.find(({ id }) => id === "default")!.loras).toEqual(expected);settings.unmount();render(<SettingsView onClose={() => undefined} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "Edit Default generator" }));expect(screen.getByLabelText("My style strength")).toHaveValue(-0.5);expect(screen.getByLabelText("Enable TaoMate 3-Step")).not.toBeChecked();@@ -230,6 +239,7 @@ it("keeps a LoRA download alive outside Settings, shows progress and cancels thrreturn normal(command, args);});const settings = render(<SettingsView onClose={() => undefined} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "Download LoRA TaoMate 3-Step" }));await waitFor(() => expect(requestId).not.toBe(""));expect(screen.getByRole("button", { name: "Download generator First/Last Frame" })).toBeEnabled();@@ -257,6 +267,7 @@ 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: "MiniMax H3" }));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 } }));@@ -267,6 +278,7 @@ it("keeps downloading with Settings closed and restores progress in the templateexpect(fill).toHaveAttribute("aria-valuenow", "13");expect(fill.querySelector(".ui-progress__fill")).toHaveStyle({ width: "12.5%" });fireEvent.click(screen.getByRole("button", { name: "Back" }));+ fireEvent.click(screen.getByRole("button", { name: "Back" }));await act(async () => pending[0].finish());await waitFor(() => expect(pending).toHaveLength(2));act(() => progress({ payload: { requestId: pending[1].requestId, downloaded: 50, total: 100 } }));@@ -277,6 +289,7 @@ it("keeps downloading with Settings closed and restores progress in the templateexpect(screen.queryByText("No work yet")).toBeNull();panel.unmount();const reopened = render(<SettingsView onClose={() => reopened.unmount()} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));expect(screen.getByRole("progressbar", { name: "Downloading First/Last Frame weights" }).querySelector(".ui-progress__fill")).toHaveStyle({ width: "37.5%" });reopened.unmount();for (let index = 1; index < 4; index++) {@@ -301,6 +314,7 @@ it("queues Other weights from Settings and follows their progress after Settingsreturn new Promise<string>((resolve) => pending.push({ requestId: request.requestId, finish: () => resolve(`C:/weights/${request.url.split('/').at(-1)}`) }));});const settings = render(<SettingsView onClose={() => undefined} />);+ fireEvent.click(screen.getByRole("button", { name: "Other" }));const otherCard = (name: string) => within(screen.getByText(name).closest(".ui-settings-card") as HTMLElement);fireEvent.click(otherCard("Real-ESRGAN").getByRole("button", { name: "Download" }));await waitFor(() => expect(pending).toHaveLength(1));@@ -331,6 +345,7 @@ it("queues Other weights from Settings and follows their progress after Settingsit("downloads the sample, enables its default choice, and removes only weights to restore the download action", async () => {render(<SettingsView onClose={() => undefined} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));const makeDefault = () => screen.getByRole("button", { name: "Set First/Last Frame as default" });expect(within(screen.getByRole("list", { name: "Generators" })).getByText("Default")).toBeInTheDocument();expect(within(screen.getByRole("list", { name: "Available to download" })).getByText("First/Last Frame")).toBeInTheDocument();@@ -355,6 +370,7 @@ 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: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "Download generator First/Last Frame" }));await screen.findByRole("button", { name: "Remove downloaded weights for First/Last Frame" }, { timeout: 5000 });files.clear();@@ -364,6 +380,7 @@ 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: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "Edit First/Last Frame generator" }));const advanced = screen.getByRole("switch", { name: "Show advanced options" });expect(advanced).not.toBeChecked();@@ -386,7 +403,7 @@ it("stores multiple variants and their GPU and VRAM criteria in the editor", asyexpect(screen.queryByText(/Download variants/)).toBeNull();fireEvent.click(advanced);expect(screen.getByLabelText("Transformer weights variant 3 GPU model")).toHaveValue("RTX 5090");- fireEvent.click(screen.getByRole("button", { name: "Generators" }));+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "Edit Default generator" }));expect(screen.getByRole("switch", { name: "Show advanced options" })).not.toBeChecked();expect(screen.queryByText(/Download variants/)).toBeNull();diff --git a/src/components/SettingsView.test.tsx b/src/components/SettingsView.test.tsxindex 67d1975..8675682 100644--- a/src/components/SettingsView.test.tsx+++ b/src/components/SettingsView.test.tsx@@ -6,7 +6,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { middleEllipsis, SettingsView } from "./SettingsView";import { createGeneratorTemplate, mossImageTemplate, loadGeneratorTemplateSettings, saveGeneratorTemplateSettings } from "../lib/settings";import { loadReferenceIconGeneratorId } from "../lib/referenceIconSettings";-import { loadLoras } from "../lib/loras";+import { loadLoras, saveLoras } from "../lib/loras";vi.mock("@tauri-apps/api/core", () => ({ invoke: vi.fn() }));@@ -20,7 +20,11 @@ afterEach(() => {delete (window as Window & { __TAURI_INTERNALS__?: unknown }).__TAURI_INTERNALS__;});-const open = () => render(<SettingsView onClose={() => undefined} />);+const open = (model: string | null = "MiniMax H3") => {+ const view = render(<SettingsView onClose={() => undefined} />);+ if (model) fireEvent.click(screen.getByRole("button", { name: model }));+ return view;+};const tab = (name: string) => within(screen.getByRole("navigation", { name: "Settings sections" })).getByRole("button", { name: new RegExp(`^${name}`) });const editDefaultGenerator = () => fireEvent.click(screen.getByRole("button", { name: "Edit Default generator" }));const combo = (name: string) => screen.getByRole("combobox", { name });@@ -69,9 +73,72 @@ describe("the settings page", () => {});describe("the settings screen", () => {+ it("opens model-specific generators and LoRAs, and keeps Other weights on their own page", () => {+ saveLoras([{ id: "future-adapter", name: "MOSS adapter", modelType: "moss", path: "D:/moss-adapter.safetensors" }]);+ open(null);+ const models = screen.getByRole("list", { name: "Generator models" });+ expect(within(models).getAllByRole("button").map((button) => button.getAttribute("aria-label"))).toEqual(["MiniMax H3", "MOSS", "Other"]);+ expect(screen.queryByRole("button", { name: "Edit Default generator" })).toBeNull();+ fireEvent.click(within(models).getByRole("button", { name: "MiniMax H3" }));+ expect(screen.getByRole("button", { name: "Edit Default generator" })).toBeTruthy();+ expect(screen.getByRole("button", { name: "Edit TaoMate 3-Step LoRA" })).toBeTruthy();+ expect(screen.queryByRole("button", { name: "Edit MOSS adapter LoRA" })).toBeNull();+ expect(screen.queryByRole("button", { name: "Edit MOSS Image generator" })).toBeNull();+ expect(screen.queryByRole("list", { name: "Other weights" })).toBeNull();+ editDefaultGenerator();+ fireEvent.click(combo("Add LoRA to generator"));+ expect(screen.queryByRole("option", { name: "MOSS adapter" })).toBeNull();+ fireEvent.keyDown(combo("Add LoRA to generator"), { key: "Escape" });+ fireEvent.click(screen.getByRole("button", { name: "Generators" }));+ expect(document.activeElement).toBe(screen.getByRole("button", { name: "MiniMax H3" }));+ fireEvent.click(screen.getByRole("button", { name: "MOSS" }));+ expect(screen.getByRole("button", { name: "Edit MOSS Image generator" })).toBeTruthy();+ expect(screen.getByRole("button", { name: "Edit MOSS adapter LoRA" })).toBeTruthy();+ expect(screen.getByText("This model does not support LoRAs.")).toBeTruthy();+ expect(screen.queryByRole("button", { name: "Add LoRA" })).toBeNull();+ expect(screen.queryByRole("button", { name: "Edit TaoMate 3-Step LoRA" })).toBeNull();+ expect(screen.queryByRole("button", { name: "Edit Default generator" })).toBeNull();+ fireEvent.click(screen.getByRole("button", { name: "Generators" }));+ expect(document.activeElement).toBe(screen.getByRole("button", { name: "MOSS" }));+ fireEvent.click(screen.getByRole("button", { name: "Other" }));+ expect(screen.getByRole("list", { name: "Other weights" })).toBeTruthy();+ for (const name of ["Real-ESRGAN", "SeedVR2"]) expect(screen.getByText(name)).toBeTruthy();+ expect(screen.queryByRole("list", { name: "Generators" })).toBeNull();+ expect(screen.queryByRole("list", { name: "LoRAs" })).toBeNull();+ });++ it("creates a generator for the selected model and follows model changes when returning", () => {+ open("MOSS");+ const defaultId = loadGeneratorTemplateSettings().defaultTemplateId;+ fireEvent.click(screen.getByRole("button", { name: "New generator" }));+ const name = (screen.getByLabelText("Generator name") as HTMLInputElement).value;+ expect(loadGeneratorTemplateSettings().templates.find((template) => template.name === name)).toMatchObject({ modelType: "moss", attention: "flash2", defaultSteps: 50 });+ expect(loadGeneratorTemplateSettings().defaultTemplateId).toBe(defaultId);+ fireEvent.click(combo("Generator model"));+ fireEvent.click(screen.getByRole("option", { name: /^MiniMax H3/ }));+ fireEvent.click(screen.getByRole("button", { name: "Back" }));+ expect(screen.getByRole("heading", { level: 1, name: "MiniMax H3" })).toBeTruthy();+ expect(screen.getByRole("button", { name: `Edit ${name} generator` })).toBeTruthy();+ });++ it("opens the model page when navigating from generator, LoRA and Other downloads", () => {+ const props = { onClose: vi.fn() };+ const view = render(<SettingsView {...props} navigation={{ templateId: "moss-image" }} />);+ expect(combo("Generator model").getAttribute("data-value")).toBe("moss");+ fireEvent.click(screen.getByRole("button", { name: "Back" }));+ expect(screen.getByRole("heading", { level: 1, name: "MOSS" })).toBeTruthy();+ view.rerender(<SettingsView {...props} navigation={{ templateId: "lora:taomate-3step", loraId: "taomate-3step" }} />);+ expect(screen.getByRole("dialog", { name: "Edit LoRA" })).toBeTruthy();+ fireEvent.click(screen.getByRole("button", { name: "Cancel" }));+ expect(screen.getByRole("heading", { level: 1, name: "MiniMax H3" })).toBeTruthy();+ view.rerender(<SettingsView {...props} navigation={{ templateId: "other:seedvr2", otherWeightId: "seedvr2" }} />);+ expect(screen.getByRole("heading", { level: 1, name: "Other" })).toBeTruthy();+ expect(screen.getByRole("list", { name: "Other weights" })).toBeTruthy();+ });+it("groups MOSS under its model and edits its image-only weight setup", () => {- open();- expect(screen.getByRole("group", { name: "MOSS Image" })).toBeTruthy();+ open("MOSS");+ expect(screen.getByRole("heading", { level: 1, name: "MOSS" })).toBeTruthy();fireEvent.click(screen.getByRole("button", { name: "Edit MOSS Image generator" }));expect(combo("Generator model").getAttribute("data-value")).toBe("moss");expect(screen.queryByRole("combobox", { name: "Generator mode" })).toBeNull();@@ -97,7 +164,7 @@ describe("the settings screen", () => {expect((motion() as HTMLButtonElement).disabled).toBe(true);pick("Generator mode", "Text prompt");expect(motion().getAttribute("aria-checked")).toBe("true");- fireEvent.click(screen.getByRole("button", { name: "Generators" }));+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "New generator" }));expect(motion().getAttribute("aria-checked")).toBe("false");view.unmount();@@ -115,7 +182,7 @@ describe("the settings screen", () => {expect(optionsOf("Generator attention")).toEqual(["Exact attention", "Flash attention", "Sage attention", "Sol attention"]);pick("Generator attention", "Sol attention");expect(screen.getByText("Sol attention requires a CUDA GPU on the machine running generation.")).toBeTruthy();- fireEvent.click(screen.getByRole("button", { name: "Generators" }));+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));fireEvent.click(screen.getByRole("button", { name: "New generator" }));expect(combo("Generator attention").getAttribute("data-value")).toBe("sage2");view.unmount();@@ -165,12 +232,12 @@ describe("the settings screen", () => {it("keeps the popup's saved icon choice without exposing confirmation in settings", () => {localStorage.setItem("slopus.reference-icon-automation.v1", "enabled");- const view = open();+ const view = open(null);const automatic = () => toggle("Automatic reference icon generation");expect(automatic().getAttribute("aria-checked")).toBe("true");expect(screen.queryByRole("switch", { name: "Ask before automatic icon generation" })).toBeNull();view.unmount();- open();+ open(null);expect(automatic().getAttribute("aria-checked")).toBe("true");expect(localStorage.getItem("slopus.reference-icon-automation.v1")).toBe("enabled");fireEvent.click(automatic());@@ -304,7 +371,7 @@ describe("the settings screen", () => {expect(screen.queryByRole("button", { name: /Clear generator paths/ })).toBeNull();editDefaultGenerator();expect(screen.getByRole("button", { name: /Clear generator paths/ })).toBeTruthy();- fireEvent.click(screen.getByRole("button", { name: "Generators" }));+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));expect(screen.queryByRole("button", { name: /Clear generator paths/ })).toBeNull();fireEvent.click(tab("Appearance"));expect(screen.queryByRole("button", { name: /Clear generator paths/ })).toBeNull();@@ -313,11 +380,12 @@ describe("the settings screen", () => {it("edits generators on a sub-page with a breadcrumb and returns on Escape or Back", async () => {const onClose = vi.fn();render(<SettingsView onClose={onClose} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));const opener = screen.getByRole("button", { name: "Edit Default generator" });opener.focus(); fireEvent.click(opener);expect(screen.queryByRole("dialog")).toBeNull();const breadcrumb = screen.getByRole("navigation", { name: "Breadcrumb" });- expect(breadcrumb.textContent).toBe("GeneratorsDefault");+ expect(breadcrumb.textContent).toBe("GeneratorsMiniMax H3Default");expect(document.activeElement).toBe(screen.getByRole("heading", { level: 1, name: "Default" }));// The navigation pane stays usable while a sub-page is open.expect(tab("Appearance")).toBeTruthy();@@ -326,7 +394,7 @@ describe("the settings screen", () => {}fireEvent.keyDown(screen.getByLabelText("Generator name"), { key: "Escape" });- expect(screen.queryByRole("navigation", { name: "Breadcrumb" })).toBeNull();+ expect(screen.getByRole("navigation", { name: "Breadcrumb" }).textContent).toBe("GeneratorsMiniMax H3");expect(onClose).not.toHaveBeenCalled();await waitFor(() => expect(document.activeElement).toBe(screen.getByRole("button", { name: "Edit Default generator" })));@@ -335,12 +403,16 @@ describe("the settings screen", () => {expect(screen.queryByLabelText("Generator name")).toBeNull();expect(onClose).not.toHaveBeenCalled();fireEvent.click(screen.getByRole("button", { name: "Back" }));+ expect(onClose).not.toHaveBeenCalled();+ expect(screen.getByRole("button", { name: "MiniMax H3" })).toBeTruthy();+ fireEvent.click(screen.getByRole("button", { name: "Back" }));expect(onClose).toHaveBeenCalledOnce();});it("edits LoRAs in a content dialog and discards unsaved changes on Cancel or Escape", async () => {const onClose = vi.fn();render(<SettingsView onClose={onClose} />);+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));const opener = screen.getByRole("button", { name: "Edit TaoMate 3-Step LoRA" });opener.focus(); fireEvent.click(opener);const dialog = screen.getByRole("dialog", { name: "Edit LoRA" });@@ -384,16 +456,16 @@ describe("the settings screen", () => {const first = createGeneratorTemplate("Video"), second = createGeneratorTemplate("Icons");const templates = { templates: [first], defaultTemplateId: first.id, catalogVersion: 9 };saveGeneratorTemplateSettings(templates);- const view = open();+ const view = open(null);expect(combo("Reference icon generator").getAttribute("data-value")).toBe(first.id);view.unmount();saveGeneratorTemplateSettings({ ...templates, templates: [first, second] });- const reopened = open();+ const reopened = open(null);pick("Reference icon generator", "Icons");expect(loadReferenceIconGeneratorId()).toBe(second.id);expect(loadGeneratorTemplateSettings().defaultTemplateId).toBe(first.id);reopened.unmount();- open();+ open(null);expect(combo("Reference icon generator").getAttribute("data-value")).toBe(second.id);});@@ -413,7 +485,7 @@ describe("the settings screen", () => {expect(loadGeneratorTemplateSettings().templates.find((template) => template.name === "Fast draft")).toMatchObject({ videoSigmaShift: 8.5, audioSigmaShift: 2.5 });expect(screen.getByRole("heading", { level: 1, name: "Fast draft" })).toBeTruthy();enterPath("Transformer weights", "D:\\Models\\draft.safetensors");- fireEvent.click(screen.getByRole("button", { name: "Generators" }));+ fireEvent.click(screen.getByRole("button", { name: "MiniMax H3" }));expect(screen.queryByRole("group", { name: "Transformer weights" })).toBeNull();fireEvent.click(screen.getByRole("button", { name: "Set Fast draft as default" }));diff --git a/src/components/SettingsView.tsx b/src/components/SettingsView.tsxindex a720791..4a3df44 100644--- a/src/components/SettingsView.tsx+++ b/src/components/SettingsView.tsx@@ -281,7 +281,8 @@ const engineSeverity = (status: SlopfabStatus | null, desktop: boolean): InfoBara 280px navigation pane with Back at its top, and a content column thatreads like Windows Settings — a 28px title (a breadcrumb on sub-pages) overgroups of one-setting-per-row cards. */-export interface SettingsNavigation { templateId: string; loraId?: string }+export interface SettingsNavigation { templateId: string; loraId?: string; otherWeightId?: string }+const modelPageLabel = (model: string) => model === "other" ? "Other" : model === MOSS_MODEL_TYPE ? "MOSS" : GENERATOR_MODELS.find(({ value }) => value === model)?.label ?? model;export function SettingsView({ onClose, updates, initialTab = "engine", titleBarActions, navigation, providers = CHECKING_PROVIDERS }: {onClose: () => void; updates?: ReactNode; initialTab?: TabId;@@ -319,13 +320,17 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBarconst downloadState = useSyncExternalStore(subscribeWeightDownloads, getWeightDownloadState);const queuedDownloads = useSyncExternalStore(subscribeWeightDownloads, getQueuedWeightDownloads);const downloadPercent = downloadState ? weightDownloadProgress(downloadState) : 0;+ const [modelPage, setModelPage] = useState<string | null>(null);const [editingTemplateId, setEditingTemplateId] = useState<string | null>(null);const [editingLoraId, setEditingLoraId] = useState<string | null>(null);useEffect(() => {if (!navigation) return;setTab("engine");- setEditingTemplateId(loadGeneratorTemplateSettings().templates.some((template) => template.id === navigation.templateId) ? navigation.templateId : null);- setEditingLoraId(navigation.loraId && loadLoras().some((lora) => lora.id === navigation.loraId) ? navigation.loraId : null);+ const template = loadGeneratorTemplateSettings().templates.find((template) => template.id === navigation.templateId);+ const lora = loadLoras().find((entry) => entry.id === navigation.loraId);+ setModelPage(navigation.otherWeightId ? "other" : template?.modelType ?? (lora ? lora.modelType ?? "minimax-h3" : null));+ setEditingTemplateId(template?.id ?? null);+ setEditingLoraId(lora?.id ?? null);}, [navigation]);const [showAdvancedOptions, setShowAdvancedOptions] = useState(false);const [editingPath, setEditingPath] = useState<EnginePathId | null>(null);@@ -342,8 +347,8 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBarconst downloadedPathsKey = JSON.stringify(Object.values(selectedTemplate.sources ?? {}).flatMap((sources) => sources.map(({ downloadedPath }) => downloadedPath)));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: "Available to download", templates: templateSettings.templates.filter(templateNeedsDownload) },+ { id: "generators", title: "Generators", templates: templateSettings.templates.filter((template) => template.modelType === modelPage && !templateNeedsDownload(template)) },+ { id: "downloadable-generators", title: "Available to download", templates: templateSettings.templates.filter((template) => template.modelType === modelPage && templateNeedsDownload(template)) },];useEffect(() => { setShowAdvancedOptions(false); setEditingPath(null); setPathMenu(null); }, [editingTemplateId]);@@ -400,7 +405,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar/* A new page opens at its top; a sub-page takes focus on its title (or onthe name of a generator that was just created), and going back returnsfocus to the card that opened it. */- useEffect(() => { if (body.current) body.current.scrollTop = 0; }, [tab, editingTemplateId]);+ useEffect(() => { if (body.current) body.current.scrollTop = 0; }, [tab, editingTemplateId, modelPage]);useEffect(() => {if (editingTemplateId) {if (focusName.current) { focusName.current = false; nameField.current?.focus(); nameField.current?.select(); }@@ -409,11 +414,14 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar}const ref = returnFocus.current;returnFocus.current = null;- if (ref) [...(body.current?.querySelectorAll<HTMLElement>("[data-open-ref]") ?? [])].find((element) => element.dataset.openRef === ref)?.focus();- }, [editingTemplateId]);+ const opener = ref && [...(body.current?.querySelectorAll<HTMLElement>("[data-open-ref]") ?? [])].find((element) => element.dataset.openRef === ref);+ if (opener) opener.focus();+ else if (modelPage) subpageHeading.current?.focus();+ }, [editingTemplateId, modelPage]);- const openTemplate = (id: string) => { returnFocus.current = `template:${id}`; setEditingTemplateId(id); };- const leaveTemplate = () => setEditingTemplateId(null);+ const openTemplate = (id: string) => { returnFocus.current = `template:${id}`; setModelPage(templateSettings.templates.find((template) => template.id === id)!.modelType); setEditingTemplateId(id); };+ const leaveTemplate = () => { setModelPage(editingTemplate?.modelType ?? modelPage); setEditingTemplateId(null); };+ const leaveModel = () => { returnFocus.current = `model:${editingTemplate?.modelType ?? modelPage}`; setEditingTemplateId(null); setModelPage(null); };const browse = async (field: EnginePathField) => {setError(null);@@ -453,7 +461,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar};const addTemplate = () => {- const created = createGeneratorTemplate(`Generator ${templateSettings.templates.length + 1}`);+ const created = createGeneratorTemplate(`Generator ${templateSettings.templates.length + 1}`, modelPage ?? undefined);setTemplateSettings((current) => {const next = { ...current, templates: [...current.templates, created] };saveGeneratorTemplateSettings(next);@@ -494,8 +502,9 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBarsetTab(id);setEditingTemplateId(null);setEditingLoraId(null);+ setModelPage(null);};- const back = () => { if (editingTemplateId) leaveTemplate(); else onClose(); };+ const back = () => { if (editingTemplateId) leaveTemplate(); else if (tab === "engine" && modelPage) leaveModel(); else onClose(); };const downloadStatus = downloadState && <DownloadStatus state={downloadState} onError={setError}templateName={templateSettings.templates.find((template) => template.id === downloadState.templateId)?.name} />;@@ -614,7 +623,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar</SettingsGroup><AdditionalSafetensorsEditor key={selectedTemplate.id} value={selectedTemplate.additionalSafetensors ?? []} disabled={Boolean(downloading)} animate={selectedTemplate.mode === "animate"} onChange={(additionalSafetensors) => updateTemplate({ additionalSafetensors })} />- {generatorModel(selectedTemplate.modelType).loras && <TemplateLorasEditor value={selectedTemplate.loras ?? []} onChange={(loras) => updateTemplate({ loras })} />}+ {generatorModel(selectedTemplate.modelType).loras && <TemplateLorasEditor modelType={selectedTemplate.modelType} value={selectedTemplate.loras ?? []} onChange={(loras) => updateTemplate({ loras })} />}<SettingsGroup heading="Advanced"><SettingsCard icon={<Options20 />} header="Show advanced options" description="Per-GPU download sources for each model file">@@ -629,16 +638,21 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBarconst generatorList = <>{downloadStatus}- <ReferenceIconSetting templates={templateSettings} />+ {modelPage === null ? <>+ <ReferenceIconSetting templates={templateSettings} />+ <div className="settings-card-list" role="list" aria-label="Generator models">+ {[...new Set([...GENERATOR_MODELS.map(({ value }) => value), ...templateSettings.templates.map(({ modelType }) => modelType)]), "other"].map((model) =>+ <OpenableCard key={model} icon={model === "other" ? <ModelFile20 /> : model === MOSS_MODEL_TYPE ? <Image20 /> : <Video20 />} header={modelPageLabel(model)}+ openLabel={modelPageLabel(model)} openRef={`model:${model}`} description={model === "other" ? "Other weights" : "Generators and LoRAs"} onOpen={() => setModelPage(model)} />)}+ </div>+ </> : modelPage === "other" ? <OtherWeightsSettings desktop={desktop} /> : <>{generatorSections.filter((section) => section.id === "generators" || section.templates.length > 0).map((section) => <SettingsGroup key={section.id} heading={section.title}>{section.id === "generators" && <GeneratorSharing templates={[]}>{({ importButton }) => <SettingsCard icon={<Add20 />} header="Add a generator" description="Choose the generator used by default, or open one to edit its model setup">{importButton}<button type="button" className="secondary-button" onClick={addTemplate}>New generator</button></SettingsCard>}</GeneratorSharing>}<div className="settings-card-list" role="list" aria-label={section.title}>- {[...new Set(section.templates.map((template) => template.modelType))].map((modelType) => <div key={modelType} className="settings-card-list" role="group" aria-label={GENERATOR_MODELS.find((model) => model.value === modelType)?.label ?? modelType}>- <h3 className="settings-caption">{GENERATOR_MODELS.find((model) => model.value === modelType)?.label ?? modelType}</h3>- {section.templates.filter((template) => template.modelType === modelType).map((template) => {+ {section.templates.map((template) => {const needsDownload = templateNeedsDownload(template);const isDefault = template.id === templateSettings.defaultTemplateId;const active = downloadState?.active && downloadState.templateId === template.id;@@ -659,11 +673,11 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBararia-label={weights ? `Remove downloaded weights for ${template.name}` : `Remove generator ${template.name}`}data-tooltip={weights ? "Remove weights and keep the template" : "Remove generator"}><Delete16 /></button></>} />;- })}</div>)}+ })}</div></SettingsGroup>)}- <LoraLibrary onAdd={() => setEditingLoraId(`lora-${crypto.randomUUID()}`)} onEdit={setEditingLoraId} />- <OtherWeightsSettings desktop={desktop} />+ <LoraLibrary key={modelPage} modelType={modelPage} onAdd={() => setEditingLoraId(`lora-${crypto.randomUUID()}`)} onEdit={setEditingLoraId} />+ </>}</>;const current = TABS.find((item) => item.id === tab)!;@@ -720,12 +734,16 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar</NavPane><div className="settings-view__body" ref={body}>- <div className="settings-page" id={`settings-panel-${tab}`} aria-labelledby={editingTemplate ? "settings-subpage-heading" : "settings-page-heading"}>- {editingTemplate+ <div className="settings-page" id={`settings-panel-${tab}`} aria-labelledby={editingTemplate || (tab === "engine" && modelPage) ? "settings-subpage-heading" : "settings-page-heading"}>+ {tab === "engine" && (editingTemplate || modelPage)? <nav className="settings-breadcrumb" aria-label="Breadcrumb">- <button type="button" className="settings-breadcrumb__link" onClick={leaveTemplate}>Generators</button>+ <button type="button" className="settings-breadcrumb__link" onClick={leaveModel}>Generators</button><ChevronRight20 aria-hidden="true" className="settings-breadcrumb__separator" />- <h1 id="settings-subpage-heading" ref={subpageHeading} tabIndex={-1} aria-current="page">{editingTemplate.name || "Untitled generator"}</h1>+ {editingTemplate && <>+ <button type="button" className="settings-breadcrumb__link" onClick={leaveTemplate}>{modelPageLabel(editingTemplate.modelType)}</button>+ <ChevronRight20 aria-hidden="true" className="settings-breadcrumb__separator" />+ </>}+ <h1 id="settings-subpage-heading" ref={subpageHeading} tabIndex={-1} aria-current="page">{editingTemplate ? editingTemplate.name || "Untitled generator" : modelPageLabel(modelPage!)}</h1></nav>: <h1 id="settings-page-heading" className="settings-page__title">{current.label}</h1>}@@ -753,7 +771,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar}} /></aside></div>- {editingLoraId && <LoraEditor key={editingLoraId} loraId={editingLoraId} onDone={() => setEditingLoraId(null)} />}+ {editingLoraId && <LoraEditor key={editingLoraId} loraId={editingLoraId} modelType={modelPage ?? "minimax-h3"} onDone={() => setEditingLoraId(null)} />}</>);}diff --git a/src/lib/loras.test.ts b/src/lib/loras.test.tsindex 443c6e6..1217797 100644--- a/src/lib/loras.test.ts+++ b/src/lib/loras.test.ts@@ -145,3 +145,15 @@ it.each([0, -1, Infinity, NaN, 1e39, 1e-50])("rejects invalid LoRA sigma shift %expect(() => saveLoras([{ id: "bad", name: "Bad", path: "D:/bad.safetensors", videoSigmaShiftOverride: shift }])).toThrow("Sigma shift");expect(() => saveLoras([{ id: "bad", name: "Bad", path: "D:/bad.safetensors", audioSigmaShiftOverride: shift }])).toThrow("Sigma shift");});+++it("preserves model ownership while accepting older H3 library entries", () => {+ const entries = [+ { id: "legacy", name: "Legacy H3", path: "D:/h3.safetensors" },+ { id: "moss", name: "MOSS adapter", path: "D:/moss.safetensors", modelType: "moss" },+ ];+ saveLoras(entries);+ expect(loadLoras().filter((entry) => entries.some(({ id }) => id === entry.id))).toEqual(entries);+ saveLoras(loadLoras().map((entry) => ({ ...entry, path: entry.path.replace("D:/", "E:/") })));+ expect(loadLoras().find(({ id }) => id === "moss")).toMatchObject({ modelType: "moss", path: "E:/moss.safetensors" });+});diff --git a/src/lib/loras.ts b/src/lib/loras.tsindex 8abee4a..79636c0 100644--- a/src/lib/loras.ts+++ b/src/lib/loras.ts@@ -5,6 +5,8 @@ import { MAX_GENERATION_STEPS } from "./project";export interface Lora {id: string;name: string;+ /** Older library entries are MiniMax H3 adapters. */+ modelType?: string;path: string;url?: string;stepOverride?: number;@@ -50,6 +52,7 @@ export function loadLoras(): Lora[] {|| typeof entry.name !== "string" || !entry.name.trim() || typeof entry.path !== "string") return [];ids.add(entry.id);return [{ id: entry.id, name: entry.name, path: entry.path,+ ...(typeof entry.modelType === "string" && entry.modelType.trim() ? { modelType: entry.modelType.trim() } : {}),...(entry.samplingPreset === "dmad-4step" ? { samplingPreset: "dmad-4step" as const } : {}),...(isSigmaShift(entry.videoSigmaShiftOverride) ? { videoSigmaShiftOverride: entry.videoSigmaShiftOverride } : {}),...(isSigmaShift(entry.audioSigmaShiftOverride) ? { audioSigmaShiftOverride: entry.audioSigmaShiftOverride } : {}),