feat: implement generation workflow with resource loading and candidate management
This commit is contained in:
23
operations/generation/options.test.ts
Normal file
23
operations/generation/options.test.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { initialToolState } from "@editor/tools";
|
||||
import { resolveGenerationModeOptions, resolveGenerationModelOptions } from "./options";
|
||||
|
||||
describe("generation compatibility options", () => {
|
||||
test("uses backend compatibility data for modes", () => {
|
||||
const settings = { ...initialToolState.generate, architecture: "anima" as const, mode: "inpaint" as const };
|
||||
const modes = [
|
||||
{ value: "text-to-image" as const, label: "Text" },
|
||||
{ value: "inpaint" as const, label: "Inpaint" },
|
||||
];
|
||||
const options = { architectures: [{ value: "anima" as const, label: "Anima", models: [], defaultModel: "auto", supportedModes: ["text-to-image" as const] }], models: [], samplers: [], schedulers: [], textEncoders: [], vaes: [] };
|
||||
|
||||
expect(resolveGenerationModeOptions(settings, options, modes).map((option) => option.value)).toEqual(["inpaint", "text-to-image"]);
|
||||
});
|
||||
|
||||
test("keeps the current model alongside discovered models", () => {
|
||||
const settings = { ...initialToolState.generate, model: "current.safetensors" };
|
||||
const options = { architectures: [], models: ["found.safetensors"], samplers: [], schedulers: [], textEncoders: [], vaes: [] };
|
||||
|
||||
expect(resolveGenerationModelOptions(settings, options).map((option) => option.value)).toEqual(["auto", "found.safetensors", "current.safetensors"]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user