feat: enhance generate settings to support multiple architectures and their defaults

This commit is contained in:
syntaxbullet
2026-07-05 11:21:56 +02:00
parent dd0c1df730
commit 0b6b064085
7 changed files with 435 additions and 52 deletions

View File

@@ -26,12 +26,18 @@ export type MagicWandMode = "replace" | "add" | "subtract";
export type GenerateMode = "text-to-image" | "image-to-image" | "inpaint" | "outpaint";
export const generateArchitectures = ["sdxl", "z-image", "z-image-turbo", "anima"] as const;
export type GenerateArchitecture = (typeof generateArchitectures)[number];
export type GenerateModel = string;
export type InpaintMaskedContent = "neutral" | "original" | "originalColor" | "edges";
export type GenerateSettings = {
architecture: GenerateArchitecture;
mode: GenerateMode;
model: GenerateModel;
textEncoder: string;
vae: string;
prompt: string;
negativePrompt: string;
strength: number;
@@ -62,6 +68,22 @@ export type GenerateSettings = {
};
};
export const generateArchitectureDefaults: Record<GenerateArchitecture, {
model: GenerateModel;
textEncoder: string;
vae: string;
steps: number;
cfg: number;
sampler: string;
scheduler: string;
supportedModes: readonly GenerateMode[];
}> = {
sdxl: { model: "auto", textEncoder: "auto", vae: "auto", steps: 30, cfg: 7, sampler: "euler", scheduler: "normal", supportedModes: ["text-to-image", "image-to-image", "inpaint", "outpaint"] },
"z-image": { model: "auto", textEncoder: "qwen_3_4b.safetensors", vae: "ae.safetensors", steps: 30, cfg: 4, sampler: "res_multistep", scheduler: "simple", supportedModes: ["text-to-image"] },
"z-image-turbo": { model: "auto", textEncoder: "qwen_3_4b.safetensors", vae: "ae.safetensors", steps: 8, cfg: 1, sampler: "res_multistep", scheduler: "simple", supportedModes: ["text-to-image"] },
anima: { model: "auto", textEncoder: "qwen_3_06b_base.safetensors", vae: "qwen_image_vae.safetensors", steps: 30, cfg: 4, sampler: "er_sde", scheduler: "simple", supportedModes: ["text-to-image"] },
};
export type MagicWandSettings = {
tolerance: number;
feather: number;
@@ -87,8 +109,11 @@ export const initialToolState: ToolState = {
chromaKey: { color: "#00ff00", tolerance: 32, softness: 24, feather: 0, choke: 0, despeckle: 0, spill: 50 },
magicWand: { tolerance: 32, feather: 0, choke: 0, despeckle: 0, contiguous: true, mode: "replace" },
generate: {
architecture: "sdxl",
mode: "text-to-image",
model: "auto",
textEncoder: "auto",
vae: "auto",
prompt: "",
negativePrompt: "",
strength: 75,