AI media harness for planning, generating, and editing locally
TypeScript
Add global LoRA controls and scene overrides
Bitti060d490604e5
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex 85b008f..c1eb71e 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -4,6 +4,8 @@ Changes since 0.3.2.## What's new+- **LoRA controls.** Enable MiniMax H3 LoRAs globally, drag the library to set application order, and add scene overrides in Generation. Global adapters remain active and appear read only in scenes. Step counts and sampling recipes follow the effective stack, with conflicting recipes blocked.+- **Generation previews.** Download TAEH3 from Other weights to play silent MiniMax H3 previews in scene cards during generation, locally or on a worker. A Settings switch controls previews; final videos use the generator's selected VAE.- **Pika H3 Flex.** Added FL2VA and Ref2VA LoRA downloads with Pika's fixed six-step re-noising recipe and video/audio sigma shifts of 12/3.diff --git a/src/components/LoraSettings.test.tsx b/src/components/LoraSettings.test.tsxnew file mode 100644index 0000000..c783d39--- /dev/null+++ b/src/components/LoraSettings.test.tsx@@ -0,0 +1,27 @@+// @vitest-environment jsdom+import "@testing-library/jest-dom/vitest";+import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, expect, it, vi } from "vitest";+import { LoraLibrary } from "./LoraSettings";+import { DMAD_LORA, PIKA_REF2VA_LORA, effectiveLoras, loadLoras, saveLoras } from "../lib/loras";++const { queued } = vi.hoisted(() => ({ queued: [] }));+vi.mock("../lib/weightDownloads", () => ({ getWeightDownloadState: () => null, getQueuedWeightDownloads: () => queued,+ subscribeWeightDownloads: () => () => {}, refreshDownloadedLoras: async () => {}, weightDownloadProgress: () => 0 }));+afterEach(() => { cleanup(); localStorage.clear(); });++it("toggles globals, blocks incompatible recipes and drags the effective application order", () => {+ saveLoras([{ ...DMAD_LORA, path: "D:/dmad" }, { id: "style", name: "Style", path: "D:/style" }]);+ render(<LoraLibrary modelType="minimax-h3" onAdd={vi.fn()} onEdit={vi.fn()} />);+ fireEvent.click(screen.getByRole("switch", { name: `Use ${DMAD_LORA.name} globally` }));+ expect(loadLoras().find((lora) => lora.id === DMAD_LORA.id)?.globallyEnabled).toBe(true);+ expect(screen.getByRole("switch", { name: `Use ${PIKA_REF2VA_LORA.name} globally` })).toBeDisabled();+ fireEvent.click(screen.getByRole("switch", { name: "Use Style globally" }));+ const source = screen.getByRole("button", { name: "Edit Style LoRA" }).closest('[role="listitem"]')!;+ const target = screen.getByRole("button", { name: `Edit ${DMAD_LORA.name} LoRA` }).closest('[role="listitem"]')!;+ const dataTransfer = { setData: vi.fn(), effectAllowed: "" };+ fireEvent.dragStart(source, { dataTransfer });+ fireEvent.dragOver(target, { dataTransfer });+ fireEvent.drop(target, { dataTransfer });+ expect(effectiveLoras().map((entry) => entry.loraId)).toEqual(["style", DMAD_LORA.id]);+});diff --git a/src/components/LoraSettings.tsx b/src/components/LoraSettings.tsxindex 1e4493d..938c75a 100644--- a/src/components/LoraSettings.tsx+++ b/src/components/LoraSettings.tsx@@ -2,7 +2,7 @@ import { DEFAULT_VIDEO_SIGMA_SHIFT, DEFAULT_AUDIO_SIGMA_SHIFT, MIN_SIGMA_SHIFT,import { Add20, ArrowDown16, ArrowUp16, Delete16, Download16, Lora20, Spinner16, Wrench16 } from "./ui/icons";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 { effectiveLoras, selectionConflict, moveLibraryLora, 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";@@ -24,6 +24,12 @@ export function LoraLibrary({ modelType, onAdd, onEdit }: { modelType: string; oconst queuedDownloads = useSyncExternalStore(subscribeWeightDownloads, getQueuedWeightDownloads);const [error, setError] = useState<string | null>(null);const desktop = isTauri();+ const dragged = useRef<string | null>(null);+ const [dropTarget, setDropTarget] = useState<string | null>(null);+ const updateGlobal = (id: string, patch: Partial<Lora>) => {+ try { saveLoras(loadLoras().map((lora) => lora.id === id ? { ...lora, ...patch } : lora)); setError(null); }+ catch (reason) { setError(String(reason)); }+ };useEffect(() => {const refresh = () => { void refreshDownloadedLoras().catch((reason) => setError(String(reason))); };refresh();@@ -32,19 +38,35 @@ export function LoraLibrary({ modelType, onAdd, onEdit }: { modelType: string; oreturn () => { window.removeEventListener("focus", refresh); window.clearInterval(timer); };}, []);return <SettingsGroup heading="LoRAs">- {supported ? <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="Enable globally or choose LoRAs in generators and scenes. Drag to set their application order."><button className="secondary-button" type="button" onClick={onAdd}>Add LoRA</button></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) => {+ {loras.map((lora, index) => {const active = download?.active && download.loraId === lora.id;const queued = queuedDownloads.some((item) => item.loraId === lora.id);const preparing = active && download?.phase === "preparing";const percent = download ? Math.floor(weightDownloadProgress(download)) : 0;+ const conflict = selectionConflict(effectiveLoras([], [{ loraId: lora.id, enabled: true, strength: 1 }], modelType));return <OpenableCard key={lora.id} icon={<Lora20 />} header={lora.name} openLabel={`Edit ${lora.name} LoRA`} onOpen={() => onEdit(lora.id)}+ className={dropTarget === lora.id ? "lora-drop-target" : undefined}+ dragProps={{ draggable: true,+ onDragStart: (event) => { dragged.current = lora.id; event.dataTransfer.effectAllowed = "move"; event.dataTransfer.setData("application/x-slopus-lora", lora.id); },+ onDragOver: (event) => { if (dragged.current) { event.preventDefault(); setDropTarget(lora.id); } },+ onDrop: (event) => { event.preventDefault(); if (dragged.current) moveLibraryLora(dragged.current, lora.id); dragged.current = null; setDropTarget(null); },+ onDragEnd: () => { dragged.current = null; setDropTarget(null); } }}description={<span data-tooltip={lora.path || undefined}>{queued ? "Queued for download" : active ? preparing ? "Preparing…" : `Downloading · ${percent}%` : lora.needsPreparation ? "Needs preparation" : lora.path ? "Available" : "Not downloaded"}</span>}progress={active && !preparing && <ProgressBar className="settings-progress" value={weightDownloadProgress(download!)} aria-label={`Downloading ${lora.name}`} />}actions={<>+ <button className="icon-button" type="button" aria-label={`Move ${lora.name} up`} disabled={index === 0} onClick={() => moveLibraryLora(lora.id, loras[index - 1].id)}><ArrowUp16 /></button>+ <button className="icon-button" type="button" aria-label={`Move ${lora.name} down`} disabled={index === loras.length - 1} onClick={() => moveLibraryLora(lora.id, loras[index + 1].id)}><ArrowDown16 /></button>+ {modelType === "minimax-h3" && <>+ {lora.globallyEnabled && <label className="template-lora__strength">Strength<input type="number" className="text-field settings-field settings-field--number" step="0.1" aria-label={`${lora.name} global strength`} value={lora.globalStrength ?? 1}+ onChange={(event) => { const strength = Number(event.target.value); if (event.target.value && Number.isFinite(strength) && strength !== 0) updateGlobal(lora.id, { globalStrength: strength }); }} /></label>}+ <span data-tooltip={!lora.globallyEnabled ? conflict ?? "Always use this LoRA" : "Always used by MiniMax H3"}>+ <ToggleSwitch aria-label={`Use ${lora.name} globally`} checked={lora.globallyEnabled ?? false} disabled={!lora.globallyEnabled && !!conflict} onChange={(globallyEnabled) => updateGlobal(lora.id, { globallyEnabled })} />+ </span>+ </>}{lora.path && <button className="icon-button" type="button" disabled={!desktop || active || queued} aria-label={`Prepare LoRA ${lora.name}`} data-tooltip="Prepare missing timestep grid"onClick={() => { setError(null); void prepareLora(lora).catch((reason) => setError(String(reason))); }}>{preparing ? <Spinner16 className="spin" /> : <Wrench16 />}</button>}{lora.url && !lora.path@@ -130,18 +152,27 @@ export function LoraEditor({ loraId, modelType, onDone }: { loraId: string; mode</ContentDialog>;}-export function TemplateLorasEditor({ modelType, value, onChange }: { modelType: string; value: TemplateLora[]; onChange: (value: TemplateLora[]) => void }) {+export function TemplateLorasEditor({ modelType, value: selection, onChange }: { modelType: string; value: TemplateLora[]; onChange: (value: TemplateLora[]) => void }) {const library = useLoras();- const active = value.filter((entry) => entry.enabled && entry.strength !== 0);+ const order = new Map(library.map((entry, index) => [entry.id, index]));+ const value = [...selection].sort((a, b) => (order.get(a.loraId) ?? Infinity) - (order.get(b.loraId) ?? Infinity));+ const effective = effectiveLoras(value, [], modelType, library);+ const active = effective.filter((entry) => entry.enabled && entry.strength !== 0);+ const conflict = selectionConflict(effective, library);+ const conflictsWith = (next: TemplateLora[]) => selectionConflict(effectiveLoras(next, [], modelType, library), library);const dmad = active.some((entry) => library.find(({ id }) => id === entry.loraId)?.samplingPreset === "dmad-4step");const pika = active.some((entry) => library.find(({ id }) => id === entry.loraId)?.samplingPreset === "pika-6step");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.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 update = (index: number, patch: Partial<TemplateLora>) => {+ const next = value.map((entry, i) => i === index ? { ...entry, ...patch } : entry);+ if (!conflictsWith(next) || patch.enabled === false || patch.strength === 0) onChange(next);+ };const move = (index: number, delta: number) => {const next = [...value];+ moveLibraryLora(next[index].loraId, next[index + delta].loraId);[next[index], next[index + delta]] = [next[index + delta], next[index]];onChange(next);};@@ -156,16 +187,17 @@ export function TemplateLorasEditor({ modelType, value, onChange }: { modelType:<button className="icon-button" type="button" aria-label={`Move ${name} up`} data-tooltip="Move up" disabled={index === 0} onClick={() => move(index, -1)}><ArrowUp16 /></button><button className="icon-button" type="button" aria-label={`Move ${name} down`} data-tooltip="Move down" disabled={index === value.length - 1} onClick={() => move(index, 1)}><ArrowDown16 /></button><button className="icon-button" type="button" aria-label={`Deactivate and remove ${name}`} data-tooltip="Remove" onClick={() => onChange(value.filter((_, i) => i !== index))}><Delete16 /></button>- <ToggleSwitch checked={entry.enabled} aria-label={`Enable ${name}`} onChange={(enabled) => update(index, { enabled })} />+ <ToggleSwitch checked={entry.enabled} aria-label={`Enable ${name}`} disabled={!entry.enabled && !!conflictsWith(value.map((item, i) => i === index ? { ...item, enabled: true } : item))} onChange={(enabled) => update(index, { enabled })} /></SettingsCard>;})}<SettingsCard icon={<Add20 />} header="Add a LoRA" description="A strength of 0 turns an adapter off. Missing active LoRAs download with the generator."><ComboBox aria-label="Add LoRA to generator" value="" disabled={!available.length} placeholder={available.length ? "Choose a LoRA" : "None available"}onChange={(loraId) => { if (loraId) onChange([...value, { loraId, enabled: true, strength: 1 }]); }}- options={available.map((lora) => ({ value: lora.id, label: lora.name }))} />+ options={available.map((lora) => ({ value: lora.id, label: lora.name, disabled: !!conflictsWith([...value, { loraId: lora.id, enabled: true, strength: 1 }]) }))} /></SettingsCard>{(shifts.videoSigmaShift !== undefined || shifts.audioSigmaShift !== undefined) && <InfoBar severity="informational" message={`Active LoRA sigma shifts: ${[shifts.videoSigmaShift !== undefined ? `video ${shifts.videoSigmaShift}` : "", shifts.audioSigmaShift !== undefined ? `audio ${shifts.audioSigmaShift}` : ""].filter(Boolean).join(", ")}.`} />}- {dmad && pika ? <InfoBar severity="error" message="Choose either DMAD or Pika H3 Flex: their sampling recipes cannot be combined." />+ <p className="settings-caption">Application order follows the LoRA library. Global LoRAs are always included.</p>+ {conflict ? <InfoBar severity="error" message={conflict} />: pika ? <InfoBar severity="informational" message="Pika H3 Flex fixes generation to six re-noising evaluations and turns off MotionCache. Use FL2VA with First/Last Frame generators and Ref2VA with References generators." />: dmad ? <InfoBar severity="informational" message="DMAD fixes generation to four re-noising evaluations and turns off MotionCache." />: stepOverride !== undefined && <InfoBar severity="informational" message={`Active LoRAs set the scene's step count to ${stepOverride}, the highest selected override.`} />}diff --git a/src/components/OpenableCard.tsx b/src/components/OpenableCard.tsxindex 28ab8d4..795ed76 100644--- a/src/components/OpenableCard.tsx+++ b/src/components/OpenableCard.tsx@@ -1,15 +1,16 @@import { ChevronRight16 } from "./ui/icons";-import type { ReactNode } from "react";+import type { ReactNode, HTMLAttributes } from "react";/* A settings card that opens something (a generator, a LoRA) AND carries itsown buttons. A button cannot hold buttons, so the open action is atransparent button laid under the card, the way the SettingsExpander headeris built; the trailing controls sit above it and take their own presses. */-export function OpenableCard({ icon, header, description, progress, openLabel, onOpen, actions, className, openRef }: {+export function OpenableCard({ icon, header, description, progress, openLabel, onOpen, actions, className, openRef, dragProps }: {icon: ReactNode; header: ReactNode; description?: ReactNode; progress?: ReactNode; openLabel: string; onOpen: () => void;actions?: ReactNode; className?: string; openRef?: string;+ dragProps?: Pick<HTMLAttributes<HTMLDivElement>, "draggable" | "onDragStart" | "onDragOver" | "onDrop" | "onDragEnd">;}) {- return <div className={`ui-settings-card settings-open-card${className ? ` ${className}` : ""}`} role="listitem">+ return <div {...dragProps} className={`ui-settings-card settings-open-card${className ? ` ${className}` : ""}`} role="listitem"><button type="button" className="settings-open-card__open" aria-label={openLabel} data-open-ref={openRef} onClick={onOpen} /><span className="ui-settings-card__icon" aria-hidden="true">{icon}</span><span className="ui-settings-card__text">diff --git a/src/components/SettingsView.tsx b/src/components/SettingsView.tsxindex 2bd25af..cc6a3e3 100644--- a/src/components/SettingsView.tsx+++ b/src/components/SettingsView.tsx@@ -23,7 +23,7 @@ import { WeightSourcesEditor } from "./WeightSourcesEditor";import { LoraEditor, LoraLibrary, TemplateLorasEditor } from "./LoraSettings";import { OpenableCard } from "./OpenableCard";import { TitleBar } from "./TitleBar";-import { downloadableTemplateLoras, loadLoras } from "../lib/loras";+import { effectiveLoras, downloadableTemplateLoras, loadLoras } from "../lib/loras";import { retryWeightDownload } from "../lib/weightDownloads";import { getQueuedWeightDownloads, cancelWeightDownload, downloadTemplateWeights, getWeightDownloadState, refreshDownloadedWeights, removeTemplateWeights, subscribeWeightDownloads, updateWeightPath, weightDownloadProgress, type DownloadState } from "../lib/weightDownloads";import { CHECKING_PROVIDERS, chooseEnginePath, getAgentModels, getEngineStatus, type ProviderStatus, type ModelStatus, type SlopfabStatus } from "../lib/runtime";@@ -78,7 +78,7 @@ export function middleEllipsis(text: string, max = 64): string {}function templateSummary(template: GeneratorTemplate): string {- const loras = downloadableTemplateLoras(template.loras);+ const loras = downloadableTemplateLoras(effectiveLoras(template.loras, [], template.modelType));const pendingModels = generatorPathFields(template).some(({ id }) => isDownloadUrl(template.paths[id])|| (!template.paths[id].trim() && (template.sources?.[id]?.length ?? 0) > 0));return `${template.defaultSteps} steps${loras.length && !pendingModels ? ` · Needs ${loras.map(({ name }) => name).join(", ")} LoRA${loras.length > 1 ? "s" : ""}` : ""}`;diff --git a/src/components/workspace/GeneratorView.tsx b/src/components/workspace/GeneratorView.tsxindex ad6b6a6..22a0437 100644--- a/src/components/workspace/GeneratorView.tsx+++ b/src/components/workspace/GeneratorView.tsx@@ -4,7 +4,7 @@ import { sceneUpscaleSubmission, selectedUpscaleTake } from "../../lib/sceneUpscimport { Flyout } from "../ui";import { ChevronDown14 } from "../ui/icons";import { duplicateScene, makeSceneGenerationPrimary, removeSceneDraft, removeSceneGeneration, saveSceneDrafts, selectSceneGeneration } from "../../lib/sceneHistory";-import { sceneGenerationRequest, sendBlocker, templateSceneBlocker } from "../../lib/sceneGeneration";+import { sceneLoraBlocker, sceneGenerationRequest, sendBlocker, templateSceneBlocker } from "../../lib/sceneGeneration";import { longShotBlocker, longShotDependencies, longShotPosition } from "../../lib/longShot";export { templateSceneBlocker } from "../../lib/sceneGeneration";import type { GenerationSubmission } from "../../lib/workQueue";@@ -28,7 +28,7 @@ import { SceneInspector, ShotInspector, STEP_SECONDS, writeShots } from "./Sceneimport { STATUS_BADGE, type SceneIndicatorStatus } from "./sceneStatus";import { forgetShotPosters } from "./ShotThumbnail";import { purgeTimelineThumbnails } from "../../lib/timelineThumbnails";-import { defaultGeneratorTemplate, generationStepsForTemplate, loadDebugOptionsEnabled, loadGeneratorTemplateSettings, saveGeneratorTemplateSettings, subscribeDebugOptions, subscribeGeneratorTemplates, templateSupportsVideo, templateUsable } from "../../lib/settings";+import { templateWithSceneLoras, defaultGeneratorTemplate, generationStepsForTemplate, loadDebugOptionsEnabled, loadGeneratorTemplateSettings, saveGeneratorTemplateSettings, subscribeDebugOptions, subscribeGeneratorTemplates, templateSupportsVideo, templateUsable } from "../../lib/settings";import { refreshDownloadedWeights } from "../../lib/weightDownloads";import { DebugPromptDialog } from "./DebugPromptDialog";import { sceneVideoSettings, videoGuidedScene } from "../../lib/videoLibrary";@@ -426,8 +426,8 @@ export function GeneratorView({ config, sceneIds, toolbarStart, folderPath, runtconst visited = new Set<string>();const visiting = new Set<string>();const visitForBatch = (job: GenerationJob): boolean => {- if (job.generatorTemplateId && !templateSettings.templates.some(t => t.id === job.generatorTemplateId) || !templateUsable(templateFor(job))) return false;- if (continuationBlocker(job, config.generationJobs) || longShotBlocker(job, config, false) || templateSceneBlocker(sceneTypeFor(job), templateFor(job)) || sendBlocker(job, config.references, config)) return false;+ if (job.generatorTemplateId && !templateSettings.templates.some(t => t.id === job.generatorTemplateId) || !templateUsable(templateWithSceneLoras(templateFor(job), job))) return false;+ if (sceneLoraBlocker(job, templateFor(job)) || continuationBlocker(job, config.generationJobs) || longShotBlocker(job, config, false) || templateSceneBlocker(sceneTypeFor(job), templateFor(job)) || sendBlocker(job, config.references, config)) return false;if (visited.has(job.id)) return true;if (visiting.has(job.id)) return false;if (["queued", "generating", "ready"].includes(job.status)) { visited.add(job.id); return true; }@@ -454,7 +454,9 @@ export function GeneratorView({ config, sceneIds, toolbarStart, folderPath, runtconst generationBlocker = (job: GenerationJob): string | null => {if (job.generatorTemplateId && !templateSettings.templates.some(t => t.id === job.generatorTemplateId)) return "The saved generator is no longer available. Choose another generator.";- if (!templateUsable(templateFor(job))) return "Prepare this scene's generator weights before generating.";+ const loraBlocker = sceneLoraBlocker(job, templateFor(job));+ if (loraBlocker) return loraBlocker;+ if (!templateUsable(templateWithSceneLoras(templateFor(job), job))) return "Prepare this scene's generator weights before generating.";if (!runtimeReady) return runtimeError ?? generatorRuntime?.detail ?? "The video generator is not ready.";if (job.status === "ready") return "Saving this scene.";const source = config.generationJobs.find((candidate) => candidate.id === continuationSceneId(job, config.generationJobs));@@ -706,7 +708,7 @@ export function GeneratorView({ config, sceneIds, toolbarStart, folderPath, runtshots={selectedShots}template={selectedTemplate}defaultSteps={defaultGenerationSteps}- effectiveSteps={generationStepsForTemplate(sceneGenerationSteps(selected, defaultGenerationSteps), selectedTemplate)}+ effectiveSteps={generationStepsForTemplate(sceneGenerationSteps(selected, defaultGenerationSteps), selectedTemplate, selected.loraOverrides ?? [])}defaultLook={inheritedSettings.defaultLook}defaultLookSource={parentVideo ? "Video" : "project"}disabled={false}diff --git a/src/components/workspace/SceneEditor.tsx b/src/components/workspace/SceneEditor.tsxindex 117a526..db40005 100644--- a/src/components/workspace/SceneEditor.tsx+++ b/src/components/workspace/SceneEditor.tsx@@ -1,7 +1,8 @@import { GenerationEffects } from "./GenerationEffects";+import { SceneLoras } from "./SceneLoras";import { generatorModel } from "../../lib/generatorModels";import { DEFAULT_VIDEO_SIGMA_SHIFT, DEFAULT_AUDIO_SIGMA_SHIFT } from "../../lib/sampling";-import { sigmaShiftOverridesForTemplate, type GeneratorTemplate } from "../../lib/settings";+import { generationStepsForTemplate, sigmaShiftOverridesForTemplate, type GeneratorTemplate } from "../../lib/settings";import { Audio16, Dismiss12, Image16, ImageAdd16, Text16, Video16 } from "../ui/icons";import { BACKDROP_OPTIONS, type BackdropColor } from "../../lib/backdrop";import { longShotPosition } from "../../lib/longShot";@@ -361,6 +362,7 @@ export function SceneInspector({ job, shots, references, folderPath = "", scenesonClick={onClick}><ImageAdd16 aria-hidden="true" /></button>;+ const forcedSteps = generationStepsForTemplate(0, template, job.loraOverrides ?? []);return <section className="scene-inspector" aria-label="This scene"><div role="region" aria-label="Scene" className="scene-settings"><PropSection title="Scene" persistKey="generator.scene" summary={SCENE_TYPES.find((type) => type.value === sceneType)?.label ?? "Long Shot (legacy)"}>@@ -550,14 +552,14 @@ export function SceneInspector({ job, shots, references, folderPath = "", scenes</div><div role="region" aria-label="Generation" className="scene-settings"><PropSection title="Generation" persistKey="generator.generation" summary={`${effectiveSteps ?? sceneGenerationSteps(job, defaultSteps)} steps`}>- <PropRow label="Steps" htmlFor={`${id}-steps`}>+ <PropRow label="Steps" htmlFor={`${id}-steps`} tooltip={forcedSteps ? "Set by active LoRAs." : undefined}><SliderNumberInputid={`${id}-steps`}className="text-field"{...GENERATION_STEPS_RANGE}- value={sceneGenerationSteps(job, defaultSteps)}+ value={forcedSteps || sceneGenerationSteps(job, defaultSteps)}integer- disabled={disabled}+ disabled={disabled || !!forcedSteps}aria-label="Generation step count"onCommit={(value) => onChange({ steps: value })}/>@@ -588,6 +590,7 @@ export function SceneInspector({ job, shots, references, folderPath = "", scenes</PropRow><SceneSigmaShift stream="audio" job={job} template={template} disabled={disabled} onChange={onChange} /></>}+ {generatorModel(template?.modelType).loras && <SceneLoras key={job.id} template={template} value={job.loraOverrides} disabled={disabled} onChange={(loraOverrides) => onChange({ loraOverrides })} />}</PropSection></div><GenerationEffects key={job.id} value={job.generationEffects} supported={generatorModel(template?.modelType).generationEffects} disabled={disabled} onChange={(generationEffects) => onChange({ generationEffects })} />@@ -682,7 +685,7 @@ function SceneSigmaShift({ stream, job, template, disabled, onChange }: {}) {const id = useId();const key = stream === "video" ? "videoSigmaShift" : "audioSigmaShift";- const override = sigmaShiftOverridesForTemplate(template)[key];+ const override = sigmaShiftOverridesForTemplate(template, job.loraOverrides ?? [])[key];const fallback = stream === "audio" ? DEFAULT_AUDIO_SIGMA_SHIFT : template?.mode === "animate" ? 3 : DEFAULT_VIDEO_SIGMA_SHIFT;const label = `${stream === "video" ? "Video" : "Audio"} sigma shift`;return <PropRow label={label} htmlFor={id} tooltip={override !== undefined ? "Set by active LoRAs. Edit the override in LoRA settings." : "Controls the distribution of denoising timesteps."}>diff --git a/src/components/workspace/SceneLoras.test.tsx b/src/components/workspace/SceneLoras.test.tsxnew file mode 100644index 0000000..8b762f2--- /dev/null+++ b/src/components/workspace/SceneLoras.test.tsx@@ -0,0 +1,44 @@+// @vitest-environment jsdom+import "@testing-library/jest-dom/vitest";+import { useState } from "react";+import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, expect, it } from "vitest";+import { SceneLoras } from "./SceneLoras";+import { saveLoras, DMAD_LORA, PIKA_REF2VA_LORA, type TemplateLora } from "../../lib/loras";+import { createGeneratorTemplate } from "../../lib/settings";++afterEach(() => { cleanup(); localStorage.clear(); });+function Harness() {+ const [value, setValue] = useState<TemplateLora[]>();+ return <><SceneLoras template={{ ...createGeneratorTemplate(), loras: [{ loraId: "template", enabled: true, strength: 0.5 }] }} value={value} onChange={setValue} />+ <output data-testid="overrides">{JSON.stringify(value ?? [])}</output></>;+}+const saved = () => JSON.parse(screen.getByTestId("overrides").textContent!);++it("shows global LoRAs read only and adds, bypasses, edits and removes scene overrides", () => {+ saveLoras([{ id: "global", name: "Global", path: "D:/global", globallyEnabled: true, globalStrength: 0.8 },+ { id: "template", name: "Template", path: "D:/template" }, { id: "style", name: "Style", path: "D:/style" }]);+ render(<Harness />);+ expect(screen.getByRole("checkbox", { name: "Enable scene LoRA Global" })).toBeChecked();+ expect(screen.getByRole("checkbox", { name: "Enable scene LoRA Global" })).toBeDisabled();+ expect(screen.getByRole("spinbutton", { name: "Global scene strength" })).toBeDisabled();+ expect(screen.getByRole("spinbutton", { name: "Global scene strength" })).toHaveValue(0.8);+ expect(screen.getByText("Global · Read only")).toBeInTheDocument();+ fireEvent.click(screen.getByRole("checkbox", { name: "Enable scene LoRA Template" }));+ expect(saved()).toEqual([{ loraId: "template", enabled: false, strength: 0.5 }]);+ fireEvent.click(screen.getByRole("button", { name: "Remove Template override" }));+ expect(screen.getByRole("checkbox", { name: "Enable scene LoRA Template" })).toBeChecked();+ fireEvent.click(screen.getByRole("button", { name: "Add LoRA override" }));+ fireEvent.click(screen.getByRole("button", { name: "Style" }));+ fireEvent.change(screen.getByRole("spinbutton", { name: "Style scene strength" }), { target: { value: "0.6" } });+ expect(saved()).toEqual([{ loraId: "style", enabled: true, strength: 0.6 }]);+ fireEvent.click(screen.getByRole("button", { name: "Remove Style override" }));+ expect(saved()).toEqual([]);+});++it("disables adding recipes incompatible with global LoRAs", () => {+ saveLoras([{ ...DMAD_LORA, path: "D:/dmad", globallyEnabled: true }]);+ render(<Harness />);+ fireEvent.click(screen.getByRole("button", { name: "Add LoRA override" }));+ expect(screen.getByRole("button", { name: PIKA_REF2VA_LORA.name })).toBeDisabled();+});diff --git a/src/components/workspace/SceneLoras.tsx b/src/components/workspace/SceneLoras.tsxnew file mode 100644index 0000000..2b08f18--- /dev/null+++ b/src/components/workspace/SceneLoras.tsx@@ -0,0 +1,59 @@+import { useEffect, useRef, useState } from "react";+import { effectiveLoras, isLoraStrength, loadLoras, selectionConflict, subscribeLoras, type TemplateLora } from "../../lib/loras";+import type { GeneratorTemplate } from "../../lib/settings";+import { Checkbox, Flyout, InfoBar, PropRow } from "../ui";+import { Add16, Delete14 } from "../ui/icons";++export function SceneLoras({ template, value, disabled = false, onChange }: {+ template?: GeneratorTemplate; value?: TemplateLora[] | null; disabled?: boolean;+ onChange: (value: TemplateLora[] | undefined) => void;+}) {+ const [library, setLibrary] = useState(loadLoras);+ useEffect(() => subscribeLoras(() => setLibrary(loadLoras())), []);+ const [open, setOpen] = useState(false);+ const trigger = useRef<HTMLButtonElement>(null);+ const modelType = template?.modelType ?? "minimax-h3";+ const overrides = value ?? [];+ const effective = effectiveLoras(template?.loras, overrides, modelType, library);+ const conflict = selectionConflict(effective, library);+ const available = library.filter((lora) => (lora.modelType ?? "minimax-h3") === modelType && !effective.some((entry) => entry.loraId === lora.id));+ const update = (entry: TemplateLora) => onChange([...overrides.filter((item) => item.loraId !== entry.loraId), entry]);+ const conflictsWith = (entry: TemplateLora) => selectionConflict(effectiveLoras(template?.loras,+ [...overrides.filter((item) => item.loraId !== entry.loraId), entry], modelType, library), library);+ return <div className="clip-effects generation-effects scene-loras" role="group" aria-label="Scene LoRAs">+ {effective.map((entry) => {+ const lora = library.find((lora) => lora.id === entry.loraId);+ const name = lora?.name ?? "Missing LoRA";+ const global = modelType === "minimax-h3" && lora?.globallyEnabled === true && (lora.modelType ?? "minimax-h3") === modelType;+ const overridden = overrides.some((item) => item.loraId === entry.loraId);+ const locked = disabled || global;+ const enableConflict = conflictsWith({ ...entry, enabled: true });+ return <section key={entry.loraId} className={`clip-effect clip-effect--open${entry.enabled ? "" : " clip-effect--bypassed"}`} aria-label={`${name} LoRA`}>+ <div className="clip-effect__header">+ <Checkbox className="clip-effect__bypass" aria-label={`Enable scene LoRA ${name}`} checked={entry.enabled} disabled={locked || (!entry.enabled && !!enableConflict)} onChange={(enabled) => update({ ...entry, enabled })} />+ <h3 className="clip-effect__name">{name}</h3>+ {overridden && !global && <button type="button" className="clip-effect__action" aria-label={`Remove ${name} override`} disabled={disabled} onClick={() => {+ const next = overrides.filter((item) => item.loraId !== entry.loraId); onChange(next.length ? next : undefined);+ }}><Delete14 /></button>}+ </div>+ <div className="clip-effect__body">+ <p className="clip-effect__note">{global ? "Global · Read only" : overridden ? "Scene override" : "Generator template"}</p>+ <PropRow label="Strength"><input className="text-field" type="number" step="0.1" aria-label={`${name} scene strength`} disabled={locked || !entry.enabled} value={entry.strength}+ onChange={(event) => { const strength = Number(event.target.value); if (event.target.value && isLoraStrength(strength) && !conflictsWith({ ...entry, strength })) update({ ...entry, strength }); }} /></PropRow>+ {!lora?.path && <p className="clip-effect__note">Download or locate this LoRA in Settings.</p>}+ </div>+ </section>;+ })}+ <button ref={trigger} className="secondary-button clip-effects__add" type="button" disabled={disabled || !available.length} aria-haspopup="dialog" aria-expanded={open} onClick={() => setOpen(!open)}><Add16 />Add LoRA override</button>+ <Flyout open={open && !disabled} anchor={trigger} onClose={() => setOpen(false)} aria-label="Available scene LoRAs" role="group" placement="top" width={260}>+ <div className="clip-effects__picker">{available.map((lora) => {+ const entry = { loraId: lora.id, enabled: true, strength: 1 };+ const reason = conflictsWith(entry);+ return <button type="button" className="clip-effects__item" key={lora.id} disabled={!!reason} data-tooltip={reason ?? undefined} onClick={() => {+ update(entry); setOpen(false); trigger.current?.focus();+ }}>{lora.name}</button>;+ })}</div>+ </Flyout>+ {conflict && <InfoBar severity="error" message={conflict} />}+ </div>;+}diff --git a/src/styles/loras.css b/src/styles/loras.cssindex 9c974c3..6169f16 100644--- a/src/styles/loras.css+++ b/src/styles/loras.css@@ -10,6 +10,8 @@border: 0;}+.lora-drop-target { outline: 2px solid var(--accent); outline-offset: -2px; }+.lora-manual > label {display: grid;gap: var(--space-2);