AI media harness for planning, generating, and editing locally
TypeScript
Add generator sampler and scheduler controls
Bittif6c400f2666e
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.mdindex b9aa281..b941166 100644--- a/RELEASE_NOTES.md+++ b/RELEASE_NOTES.md@@ -4,6 +4,8 @@ Changes since 0.3.2.## What's new+- **Sampler and scheduler controls.** Generator templates offer compatible sampling choices, including ER-SDE and Beta. Model default preserves existing recipes; choices are saved, shared in template exports and sent to workers.+- **Krea 2 images.** Added Turbo and Raw generators with CFG, negative prompts and image sigma shift controls. Turbo defaults to 8 steps; Raw uses 52 steps, CFG 3.5 and a resolution-dependent shift. Both generate new images without editing or image references, on updated CUDA and Vulkan runtimes.- **MiniMax Music3 precision.** Added FP16 transformer downloads for GPUs with at least 5 GB VRAM and FP32 for at least 10 GB, alongside the 3 GB INT8 variant.diff --git a/docs/generator-weights.md b/docs/generator-weights.mdindex 438d9d5..2518309 100644--- a/docs/generator-weights.md+++ b/docs/generator-weights.md@@ -13,6 +13,32 @@ the video default is used if eligible, otherwise the first available template.Icons use the selected template's steps, attention, MotionCache and LoRAs,including their step overrides.+## Sampler and scheduler++Open a generator template's **Sampling** section to choose its sampler and+scheduler. Both start at **Model default**, which preserves the current+checkpoint and adapter recipe. Existing templates keep their behavior.++| Generator | Samplers besides Model default | Schedulers besides Model default |+| --- | --- | --- |+| MiniMax H3 | Euler, AB2 (CUDA), Re-noising, ER-SDE | Beta |+| MOSS, Fibo 2, Krea 2 | Euler, ER-SDE | Beta |+| FastH3 Omni | Euler | None |+| Animate | Euler | Beta when no adapter fixes the schedule |+| YuE2, MiniMax Music3 | None | None |++Active DMAD and Pika recipes control both choices. These restrictions apply to template, global+and scene adapters; saved preferences return when the restriction is removed.+Selecting a sampler other than Euler turns off MotionCache. H3 image editing+requires Euler or Re-noising. Custom checkpoint metadata is also validated by+SlopFab before generation; Beta cannot replace a fixed grid supplied by metadata.+An adapter's step-count override alone does not prevent using Beta.++Selections persist in template settings, `.slop` exports and worker requests.+The optional payload fields are `sampler` (`default`, `euler`, `ab2`, `renoise`,+`er_sde`) and `scheduler` (`default`, `beta`). Omitted fields mean Model default.+Explicit choices require a compatible SlopFab runtime on the generation machine.+## Sharing generator templatesUse **Export** in Settings → Generator to select one or more templates and savediff --git a/src-tauri/assets/agent-system.md b/src-tauri/assets/agent-system.mdindex bdc2e1e..4b94c9f 100644--- a/src-tauri/assets/agent-system.md+++ b/src-tauri/assets/agent-system.md@@ -60,6 +60,7 @@ To create/edit generators return exactly one JSON object:- generator.add requires a new unique id and settings.name; defaults are minimax-h3, 20 steps, sage2, prompt mode and empty paths.- MiniMax H3 uses named shared Video/Audio VAE templates and one default Text Encoder. Setting an H3 videoVae or audioVae path creates or reuses a named VAE link. Setting its textEncoder or tokenizer updates the shared default used by all H3 generators. Other model families keep their own dependency paths.- generator.set requires an existing id and a settings patch; omitted fields and omitted path roles are preserved. Editable fields: name, modelType, defaultSteps (integer 2..2147483647), attention (exact/flash2/sage2/sol; sol requires CUDA), mode (prompt/animate), motionCache (boolean), paths (partial map of the five roles above), loras (replacement array of {loraId,enabled,strength}). Empty path strings clear a role; HTTP(S) URLs configure a future download but do not download it. Changed paths clear stale download alternatives for that role.+- Sampling fields: sampler (default/euler/ab2/renoise/er_sde) and scheduler (default/beta). Default preserves the existing model/adapter recipe. H3 supports all listed samplers (AB2 requires CUDA); MOSS, Fibo and Krea support Euler and ER-SDE. Music supports default only. Animate and FastH3 Omni require Euler; Omni retains its trained schedule. DMAD/Pika recipes control both choices. Beta cannot replace fixed grids in custom model/adapter metadata. Non-Euler sampling disables MotionCache; H3 image editing requires Euler or re-noising.- makeDefault:true is optional on generator.add/set; use it only if the user requests it and required local weights and selected LoRAs are ready. H3 prompt mode needs transformer, textEncoder, videoVae and audioVae; tokenizer is optional. Music/image families have their own required roles; inspect their template. H3 Animate omits textEncoder and tokenizer but also needs appropriate conditioning configured in Settings. Preserve additionalSafetensors and download variants when editing unrelated fields; these are visible through generator.get but cannot be edited with this command.- generator.lora.add registers an existing local adapter with a new unique id, name, path, and optional stepOverride (integer 2..2147483647). It is marked as needing preparation in LoRA settings; tell the user to prepare it there before generation. Registration does not run conversion, download files, or execute model code. Add it before selecting its id in a generator's loras array.Use at most 100 commands per batch. Generator edits and project edits cannot be mixed in a batch. These commands only change machine-local settings, not weights on disk, credentials, projects, or generated media. Describe unresolved requirements in the summary; never claim successful inference merely because settings were saved. If asked only for information, inspect then return an answer without edits.diff --git a/src-tauri/core/src/models.rs b/src-tauri/core/src/models.rsindex d31cb8f..b8ec3a5 100644--- a/src-tauri/core/src/models.rs+++ b/src-tauri/core/src/models.rs@@ -4,6 +4,8 @@#[derive(Debug, serde::Deserialize)]#[serde(rename_all = "camelCase")]pub struct GeneratorFeatures {+ pub samplers: Vec<String>,+ pub schedulers: Vec<String>,pub negative_prompt: bool,pub label: String,pub image_generation: bool,diff --git a/src-tauri/core/src/slopfab/config.rs b/src-tauri/core/src/slopfab/config.rsindex fbf64bb..2d2a8ec 100644--- a/src-tauri/core/src/slopfab/config.rs+++ b/src-tauri/core/src/slopfab/config.rs@@ -25,6 +25,7 @@ pub(super) struct SigmaShifts {#[derive(Clone)]pub(super) struct Configuration {+ pub(super) sampling: Result<SamplingChoices, String>,pub(super) model_type: String,pub(super) krea_raw: bool,pub(super) editing_model: bool,@@ -43,6 +44,12 @@ pub(super) struct Configuration {pub(super) sigma_shifts: Result<SigmaShifts, String>,}+#[derive(Clone, Debug, Default)]+pub(super) struct SamplingChoices {+ pub sampler: Option<String>,+ pub scheduler: Option<String>,+}+impl Configuration {pub(super) fn from_settings(settings: &BTreeMap<String, ProviderSetting>) -> Self {let slopfab = settings.get("slopfab");@@ -68,6 +75,15 @@ impl Configuration {}};Self {+ sampling: (|| {+ let read = |name: &str| match slopfab.and_then(|setting| setting.options.get(name)) {+ None => Ok(None),+ Some(ProviderOption::String(value)) if value == "default" => Ok(None),+ Some(ProviderOption::String(value)) => Ok(Some(value.clone())),+ _ => Err(format!("{name} must be a supported sampling option.")),+ };+ Ok(SamplingChoices { sampler: read("sampler")?, scheduler: read("scheduler")? })+ })(),editing_model: !matches!(slopfab.and_then(|setting| setting.options.get("editingModel")), Some(ProviderOption::Boolean(false))),model_type: string_option("modelType").unwrap_or("minimax-h3").to_owned(),krea_raw: string_option("kreaVariant") == Some("raw"),@@ -129,6 +145,26 @@ impl Configuration {}pub(super) fn validate_inputs(&self, request: &GenerationRequest) -> Result<(), String> {+ let sampling = self.sampling.as_ref().map_err(Clone::clone)?;+ let features = crate::models::generator_features(&self.model_type);+ for (label, value, allowed) in [("sampler", &sampling.sampler, &features.samplers), ("scheduler", &sampling.scheduler, &features.schedulers)] {+ if value.as_ref().is_some_and(|value| !allowed.contains(value)) {+ return Err(format!("{} does not support the selected {label}.", features.label));+ }+ }+ if self.sampling_preset.as_ref().map_err(Clone::clone)?.is_some() && (sampling.sampler.is_some() || sampling.scheduler.is_some()) {+ return Err("The active LoRA recipe controls the sampler and scheduler.".into());+ }+ if self.animate && sampling.sampler.as_deref().is_some_and(|sampler| sampler != "euler") {+ return Err("Animate requires Euler sampling.".into());+ }+ if self.model_type == "minimax-h3" && request.image_edit.is_some()+ && sampling.sampler.as_deref().is_some_and(|sampler| !["euler", "renoise"].contains(&sampler)) {+ return Err("MiniMax H3 image editing requires Euler or re-noising sampling.".into());+ }+ if self.motion_cache && sampling.sampler.as_deref().is_some_and(|sampler| sampler != "euler") {+ return Err("MotionCache requires Euler sampling.".into());+ }if request.latent_upscale_source.is_some() {if self.model_type != "minimax-h3" { return Err("Saved latent upscaling requires MiniMax H3.".into()); }for (label, path) in [("latent upscaler", self.latent_upscaler.as_ref()), ("video VAE", self.models[3].2.as_ref()), ("audio VAE", self.models[4].2.as_ref())] {diff --git a/src-tauri/core/src/slopfab/ffi/mod.rs b/src-tauri/core/src/slopfab/ffi/mod.rsindex 6bc5a90..fbe28e9 100644--- a/src-tauri/core/src/slopfab/ffi/mod.rs+++ b/src-tauri/core/src/slopfab/ffi/mod.rs@@ -217,9 +217,9 @@ impl Api {self.check(r)?;self.inner.set_seed(r.pointer.as_ptr(), v)}- pub fn set_sigma_shifts(&self, r: &RequestHandle, video: Option<f32>, audio: Option<f32>) -> Result<(), String> {+ pub fn set_sampling(&self, r: &RequestHandle, video: Option<f32>, audio: Option<f32>, sampler: Option<&str>, scheduler: Option<&str>) -> Result<(), String> {self.check(r)?;- self.inner.set_sigma_shifts(r.pointer.as_ptr(), video, audio)+ self.inner.set_sampling(r.pointer.as_ptr(), video, audio, sampler, scheduler)}pub fn set_dmad_sampling(&self, r: &RequestHandle) -> Result<(), String> {self.check(r)?;diff --git a/src-tauri/core/src/slopfab/ffi/raw/mod.rs b/src-tauri/core/src/slopfab/ffi/raw/mod.rsindex d6b60a4..8b27f7c 100644--- a/src-tauri/core/src/slopfab/ffi/raw/mod.rs+++ b/src-tauri/core/src/slopfab/ffi/raw/mod.rs@@ -437,12 +437,14 @@ impl Api {let settings = CString::new(r#"{"version":1,"sampler":"renoise","video_sigma_shift":12,"audio_sigma_shift":3,"base_sigmas":[1,0.75,0.5,0.25,0.1,0.04,0]}"#).unwrap();self.error(unsafe { set(r, settings.as_ptr()) })}- pub fn set_sigma_shifts(&self, r: *mut Request, video: Option<f32>, audio: Option<f32>) -> Result<(), String> {+ pub fn set_sampling(&self, r: *mut Request, video: Option<f32>, audio: Option<f32>, sampler: Option<&str>, scheduler: Option<&str>) -> Result<(), String> {let Some(set) = self.set_sampling_settings else {- return if video.is_none() && audio.is_none() { Ok(()) }- else { Err("Sigma shifts require slopfab.dll API 1.16 or later. Update the runtime.".into()) };+ return if video.is_none() && audio.is_none() && sampler.is_none() && scheduler.is_none() { Ok(()) }+ else { Err("Sampling settings require a newer SlopFab runtime. Update the machine running generation.".into()) };};let mut settings = serde_json::json!({ "version": 1 });+ if let Some(sampler) = sampler { settings["sampler"] = serde_json::json!(sampler); }+ if let Some(scheduler) = scheduler { settings["scheduler"] = serde_json::json!(scheduler); }for (key, value) in [("video_sigma_shift", video), ("audio_sigma_shift", audio)] {if let Some(value) = value {if !value.is_finite() || value <= 0.0 { return Err("Sigma shifts must be finite and positive.".into()); }diff --git a/src-tauri/core/src/slopfab/h3.rs b/src-tauri/core/src/slopfab/h3.rsindex f724524..00cb897 100644--- a/src-tauri/core/src/slopfab/h3.rs+++ b/src-tauri/core/src/slopfab/h3.rs@@ -17,8 +17,11 @@ pub(super) fn configure_request(purpose: RequestPurpose,references: &ReferenceVideos,) -> Result<(), String> {- if request.music.is_some() { return super::music::configure(api, handle, request, configuration, platform); }configuration.validate_inputs(request)?;+ if platform == ComputePlatform::Vulkan && configuration.sampling.as_ref().map_err(Clone::clone)?.sampler.as_deref() == Some("ab2") {+ return Err("AB2 sampling requires CUDA. Select a CUDA GPU or worker, or choose another sampler in Settings.".into());+ }+ if request.music.is_some() { return super::music::configure(api, handle, request, configuration, platform); }if request.single_shot.is_some() && request.keystone_path.is_none() { api.require_end_anchor()?; }let source_noise = super::continuation::source_noise(request);if source_noise.is_some() { api.require_continuation_source_init()?; }@@ -87,8 +90,9 @@ pub(super) fn configure_request(let tokens = f64::from(width / 16) * f64::from(height / 16);(0.5 + (tokens - 256.0) * 0.65 / (6400.0 - 256.0)).exp() as f32});- api.set_sigma_shifts(handle, shifts.video_override.or(request.video_sigma_shift).or(shifts.video).or(krea_raw_shift),- shifts.audio_override.or(request.audio_sigma_shift).or(shifts.audio))?;+ let sampling = configuration.sampling.as_ref().map_err(Clone::clone)?;+ api.set_sampling(handle, shifts.video_override.or(request.video_sigma_shift).or(shifts.video).or(krea_raw_shift),+ shifts.audio_override.or(request.audio_sigma_shift).or(shifts.audio), sampling.sampler.as_deref(), sampling.scheduler.as_deref())?;}// Sampling presets replace overrides, so apply the audio setting afterward.api.set_audio_steps(handle, request.audio_steps.unwrap_or(0))?;diff --git a/src-tauri/core/src/slopfab/icons.rs b/src-tauri/core/src/slopfab/icons.rsindex b163352..e29f83e 100644--- a/src-tauri/core/src/slopfab/icons.rs+++ b/src-tauri/core/src/slopfab/icons.rs@@ -111,6 +111,7 @@ pub fn generate_reference_icon_batch(let configuration = Configuration {model_type: "minimax-h3".into(),krea_raw: false,+ sampling: Ok(Default::default()),editing_model: true,dll_path: batch.dll_path.clone(),loras: Ok(Vec::new()),diff --git a/src-tauri/core/src/slopfab/tests.rs b/src-tauri/core/src/slopfab/tests.rsindex a56b663..b153e64 100644--- a/src-tauri/core/src/slopfab/tests.rs+++ b/src-tauri/core/src/slopfab/tests.rs@@ -30,6 +30,66 @@ fn music_plans_on_cuda_and_vulkan_without_video_controls() {}}+#[test]+fn sampler_and_scheduler_options_reach_planning_and_generation_and_reset() {+ let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../lib/slopfab").join(super::DLL_FILE_NAME);+ let api = ffi::Api::load(&path).unwrap();+ for family in ["minimax-h3", "moss", "fibo2", "krea2"] {+ let mut configuration = Configuration::from_settings(&BTreeMap::new());+ configuration.model_type = family.into();+ configuration.attention = "flash2";+ let request = GenerationRequest { prompt: "An apple".into(), still_image: family != "minimax-h3",+ frames: if family == "minimax-h3" { 22 } else { 1 }, steps: 8, seed: 42,+ canvas_width: 512, canvas_height: 512, video_sigma_shift: if family == "fibo2" { None } else { Some(4.0) }, ..Default::default() };+ for sampler in &crate::models::generator_features(family).samplers {+ for scheduler in [None, Some("beta")] {+ for purpose in [RequestPurpose::Plan, RequestPurpose::Generate] {+ for platform in [ComputePlatform::Cuda13, ComputePlatform::Vulkan] {+ if platform == ComputePlatform::Vulkan && crate::models::generator_features(family).cuda_only { continue; }+ configuration.sampling = Ok(SamplingChoices { sampler: Some(sampler.clone()), scheduler: scheduler.map(str::to_owned) });+ let handle = RequestHandle::new(&api).unwrap();+ if platform == ComputePlatform::Vulkan && sampler == "ab2" {+ assert!(configure_request(&api, &handle, &request, &configuration, platform, purpose, &ReferenceVideos::default()).unwrap_err().contains("AB2 sampling requires CUDA"));+ continue;+ }+ configure_request(&api, &handle, &request, &configuration, platform, purpose, &ReferenceVideos::default()).unwrap();+ let description = api.describe(&handle).unwrap();+ assert!(description.contains(if sampler == "euler" && family != "minimax-h3" { "Euler" } else { sampler }), "{description}");+ if family != "minimax-h3" { assert!(description.contains(if scheduler.is_some() { "schedule beta" } else { "schedule default" }), "{description}"); }+ configuration.sampling = Ok(Default::default());+ configure_request(&api, &handle, &request, &configuration, platform, purpose, &ReferenceVideos::default()).unwrap();+ let reset = api.describe(&handle).unwrap();+ assert!(!reset.contains("er_sde"));+ assert!(!reset.contains("schedule beta"));+ if family == "minimax-h3" && scheduler.is_some() {+ assert_ne!(description.lines().find(|line| line.contains("sigma range")), reset.lines().find(|line| line.contains("sigma range")));+ }+ }+ }+ }+ }+ }+}++#[test]+fn unsupported_sampling_choices_are_rejected_before_generation() {+ for (family, sampler, scheduler) in [("moss", "ab2", "default"), ("fibo2", "renoise", "default"),+ ("krea2", "euler", "unknown"), ("yue2", "er_sde", "default"), ("minimax_music3", "default", "beta")] {+ let settings = BTreeMap::from([("slopfab".into(), ProviderSetting { enabled: true, model: None,+ options: BTreeMap::from([("modelType".into(), ProviderOption::String(family.into())),+ ("sampler".into(), ProviderOption::String(sampler.into())), ("scheduler".into(), ProviderOption::String(scheduler.into()))]) })]);+ let configuration = Configuration::from_settings(&settings);+ assert!(configuration.validate_inputs(&GenerationRequest::default()).unwrap_err().contains("does not support"));+ }+ let mut configuration = Configuration::from_settings(&BTreeMap::new());+ configuration.animate = true;+ configuration.sampling = Ok(SamplingChoices { sampler: Some("er_sde".into()), scheduler: None });+ assert!(configuration.validate_inputs(&GenerationRequest::default()).unwrap_err().contains("Animate requires Euler"));+ configuration.animate = false;+ configuration.sampling_preset = Ok(Some(SamplingPreset::Pika6Step));+ assert!(configuration.validate_inputs(&GenerationRequest::default()).unwrap_err().contains("LoRA recipe"));+}+#[test]fn krea_plans_turbo_and_raw_on_cuda_and_vulkan() {let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../lib/slopfab").join(super::DLL_FILE_NAME);diff --git a/src-tauri/src/agent/generators.rs b/src-tauri/src/agent/generators.rsindex 8bad3ff..45516e4 100644--- a/src-tauri/src/agent/generators.rs+++ b/src-tauri/src/agent/generators.rs@@ -46,6 +46,8 @@ pub struct GeneratorPatch {pub model_type: Option<String>,pub editing_model: Option<bool>,pub krea_variant: Option<String>,+ pub sampler: Option<String>,+ pub scheduler: Option<String>,pub default_steps: Option<u32>,pub attention: Option<String>,pub mode: Option<String>,@@ -276,6 +278,8 @@ pub(crate) fn prepare(if add || template["modelType"] != model.as_str() {template["editingModel"] = json!(slopus_core::models::generator_features(model).image_editing);template.as_object_mut().unwrap().remove("kreaVariant");+ template.as_object_mut().unwrap().remove("sampler");+ template.as_object_mut().unwrap().remove("scheduler");}template["modelType"] = json!(model);}@@ -295,6 +299,13 @@ pub(crate) fn prepare(}template["defaultSteps"] = json!(steps);}+ let features = slopus_core::models::generator_features(template["modelType"].as_str().unwrap_or("minimax-h3"));+ for (key, value, allowed) in [("sampler", &patch.sampler, &features.samplers), ("scheduler", &patch.scheduler, &features.schedulers)] {+ if let Some(value) = value {+ if value != "default" && !allowed.contains(value) { return Err(format!("Unsupported {key} for {}.", features.label)); }+ template[key] = json!(value);+ }+ }if let Some(attention) = &patch.attention {if !["exact", "flash2", "sage2", "sol"].contains(&attention.as_str()) {return Err("attention must be exact, flash2, sage2 or sol.".into());diff --git a/src-tauri/src/agent/tests_generators.rs b/src-tauri/src/agent/tests_generators.rsindex 2924ce7..54b36e8 100644--- a/src-tauri/src/agent/tests_generators.rs+++ b/src-tauri/src/agent/tests_generators.rs@@ -153,6 +153,25 @@ fn command_batches_preserve_other_settings_and_are_atomic() {.is_err());}+#[test]+fn generator_sampling_choices_validate_and_reset_on_model_change() {+ let add = command(json!({"op":"generator.add","id":"sampler","settings":{+ "name":"Sampling", "modelType":"krea2", "sampler":"er_sde", "scheduler":"beta"+ }}));+ let context = prepare(&GeneratorContext::default(), &[add]).unwrap();+ assert_eq!(context.settings["templates"][0]["sampler"], "er_sde");+ assert_eq!(context.settings["templates"][0]["scheduler"], "beta");+ let invalid = command(json!({"op":"generator.set","id":"sampler","settings":{"sampler":"ab2"}}));+ assert!(prepare(&context, &[invalid]).unwrap_err().contains("Unsupported sampler"));+ let reset = command(json!({"op":"generator.set","id":"sampler","settings":{"sampler":"default","scheduler":"default"}}));+ let reset = prepare(&context, &[reset]).unwrap();+ assert_eq!(reset.settings["templates"][0]["sampler"], "default");+ let change = command(json!({"op":"generator.set","id":"sampler","settings":{"modelType":"moss"}}));+ let changed = prepare(&context, &[change]).unwrap();+ assert!(changed.settings["templates"][0].get("sampler").is_none());+ assert!(changed.settings["templates"][0].get("scheduler").is_none());+}+#[test]fn validates_roles_paths_ranges_and_lora_registration() {let dir = tempfile::tempdir().unwrap();diff --git a/src/components/SettingsView.test.tsx b/src/components/SettingsView.test.tsxindex a877f6c..5959901 100644--- a/src/components/SettingsView.test.tsx+++ b/src/components/SettingsView.test.tsx@@ -202,6 +202,24 @@ describe("the settings screen", () => {fireEvent.click(screen.getByRole("option", { name: "Turbo" }));expect((screen.getByRole("spinbutton", { name: "Generator default steps" }) as HTMLInputElement).value).toBe("8");});+ it("persists supported sampling choices and resets them when the model changes", () => {+ const view = open("MOSS");+ fireEvent.click(screen.getByRole("button", { name: "Edit MOSS Image generator" }));+ expect(combo("Generator sampler").getAttribute("data-value")).toBe("default");+ expect(optionsOf("Generator sampler")).toEqual(["Model default", "Euler", "ER-SDE"]);+ expect(optionsOf("Generator scheduler")).toEqual(["Model default", "Beta"]);+ pick("Generator sampler", "ER-SDE");+ pick("Generator scheduler", "Beta");+ expect(loadGeneratorTemplateSettings().templates.find(({ id }) => id === "moss-image")).toMatchObject({ sampler: "er_sde", scheduler: "beta" });+ view.unmount();+ open("MOSS");+ fireEvent.click(screen.getByRole("button", { name: "Edit MOSS Image generator" }));+ expect(combo("Generator sampler").getAttribute("data-value")).toBe("er_sde");+ fireEvent.click(combo("Generator model"));+ fireEvent.click(screen.getByRole("option", { name: /^MiniMax Music3/ }));+ expect(combo("Generator sampler").getAttribute("data-value")).toBe("default");+ expect(combo("Generator scheduler").getAttribute("data-value")).toBe("default");+ });it("remembers MotionCache per generator and disables it in Animate mode", () => {const view = open();editDefaultGenerator();diff --git a/src/components/SettingsView.tsx b/src/components/SettingsView.tsxindex 275d231..0edcb34 100644--- a/src/components/SettingsView.tsx+++ b/src/components/SettingsView.tsx@@ -1,5 +1,5 @@import { generatorOptions } from "./generatorOptions";-import { DEFAULT_VIDEO_SIGMA_SHIFT, DEFAULT_AUDIO_SIGMA_SHIFT, MIN_SIGMA_SHIFT, MAX_SIGMA_SHIFT, isSigmaShift } from "../lib/sampling";+import { DEFAULT_VIDEO_SIGMA_SHIFT, DEFAULT_AUDIO_SIGMA_SHIFT, MIN_SIGMA_SHIFT, MAX_SIGMA_SHIFT, isSigmaShift, SAMPLER_LABELS, SCHEDULER_LABELS, type Sampler, type Scheduler } from "../lib/sampling";import { AdditionalSafetensorsEditor } from "./AdditionalSafetensorsEditor";import { GeneratorSharing } from "./GeneratorSharing";import { OtherWeightsSettings } from "./OtherWeightsSettings";@@ -23,12 +23,12 @@ import { WeightSourcesEditor } from "./WeightSourcesEditor";import { LoraEditor, LoraLibrary, TemplateLorasEditor } from "./LoraSettings";import { OpenableCard } from "./OpenableCard";import { TitleBar } from "./TitleBar";-import { effectiveLoras, downloadableTemplateLoras, loadLoras } from "../lib/loras";+import { effectiveLoras, downloadableTemplateLoras, loadLoras, subscribeLoras } 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";import {- EMPTY_ENGINE_SETTINGS, generatorPathFields, generatorModel, GENERATOR_MODELS, MOSS_MODEL_TYPE, FIBO_MODEL_TYPE, KREA_MODEL_TYPE,+ EMPTY_ENGINE_SETTINGS, templateSamplingOptions, effectiveTemplateSampling, generatorPathFields, generatorModel, GENERATOR_MODELS, MOSS_MODEL_TYPE, FIBO_MODEL_TYPE, KREA_MODEL_TYPE,createGeneratorTemplate, defaultGeneratorTemplate,isEndpointProviderConfigured, loadAgentEndpointSettings,loadGeneratorTemplateSettings, saveAgentEndpointSettings, saveGeneratorTemplateSettings,@@ -348,6 +348,11 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBarconst defaultTemplate = defaultGeneratorTemplate(templateSettings);const editingTemplate = templateSettings.templates.find((template) => template.id === editingTemplateId);const selectedTemplate = editingTemplate ?? defaultTemplate;+ const [, refreshSampling] = useState(0);+ useEffect(() => subscribeLoras(() => refreshSampling((revision) => revision + 1)), []);+ const samplingOptions = templateSamplingOptions(selectedTemplate);+ const sampling = effectiveTemplateSampling(selectedTemplate);+ const nonEuler = sampling.sampler !== "default" && sampling.sampler !== "euler";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;@@ -456,7 +461,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBarprobe({ ...EMPTY_ENGINE_SETTINGS });};- const updateTemplate = (updates: Partial<Pick<typeof selectedTemplate, "kreaVariant" | "videoVaeId" | "audioVaeId" | "editingModel" | "modelType" | "name" | "defaultSteps" | "videoSigmaShift" | "audioSigmaShift" | "attention" | "motionCache" | "loras" | "mode" | "additionalSafetensors">>) => {+ const updateTemplate = (updates: Partial<Pick<typeof selectedTemplate, "sampler" | "scheduler" | "kreaVariant" | "videoVaeId" | "audioVaeId" | "editingModel" | "modelType" | "name" | "defaultSteps" | "videoSigmaShift" | "audioSigmaShift" | "attention" | "motionCache" | "loras" | "mode" | "additionalSafetensors">>) => {setTemplateSettings((current) => {const next = {...current,@@ -586,7 +591,7 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar<ComboBox aria-label="Generator model" value={selectedTemplate.modelType} options={[...GENERATOR_MODELS,...(!GENERATOR_MODELS.some(({ value }) => value === selectedTemplate.modelType) ? [{ value: selectedTemplate.modelType, label: selectedTemplate.modelType }] : []),- ]} onChange={(modelType) => updateTemplate({ modelType, editingModel: generatorModel(modelType).imageEditing, kreaVariant: undefined, ...(modelType === MOSS_MODEL_TYPE || modelType === FIBO_MODEL_TYPE || modelType === KREA_MODEL_TYPE || generatorModel(modelType).musicGeneration ? { mode: "prompt", attention: "flash2", defaultSteps: modelType === KREA_MODEL_TYPE ? 8 : modelType === "yue2" ? 32 : modelType === "minimax_music3" ? 30 : modelType === FIBO_MODEL_TYPE ? 4 : 50, motionCache: false, loras: [], audioSigmaShift: undefined, ...(modelType === FIBO_MODEL_TYPE || generatorModel(modelType).musicGeneration ? { videoSigmaShift: undefined } : {}) } : {}) })} />+ ]} onChange={(modelType) => updateTemplate({ modelType, editingModel: generatorModel(modelType).imageEditing, kreaVariant: undefined, sampler: undefined, scheduler: undefined, ...(modelType === MOSS_MODEL_TYPE || modelType === FIBO_MODEL_TYPE || modelType === KREA_MODEL_TYPE || generatorModel(modelType).musicGeneration ? { mode: "prompt", attention: "flash2", defaultSteps: modelType === KREA_MODEL_TYPE ? 8 : modelType === "yue2" ? 32 : modelType === "minimax_music3" ? 30 : modelType === FIBO_MODEL_TYPE ? 4 : 50, motionCache: false, loras: [], audioSigmaShift: undefined, ...(modelType === FIBO_MODEL_TYPE || generatorModel(modelType).musicGeneration ? { videoSigmaShift: undefined } : {}) } : {}) })} /></SettingsCard>{selectedTemplate.modelType === KREA_MODEL_TYPE && <SettingsCard icon={<Steps20 />} header="Sampling defaults" description="Match the recipe to your transformer weights. Raw uses CFG 3.5 and a resolution-dependent sigma shift; Turbo uses CFG 0."><ComboBox aria-label="Krea sampling defaults" value={selectedTemplate.kreaVariant ?? "turbo"}@@ -610,7 +615,17 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar</SettingsCard></SettingsGroup>- {generatorModel(selectedTemplate.modelType).sigmaShifts && <SettingsGroup heading="Sampling">+ <SettingsGroup heading="Sampling">+ <SettingsCard icon={<Steps20 />} header="Sampler" description={samplingOptions.reason ?? "Model default preserves the checkpoint and adapter recipe."}>+ <ComboBox aria-label="Generator sampler" value={sampling.sampler} disabled={samplingOptions.samplers.length === 1}+ options={samplingOptions.samplers.map((value) => ({ value, label: SAMPLER_LABELS[value] }))}+ onChange={(value) => updateTemplate({ sampler: value as Sampler, ...(value !== "default" && value !== "euler" ? { motionCache: false } : {}) })} />+ </SettingsCard>+ <SettingsCard icon={<Steps20 />} header="Scheduler" description="Model default preserves the trained schedule. Beta redistributes the sampling steps.">+ <ComboBox aria-label="Generator scheduler" value={sampling.scheduler} disabled={samplingOptions.schedulers.length === 1}+ options={samplingOptions.schedulers.map((value) => ({ value, label: SCHEDULER_LABELS[value] }))}+ onChange={(value) => updateTemplate({ scheduler: value as Scheduler })} />+ </SettingsCard>{(["videoSigmaShift", "audioSigmaShift"] as const).filter((key) => generatorModel(selectedTemplate.modelType).sigmaShifts && (generatorModel(selectedTemplate.modelType).videoGeneration || key !== "audioSigmaShift")).map((key) => {const label = `${key === "videoSigmaShift" ? !generatorModel(selectedTemplate.modelType).videoGeneration ? "Image" : "Video" : "Audio"} sigma shift`;const fallback = selectedTemplate.modelType === KREA_MODEL_TYPE ? Math.exp(1.15) : selectedTemplate.modelType === MOSS_MODEL_TYPE ? 5 : key === "audioSigmaShift" ? DEFAULT_AUDIO_SIGMA_SHIFT : selectedTemplate.mode === "animate" ? 3 : DEFAULT_VIDEO_SIGMA_SHIFT;@@ -622,16 +637,16 @@ export function SettingsView({ onClose, updates, initialTab = "engine", titleBar}} /></SettingsCard>;})}- </SettingsGroup>}+ </SettingsGroup><SettingsGroup heading="Performance"><SettingsCard icon={<Gauge20 />} header="Attention" description={selectedTemplate.attention === "sol" ? "Sol attention requires a CUDA GPU on the machine running generation." : undefined}><ComboBox aria-label="Generator attention" value={selectedTemplate.attention} onChange={(value) => updateTemplate({ attention: value as AttentionMode })}options={selectedTemplate.modelType === KREA_MODEL_TYPE || generatorModel(selectedTemplate.modelType).cudaOnly || generatorModel(selectedTemplate.modelType).musicGeneration ? [{ value: "flash2", label: "Flash attention" }] : [{ value: "exact", label: "Exact attention" }, { value: "flash2", label: "Flash attention" }, { value: "sage2", label: "Sage attention" }, { value: "sol", label: "Sol attention" }]} /></SettingsCard>- {generatorModel(selectedTemplate.modelType).motionCache && <SettingsCard icon={<Flash20 />} header="Enable MotionCache" description={<span id="motion-cache-help">{selectedTemplate.mode === "animate" ? "Unavailable in Animate mode" : "Reuses similar denoising results to reduce computation. May affect detail and motion."}</span>}>+ {generatorModel(selectedTemplate.modelType).motionCache && <SettingsCard icon={<Flash20 />} header="Enable MotionCache" description={<span id="motion-cache-help">{selectedTemplate.mode === "animate" ? "Unavailable in Animate mode" : nonEuler ? "Requires Euler sampling" : "Reuses similar denoising results to reduce computation. May affect detail and motion."}</span>}><ToggleSwitch aria-label="Enable MotionCache" aria-describedby="motion-cache-help"- checked={selectedTemplate.mode !== "animate" && Boolean(selectedTemplate.motionCache)} disabled={selectedTemplate.mode === "animate"}+ checked={!nonEuler && selectedTemplate.mode !== "animate" && Boolean(selectedTemplate.motionCache)} disabled={nonEuler || selectedTemplate.mode === "animate"}onChange={(on) => updateTemplate({ motionCache: on })} /></SettingsCard>}</SettingsGroup>diff --git a/src/lib/generatorModels.json b/src/lib/generatorModels.jsonindex 0e197ca..bf23c1f 100644--- a/src/lib/generatorModels.json+++ b/src/lib/generatorModels.json@@ -21,7 +21,16 @@"imageCompositionCreation": false,"negativePrompt": false,"negativePromptDisabledReason": null,- "musicGeneration": false+ "musicGeneration": false,+ "samplers": [+ "euler",+ "ab2",+ "renoise",+ "er_sde"+ ],+ "schedulers": [+ "beta"+ ]},"moss": {"label": "MOSS Image",@@ -47,7 +56,14 @@"imageCompositionCreation": true,"negativePrompt": true,"negativePromptDisabledReason": null,- "musicGeneration": false+ "musicGeneration": false,+ "samplers": [+ "euler",+ "er_sde"+ ],+ "schedulers": [+ "beta"+ ]},"fibo2": {"label": "Fibo 2.0",@@ -71,7 +87,14 @@"imageCompositionCreation": true,"negativePrompt": false,"negativePromptDisabledReason": "Fibo 2.0 Turbo uses only the positive prompt. Slopfab does not support negative prompts for this model.",- "musicGeneration": false+ "musicGeneration": false,+ "samplers": [+ "euler",+ "er_sde"+ ],+ "schedulers": [+ "beta"+ ]},"yue2": {"label": "YuE2",@@ -95,7 +118,9 @@"imageCompositionCreation": false,"negativePrompt": false,"negativePromptDisabledReason": null,- "musicGeneration": true+ "musicGeneration": true,+ "samplers": [],+ "schedulers": []},"minimax_music3": {"label": "MiniMax Music3",@@ -119,7 +144,9 @@"imageCompositionCreation": false,"negativePrompt": false,"negativePromptDisabledReason": null,- "musicGeneration": true+ "musicGeneration": true,+ "samplers": [],+ "schedulers": []},"krea2": {"label": "Krea 2",@@ -145,6 +172,13 @@"imageCompositionCreation": true,"negativePrompt": true,"negativePromptDisabledReason": null,- "musicGeneration": false+ "musicGeneration": false,+ "samplers": [+ "euler",+ "er_sde"+ ],+ "schedulers": [+ "beta"+ ]}}diff --git a/src/lib/sampling.ts b/src/lib/sampling.tsindex 55bf61e..3873d33 100644--- a/src/lib/sampling.ts+++ b/src/lib/sampling.ts@@ -6,6 +6,16 @@ export const DEFAULT_AUDIO_SIGMA_SHIFT = 3;export interface SigmaShifts { videoSigmaShift?: number; audioSigmaShift?: number }+export const SAMPLERS = ["default", "euler", "ab2", "renoise", "er_sde"] as const;+export const SCHEDULERS = ["default", "beta"] as const;+export type Sampler = typeof SAMPLERS[number];+export type Scheduler = typeof SCHEDULERS[number];+export interface SamplingChoices { sampler?: Sampler; scheduler?: Scheduler }+export const SAMPLER_LABELS: Record<Sampler, string> = { default: "Model default", euler: "Euler", ab2: "AB2 (CUDA)", renoise: "Re-noising", er_sde: "ER-SDE" };+export const SCHEDULER_LABELS: Record<Scheduler, string> = { default: "Model default", beta: "Beta" };+export const isSampler = (value: unknown): value is Sampler => SAMPLERS.includes(value as Sampler);+export const isScheduler = (value: unknown): value is Scheduler => SCHEDULERS.includes(value as Scheduler);+export function isSigmaShift(value: unknown): value is number {return typeof value === "number" && Number.isFinite(value) && value >= MIN_SIGMA_SHIFT && value <= MAX_SIGMA_SHIFT;}diff --git a/src/lib/settings.ts b/src/lib/settings.tsindex 03d2ee8..d616b77 100644--- a/src/lib/settings.ts+++ b/src/lib/settings.ts@@ -12,7 +12,7 @@* in src-tauri/core/src/slopfab/config.rs. Renaming one here without renaming it there* silently drops that path.*/-import { isSigmaShift, type SigmaShifts } from "./sampling";+import { isSigmaShift, isSampler, isScheduler, type SigmaShifts, type SamplingChoices, type Sampler, type Scheduler } from "./sampling";import { initialH3Components, normalizeH3Library, resolveH3Components, type H3Components } from "./h3Components";import { generatorModel } from "./generatorModels";export { generatorModel, GENERATOR_MODELS } from "./generatorModels";@@ -87,7 +87,7 @@ export const templateSupportsEditing = (template: Pick<GeneratorTemplate, "modelexport const templateSupportsOutpainting = (template: Pick<GeneratorTemplate, "modelType" | "editingModel" | "mode">): boolean =>templateSupportsEditing(template) && generatorModel(template.modelType).imageOutpainting;-export interface GeneratorTemplate extends SigmaShifts {+export interface GeneratorTemplate extends SigmaShifts, SamplingChoices {id: string;name: string;/** Stable model-family identifier, independent of template name and mode.@@ -125,6 +125,30 @@ export interface WeightSource {downloadedPath?: string;}+export function templateSamplingOptions(template: Partial<GeneratorTemplate>, overrides: TemplateLora[] = []) {+ const model = generatorModel(template.modelType);+ const library = loadLoras();+ const active = new Set(effectiveLoras(template.loras, overrides, template.modelType, library)+ .filter((entry) => entry.enabled && entry.strength !== 0).map((entry) => entry.loraId));+ const adapters = library.filter((entry) => active.has(entry.id));+ const preset = adapters.some((entry) => entry.samplingPreset);+ const omni = template.modelType === MINIMAX_H3_MODEL_TYPE && [template.paths?.transformer ?? "", ...(template.sources?.transformer ?? []).map((source) => source.url)]+ .some((path) => path.includes("fasth3_omniref_8step_pruned_int8_convrot.safetensors"));+ const samplers: Sampler[] = ["default", ...(preset ? [] : omni || template.mode === "animate" ? ["euler"] : model.samplers) as Sampler[]];+ const schedulers: Scheduler[] = ["default", ...(!omni && !preset ? model.schedulers : []) as Scheduler[]];+ const reason = preset ? "The active LoRA recipe controls the sampler and scheduler."+ : omni ? "FastH3 Omni requires Euler and its trained schedule."+ : template.mode === "animate" ? "Animate requires Euler. Adapters may also require a fixed schedule."+ : model.musicGeneration ? "This music model uses its built-in solver and schedule." : undefined;+ return { samplers, schedulers, reason };+}++export function effectiveTemplateSampling(template: Partial<GeneratorTemplate>, overrides: TemplateLora[] = []): Required<SamplingChoices> {+ const allowed = templateSamplingOptions(template, overrides);+ return { sampler: template.sampler && allowed.samplers.includes(template.sampler) ? template.sampler : "default",+ scheduler: template.scheduler && allowed.schedulers.includes(template.scheduler) ? template.scheduler : "default" };+}+export function generatorPathFields(template: Pick<GeneratorTemplate, "mode"> & { modelType?: string }): EnginePathField[] {if (template.modelType === "yue2" || template.modelType === "minimax_music3") return ENGINE_PATH_FIELDS.filter(({ id }) =>id === "transformer" || template.modelType === "minimax_music3" && (id === "textEncoder" || id === "audioVae")).map((field) =>@@ -460,6 +484,8 @@ const normalizeTemplateSettings = (value: unknown, shareComponents = true): Gene...(typeof candidate.audioVaeId === "string" ? { audioVaeId: candidate.audioVaeId } : {}),...(typeof candidate.editingModel === "boolean" ? { editingModel: candidate.editingModel } : {}),...(candidate.kreaVariant === "raw" || candidate.kreaVariant === "turbo" ? { kreaVariant: candidate.kreaVariant } : {}),+ ...(isSampler(candidate.sampler) ? { sampler: candidate.sampler } : {}),+ ...(isScheduler(candidate.scheduler) ? { scheduler: candidate.scheduler } : {}),...(isSigmaShift(candidate.videoSigmaShift) ? { videoSigmaShift: candidate.videoSigmaShift } : {}),...(isSigmaShift(candidate.audioSigmaShift) ? { audioSigmaShift: candidate.audioSigmaShift } : {}),...(typeof candidate.motionCache === "boolean" ? { motionCache: candidate.motionCache } : {}),@@ -797,7 +823,7 @@ export function saveEngineSettings(settings: EngineSettings): void {/** The `slopfab` provider setting these paths describe, with blanks dropped so* an unset field falls through to whatever the project (or the Rust default)* already had rather than overwriting it with "". */-export function engineProviderSetting(settings: EngineSettings, base?: ProviderSetting, attention = defaultGeneratorTemplate().attention, selection = defaultGeneratorTemplate().loras, mode = defaultGeneratorTemplate().mode, additionalSafetensors = defaultGeneratorTemplate().additionalSafetensors, motionCache = defaultGeneratorTemplate().motionCache ?? false, sources = defaultGeneratorTemplate().sources, shifts: SigmaShifts & { modelType?: string; editingModel?: boolean; kreaVariant?: "raw" | "turbo" } = defaultGeneratorTemplate(), sceneLoras: TemplateLora[] = []): ProviderSetting {+export function engineProviderSetting(settings: EngineSettings, base?: ProviderSetting, attention = defaultGeneratorTemplate().attention, selection = defaultGeneratorTemplate().loras, mode = defaultGeneratorTemplate().mode, additionalSafetensors = defaultGeneratorTemplate().additionalSafetensors, motionCache = defaultGeneratorTemplate().motionCache ?? false, sources = defaultGeneratorTemplate().sources, shifts: SigmaShifts & SamplingChoices & { modelType?: string; editingModel?: boolean; kreaVariant?: "raw" | "turbo" } = defaultGeneratorTemplate(), sceneLoras: TemplateLora[] = []): ProviderSetting {// Resolve again at submission: a queued generator may predate a default encoder change.if (shifts.modelType === MINIMAX_H3_MODEL_TYPE) {const library = loadGeneratorTemplateSettings().h3Components!;@@ -822,6 +848,8 @@ export function engineProviderSetting(settings: EngineSettings, base?: ProviderSif (shifts.modelType === KREA_MODEL_TYPE) options.kreaVariant = shifts.kreaVariant ?? "turbo";delete options.loras;delete options.schedule;+ delete options.sampler;+ delete options.scheduler;delete options.stepOverride;delete options.samplingPreset;for (const key of ["videoSigmaShift", "audioSigmaShift"] as const) {@@ -865,6 +893,10 @@ export function engineProviderSetting(settings: EngineSettings, base?: ProviderS// Fixed re-noising schedules forbid approximate caches.delete options.motionCache;}+ const sampling = effectiveTemplateSampling({ ...shifts, paths: settings, sources, mode, loras: selection }, sceneLoras);+ if (sampling.sampler !== "default") options.sampler = sampling.sampler;+ if (sampling.scheduler !== "default") options.scheduler = sampling.scheduler;+ if (sampling.sampler !== "default" && sampling.sampler !== "euler") delete options.motionCache;for (const field of ENGINE_PATH_FIELDS) {if (!pathFields.some(({ id }) => id === field.id)) {delete options[field.id];diff --git a/src/lib/slop.ts b/src/lib/slop.tsindex 9e06a59..6a245f3 100644--- a/src/lib/slop.ts+++ b/src/lib/slop.ts@@ -1,3 +1,4 @@+import { SAMPLERS, SCHEDULERS } from "./sampling";import { z } from "zod";import { MAX_GENERATION_STEPS } from "./project";import { loadLoras, MAX_LORA_STRENGTH, saveLoras, type Lora } from "./loras";@@ -27,7 +28,7 @@ const portableLoraSchema = z.object({stepOverride: steps.optional(), samplingPreset: z.enum(["dmad-4step", "pika-6step"]).optional(),}).strict();export const portableGeneratorSchema = z.object({- name, modelType: name, editingModel: z.boolean().optional(), kreaVariant: z.enum(["turbo", "raw"]).optional(), defaultSteps: steps, attention: z.enum(["exact", "flash2", "sage2", "sol"]),+ name, modelType: name, sampler: z.enum(SAMPLERS).optional(), scheduler: z.enum(SCHEDULERS).optional(), editingModel: z.boolean().optional(), kreaVariant: z.enum(["turbo", "raw"]).optional(), defaultSteps: steps, attention: z.enum(["exact", "flash2", "sage2", "sol"]),mode: z.enum(["prompt", "animate"]).default("prompt"), motionCache: z.boolean().default(false),sources: sourcesSchema,loras: z.array(portableLoraSchema).max(128).default([]),@@ -81,7 +82,7 @@ export function portableGenerator(template: GeneratorTemplate, library = loadLor...(lora.samplingPreset ? { samplingPreset: lora.samplingPreset } : {}) };});return validatedGenerator({- name: template.name, modelType: template.modelType, editingModel: template.editingModel, kreaVariant: template.kreaVariant, defaultSteps: template.defaultSteps, attention: template.attention,+ name: template.name, sampler: template.sampler, scheduler: template.scheduler, modelType: template.modelType, editingModel: template.editingModel, kreaVariant: template.kreaVariant, defaultSteps: template.defaultSteps, attention: template.attention,mode: template.mode ?? "prompt", motionCache: template.motionCache ?? false, sources, loras,additionalSafetensors: (template.additionalSafetensors ?? []).map((file) => ({ name: file.name, url: file.url, ...(file.role ? { role: file.role } : {}) })),}, template.name);@@ -122,7 +123,7 @@ export function mergeGeneratorSlop(document: GeneratorSlop, current: GeneratorTeconst paths = { ...EMPTY_ENGINE_SETTINGS };const usedLoraIds = new Set<string>();for (const field of ENGINE_PATH_FIELDS) paths[field.id] = data.sources[field.id]?.[0]?.url ?? "";- return { ...template, editingModel: data.editingModel, kreaVariant: data.kreaVariant, defaultSteps: data.defaultSteps, attention: data.attention, mode: data.mode, motionCache: data.motionCache,+ return { ...template, sampler: data.sampler, scheduler: data.scheduler, editingModel: data.editingModel, kreaVariant: data.kreaVariant, defaultSteps: data.defaultSteps, attention: data.attention, mode: data.mode, motionCache: data.motionCache,paths, sources: structuredClone(data.sources),additionalSafetensors: data.additionalSafetensors.map((file) => ({ ...file, id: `additional-${crypto.randomUUID()}` })),loras: data.loras.map((entry) => {diff --git a/src/lib/templateSampling.test.ts b/src/lib/templateSampling.test.tsnew file mode 100644index 0000000..1055234--- /dev/null+++ b/src/lib/templateSampling.test.ts@@ -0,0 +1,48 @@+// @vitest-environment jsdom+import { beforeEach, expect, it } from "vitest";+import { effectiveTemplateSampling, engineProviderSetting, fiboBaseTemplate, kreaImageTemplates, loadGeneratorTemplateSettings,+ minimaxFastTemplate, minimaxOriginalTemplate, minimaxSingularityTemplate, mossImageTemplate, musicTemplates,+ saveGeneratorTemplateSettings, templateSamplingOptions, viggleAnimateTemplate, type GeneratorTemplate } from "./settings";+import { DMAD_LORA, saveLoras } from "./loras";+import { parseGeneratorSlop, serializeGeneratorSlop, mergeGeneratorSlop } from "./slop";++beforeEach(() => localStorage.clear());+const provider = (template: GeneratorTemplate, base?: Parameters<typeof engineProviderSetting>[1]) =>+ engineProviderSetting(template.paths, base, template.attention, template.loras ?? [], template.mode ?? "prompt", [], template.motionCache, template.sources, template);++it("preserves legacy defaults without forcing a sampler or scheduler", () => {+ const template = minimaxOriginalTemplate();+ expect(effectiveTemplateSampling(template)).toEqual({ sampler: "default", scheduler: "default" });+ const options = provider(template, { enabled: true, model: null, options: { sampler: "er_sde", scheduler: "beta", schedule: "beta" } }).options;+ expect(options).not.toHaveProperty("sampler");+ expect(options).not.toHaveProperty("scheduler");+ expect(options).not.toHaveProperty("schedule");+});++it.each([mossImageTemplate(), fiboBaseTemplate(), ...kreaImageTemplates()])("offers supported image sampling choices for $name", (template) => {+ expect(templateSamplingOptions(template)).toMatchObject({ samplers: ["default", "euler", "er_sde"], schedulers: ["default", "beta"] });+ const configured = { ...template, sampler: "er_sde" as const, scheduler: "beta" as const, videoSigmaShift: 4 };+ saveGeneratorTemplateSettings({ templates: [configured], defaultTemplateId: "", catalogVersion: 20 });+ const restored = loadGeneratorTemplateSettings().templates[0];+ expect(restored).toMatchObject({ sampler: "er_sde", scheduler: "beta" });+ expect(provider(restored).options).toMatchObject({ sampler: "er_sde", scheduler: "beta", videoSigmaShift: 4 });+ const bundle = parseGeneratorSlop(serializeGeneratorSlop([configured]));+ const imported = mergeGeneratorSlop(bundle, { templates: [], defaultTemplateId: "", catalogVersion: 20 }, []).settings.templates[0];+ expect(imported).toMatchObject({ sampler: "er_sde", scheduler: "beta" });+});++it("limits music, Animate, Omni and fixed recipes without treating step counts as fixed grids", () => {+ for (const template of musicTemplates()) expect(templateSamplingOptions(template)).toMatchObject({ samplers: ["default"], schedulers: ["default"] });+ expect(templateSamplingOptions(viggleAnimateTemplate())).toMatchObject({ samplers: ["default", "euler"], schedulers: ["default", "beta"] });+ expect(templateSamplingOptions(minimaxFastTemplate())).toMatchObject({ samplers: ["default", "euler"], schedulers: ["default"] });+ expect(templateSamplingOptions(minimaxSingularityTemplate()).schedulers).toEqual(["default", "beta"]);+ const template = { ...minimaxOriginalTemplate(), sampler: "er_sde" as const, scheduler: "beta" as const, motionCache: true };+ expect(templateSamplingOptions(template).samplers).toEqual(["default", "euler", "ab2", "renoise", "er_sde"]);+ expect(provider(template).options).not.toHaveProperty("motionCache");+ saveLoras([{ ...DMAD_LORA, path: "D:/dmad.safetensors", globallyEnabled: true }]);+ expect(templateSamplingOptions(template)).toMatchObject({ samplers: ["default"], schedulers: ["default"] });+ expect(provider(template).options).toMatchObject({ samplingPreset: "dmad-4step" });+ expect(provider(template).options).not.toHaveProperty("sampler");+ expect(provider(template).options).not.toHaveProperty("scheduler");+ expect(template).toMatchObject({ sampler: "er_sde", scheduler: "beta" });+});diff --git a/src/lib/workers.test.ts b/src/lib/workers.test.tsindex c612e7d..ba9c21d 100644--- a/src/lib/workers.test.ts+++ b/src/lib/workers.test.ts@@ -84,6 +84,12 @@ describe("LAN generation workers", () => {expect(options).toMatchObject({ samplingPreset: "dmad-4step", stepOverride: 4 });expect(options).not.toHaveProperty("motionCache");});+ it("sends sampler and scheduler choices to the selected worker", async () => {+ await choose({ selectedId: "aaaaaaaaaaaaaaaa", workers: [worker()] });+ const template = { ...downloadable(), loras: [], sampler: "er_sde" as const, scheduler: "beta" as const };+ const options = engineProviderSetting(template.paths, undefined, "flash2", [], "prompt", [], false, template.sources, template).options;+ expect(options).toMatchObject({ sampler: "er_sde", scheduler: "beta" });+ });it.each([12, 32])("selects worker variants with %s GB even when another variant is downloaded locally", async (vram) => {const template = downloadable();