AI media harness for planning, generating, and editing locally
TypeScript
Show model availability when template LoRAs are missing
Bitti54a6a2809360
diff --git a/docs/generator-weights.md b/docs/generator-weights.mdindex 2b6fe8a..ae62740 100644--- a/docs/generator-weights.md+++ b/docs/generator-weights.md@@ -18,6 +18,8 @@ Downloading the generator also downloads any missing active LoRAs with downloadAlready downloaded adapters are reused; disabled and strength-zero adapters are skipped.The generator stays under **Download** until its model weights and active downloadableLoRAs are available. Progress, cancellation, and retry cover the entire download.+If only a LoRA remains, the generator row names it (for example, **Needs Turbo LoRA**).+The editor checks and marks individual model files as **Found** even while an adapter is missing.Enable any number, adjust their strengths, and move them up or down. Disabledadapters and strength-zero entries are omitted; the remaining paths and strengthsare passed to SlopFab in displayed order on both CUDA and Vulkan. SlopFab combinesdiff --git a/src/components/SettingsView.downloads.test.tsx b/src/components/SettingsView.downloads.test.tsxindex 5f2e453..e1868e2 100644--- a/src/components/SettingsView.downloads.test.tsx+++ b/src/components/SettingsView.downloads.test.tsx@@ -42,6 +42,7 @@ it("discovers Singularity's existing weights on opening Settings and downloads orender(<SettingsView onClose={() => undefined} />);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(screen.getByRole("button", { name: "Edit Singularity generator" })).toHaveTextContent("Needs Turbo LoRA");expect(invoke).not.toHaveBeenCalledWith("download_weight", expect.anything());fireEvent.click(screen.getByRole("button", { name: "Download generator Singularity" }));expect(await screen.findByRole("radio", { name: "Use Singularity as the default generator" })).toBeEnabled();@@ -50,6 +51,28 @@ it("discovers Singularity's existing weights on opening Settings and downloads o]);});+it("shows discovered model files as Found even when an active LoRA is missing", async () => {+ const normal = vi.mocked(invoke).getMockImplementation()!;+ const cached = Object.fromEntries(Object.values(minimaxSingularityTemplate().paths).filter(Boolean)+ .map((url) => [url, `D:/Projects/weights/${url.split('/').at(-1)}`]));+ vi.mocked(invoke).mockImplementation(async (command, args) => {+ if (command === "find_downloaded_weights") return Object.fromEntries((args as { urls: string[] }).urls.filter((url) => cached[url]).map((url) => [url, cached[url]]));+ if (command === "slopfab_status") {+ const options = (args as { settings: { slopfab: { options: Record<string, string> } } }).settings.slopfab.options;+ const models = ["transformer", "textEncoder", "videoVae", "audioVae"].map((id) => ({ id, path: options[id], configured: Boolean(options[id]), available: Object.values(cached).includes(options[id]) }));+ return { state: models.every(({ available }) => available) ? "ready" : "modelsMissing", dllPath: "slopfab.dll", version: "1.8.0", platform: "CUDA 13", detail: "Runtime loaded.", models };+ }+ return normal(command, args);+ });+ render(<SettingsView onClose={() => undefined} />);+ 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();+ expect(screen.queryByText("Engine ready")).not.toBeInTheDocument();+ expect(screen.getByText(/Download or locate LoRA Turbo/)).toBeInTheDocument();+ expect(screen.getByRole("button", { name: "Download weights" })).toBeEnabled();+});+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: "Edit Default generator" }));diff --git a/src/components/SettingsView.tsx b/src/components/SettingsView.tsxindex 3fb888b..e271a25 100644--- a/src/components/SettingsView.tsx+++ b/src/components/SettingsView.tsx@@ -4,6 +4,7 @@ import { revealDiagnosticLog } from "../lib/diagnostics";import { isTauri } from "../lib/persistence";import { WeightSourcesEditor } from "./WeightSourcesEditor";import { LoraEditor, LoraLibrary, TemplateLorasEditor } from "./LoraSettings";+import { downloadableTemplateLoras } from "../lib/loras";import { retryWeightDownload } from "../lib/weightDownloads";import { cancelWeightDownload, downloadTemplateWeights, getWeightDownloadState, refreshDownloadedWeights, removeTemplateWeights, subscribeWeightDownloads, updateWeightPath, weightDownloadProgress } from "../lib/weightDownloads";import { chooseEnginePath, getAgentModels, getEngineStatus, type ModelStatus, type SlopfabStatus } from "../lib/runtime";@@ -16,7 +17,7 @@ import {loadDebugOptionsEnabled, saveDebugOptionsEnabled, subscribeDebugOptions,loadInferenceBackend, saveInferenceBackend, type AttentionMode, type InferenceBackend,type AgentEndpointSettings, type EndpointProviderId, type EndpointProviderSettings,- type EnginePathField, type EnginePathId, type EngineSettings, type GeneratorTemplateSettings,+ type EnginePathField, type EnginePathId, type EngineSettings, type GeneratorTemplate, type GeneratorTemplateSettings,} from "../lib/settings";import { MAX_GENERATION_STEPS } from "../lib/project";import { loadReferenceIconAutomation, saveReferenceIconAutomation, subscribeReferenceIconAutomation } from "../lib/referenceIconSettings";@@ -47,6 +48,13 @@ const stateLabel: Record<PathState, string> = {download: "Download required",};+function templateSummary(template: GeneratorTemplate): string {+ const loras = downloadableTemplateLoras(template.loras);+ const pendingModels = ENGINE_PATH_FIELDS.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" : ""}` : ""}`;+}+/* The system option has to say what the computer is currently set to, or"Match this computer" is a promise the user cannot check. */const themeOptions: { id: ThemeChoice; label: string; icon: typeof Sun; detail: (system: ResolvedTheme) => string }[] = [@@ -274,6 +282,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onClconst selectedTemplate = templateSettings.templates.find((template) => template.id === editingTemplateId)?? defaultTemplate;const settings = selectedTemplate.paths;+ const 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)) },@@ -317,7 +326,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl});};- useEffect(() => { probe(settings); }, [probe, editingTemplateId, templateSettings.defaultTemplateId, downloadState?.completed]);+ useEffect(() => { probe(settings); }, [probe, editingTemplateId, templateSettings.defaultTemplateId, downloadState?.completed, downloadedPathsKey]);const updateSources = (id: EnginePathId, sources: WeightSource[]) => {const current = loadGeneratorTemplateSettings();@@ -516,7 +525,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine" }: { onCl</label>}<button type="button" className="generator-template-item__open" onClick={() => setEditingTemplateId(template.id)} aria-label={`Edit ${template.name} generator`}><Video size={16} aria-hidden="true" />- <b>{template.name}</b><small>{downloadState?.active && downloadState.templateId === template.id ? `Downloading · ${Math.floor(downloadPercent)}%` : `${template.defaultSteps} steps`}</small>+ <b>{template.name}</b><small>{downloadState?.active && downloadState.templateId === template.id ? `Downloading · ${Math.floor(downloadPercent)}%` : templateSummary(template)}</small></button>{templateNeedsDownload(template)? <button type="button" className="icon-button" disabled={!desktop || downloadState?.active} onClick={() => void downloadTemplateWeights(template.id)} aria-label={`Download generator ${template.name}`} title={`Download ${template.name} weights`}>diff --git a/src/lib/runtime.ts b/src/lib/runtime.tsindex 0a12db0..a8af201 100644--- a/src/lib/runtime.ts+++ b/src/lib/runtime.ts@@ -145,7 +145,18 @@ export const CHECKING_PROVIDERS: ProviderStatus[] = [* settings screen shows. */export async function getEngineStatus(settings = loadEngineSettings(), attention?: AttentionMode, loras?: TemplateLora[]): Promise<SlopfabStatus> {if (!isTauri()) return DEMO_STATUS.slopfab;- return invoke<SlopfabStatus>("slopfab_status", { settings: { slopfab: engineProviderSetting(settings, undefined, attention, loras) } });+ let slopfab;+ let adapterError: string | undefined;+ try {+ slopfab = engineProviderSetting(settings, undefined, attention, loras);+ } catch (reason) {+ // A missing adapter must not prevent checking the individual model files.+ adapterError = reason instanceof Error ? reason.message : String(reason);+ slopfab = engineProviderSetting(settings, undefined, attention, []);+ }+ const status = await invoke<SlopfabStatus>("slopfab_status", { settings: { slopfab } });+ return adapterError ? { ...status, state: status.state === "ready" ? "modelsMissing" : status.state,+ detail: `${status.detail} ${adapterError}` } : status;}/** Opens the OS picker for one engine path. Returns null when the user cancels. */