Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.
TypeScript ai-photo-editorcomfyui-alternativegenerative-fillimage-editingimage-generationinpaintinglinuxlocal-aimacosmcpmcp-servernano-banana-alternativeofflinephoto-editorprivacyqwen-imageqwen-image-2-1stable-diffusion-cppvulkanwindows
Turbo only: three presets, GAN-only upscaling
Gabriele Lozupone0ffeca851785
diff --git a/README.md b/README.mdindex bf4ef9a..81e0487 100644--- a/README.md+++ b/README.md@@ -154,7 +154,7 @@ whole thing takes a few minutes, and the setup screen shows what Kokon can do wh| **macOS** | 26 Tahoe | latest || **Unified memory** | 16 GB: works, but slowly (lightest mode, about 1 megapixel) | 32 GB or more (also gets native 2K) || **Disk** | 15 GB free | 25 GB free |-| **Time per image** | About 10 minutes for 1024×1024 on a 16 GB M2 Pro; Fast renders at 768×768 and enlarges, which is quicker | Faster on Max/Ultra chips with more memory; Turbo (the default) needs 8 steps instead of 20 |+| **Time per image** | About 10 minutes for 1024×1024 on a 16 GB M2 Pro; Fast renders at 768×768 and enlarges, which is quicker | Faster on Max/Ultra chips with more memory |Kokon measures your machine's speed with the first image and shows realistic time estimatesfrom then on.@@ -177,15 +177,16 @@ preset later from Settings → Models → **Set up models…**| Preset | Diffusion model | Text encoder (in RAM) | Download | Tested on real hardware || --- | --- | --- | --- | --- |-| 12 GB | Qwen-Image 2.1 Q4_K_M (4.2 GB) | Qwen3-VL 8B Q4_K_M | ~12 GB | ✅ RTX 5070 (12 GB) |-| 16 GB | Qwen-Image 2.1 Q4_K_M | Qwen3-VL 8B Q4_K_M | ~12 GB | ✅ RTX 5070 Ti |-| 24 GB | Qwen-Image 2.1 Q8_0 (7.6 GB) | Qwen3-VL 8B Q4_K_M | ~15 GB | not yet |-| 32 GB+ | Qwen-Image 2.1 Q8_0 | Qwen3-VL 8B Q8_0 (8.7 GB) | ~19 GB | not yet |+| 12 GB | Qwen-Image 2.1 Turbo Q4_K (4.1 GB) | Qwen3-VL 8B Q4_K_M | ~12 GB | ✅ RTX 5070 (12 GB) |+| 16 GB | Qwen-Image 2.1 Turbo Q4_K | Qwen3-VL 8B Q4_K_M | ~12 GB | ✅ RTX 5070 Ti |+| 24 GB | Qwen-Image 2.1 Turbo Q4_K | Qwen3-VL 8B Q4_K_M | ~12 GB | not yet |+| 32 GB+ | Qwen-Image 2.1 Turbo Q4_K | Qwen3-VL 8B Q8_0 (8.7 GB) | ~16 GB | not yet |Every preset also gets stable-diffusion.cpp (the CUDA 12 build on NVIDIA, the Vulkan build on AMD and Intel, the Metal build on a Mac), the Qwen-Image 2.1 VAE, the-Qwen3-VL vision projector, the 8-step Qwen-Image 2.1 Turbo model and, optionally, the 4x-UltraSharp upscaler. The sources are the-official [Qwen-Image 2.1](https://huggingface.co/Qwen/Qwen-Image-2.1) weights through-[unsloth/Qwen-Image-2.1-GGUF](https://huggingface.co/unsloth/Qwen-Image-2.1-GGUF),+Qwen3-VL vision projector and, optionally, the 4x-UltraSharp upscaler. The image model is Qwen's+official 8-step [Qwen-Image 2.1 Turbo](https://huggingface.co/Qwen/Qwen-Image-2.1-Turbo) through+[DogukanUrker/Qwen-Image-2.1-Turbo-GGUF](https://huggingface.co/DogukanUrker/Qwen-Image-2.1-Turbo-GGUF);+the other sources are[Qwen/Qwen3-VL-8B-Instruct-GGUF](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct-GGUF) and[Comfy-Org/Qwen-Image-2.1](https://huggingface.co/Comfy-Org/Qwen-Image-2.1).@@ -204,7 +205,7 @@ Other weights, such as fine-tunes, can be selected in Settings → Models.| Several photos + a sentence | **Combine** them | Refer to them as “image 1”, “image 2”… and drag to reorder || A brushed area + an action | **Inpaint**: Change, Remove, Replace or Add | Remove needs no prompt || Dragged edges | **Expand** the photo (outpainting) | Or type pixel or percent values |-| Any result | **Upscale** to 2×, 4K, the source size or a custom width | Quick (seconds) or Detailed (about a minute) |+| Any result | **Upscale** to 2×, 4K, the source size or a custom width | With the upscaler model, in seconds |<p align="center"><img src="docs/media/screenshot-app.png" alt="The Kokon window: a cat-and-cowboy western showdown built from three generated images, combined, edited and expanded, with its version tree, the compare views and the prompt box" width="860">@@ -218,9 +219,9 @@ opened in Explorer or Finder. A few things make that loop fast:Undo returns to the version the current one came from, and nothing is ever deleted.- **Gallery**: every image keeps its full recipe (prompt, seed, settings, pipeline) and reopenswith one click. The recipe is also embedded in the PNG.-- **Quality presets**: **Turbo** (the default: ~1 MP in 8 steps with Qwen's official- distilled model, about twice as fast), Fast, Balanced, Quality (native 2K) and Ultra (native 2K- with the official 40 steps), so you never need to tune steps or guidance.+- **Quality presets**: **Fast** (the default, ~1 MP), **Balanced** (~1.5K) and **Quality**+ (native 2K). All run Qwen's official 8-step Turbo model with its own schedule, so you never+ need to tune steps or guidance.## How it works@@ -340,9 +341,8 @@ Invoke-RestMethod -Method Post "http://127.0.0.1:$($i.port)/api/v1/generate" -HeSimple-operation fields: `prompt`, `image` / `images[]`, `mask`, `action`(`edit|remove|replace|add`, inpainting), `width`, `height`, `aspect_ratio`, `quality`(`fast|balanced|quality`), `seed`, `output_path`, `preserve_dimensions`, `private`,-`left/right/top/bottom` + `units` (`pixels|percent`) for outpainting, `scale` and `method`-(`quick|detailed`) for upscaling. Full requests (`/jobs`) also accept `"mode": "upscale"` with-`"upscale": {"method", "scale" | "width"/"height"}` and `"advanced": {"refine": "fast|best"}`.+`left/right/top/bottom` + `units` (`pixels|percent`) for outpainting, `scale` for upscaling.+Full requests (`/jobs`) also accept `"mode": "upscale"` with `"upscale": {"scale" | "width"/"height"}`.</details>@@ -532,7 +532,7 @@ or macOS version and the log from `KokonData/logs` (see the table above).- [x] macOS on Apple Silicon (beta, Metal)- [x] One-click in-app updates on Windows and Mac- [ ] AMD and Intel GPUs through Vulkan (beta now; works on NVIDIA, to verify on AMD/Intel)-- [ ] Fast mode with a turbo LoRA (an edit in about 15 seconds)+- [x] Qwen's official 8-step Turbo model for every preset- [ ] Background removal and transparent cutouts- [ ] Batch edits: one instruction for a whole folder- [ ] Plugins for Krita, GIMP and Photoshop through the local API@@ -612,8 +612,8 @@ upscaler are downloaded from their authors and keep their own licenses (see the[FAQ](#faq)).Kokon builds on [stable-diffusion.cpp](https://github.com/leejet/stable-diffusion.cpp) by-leejet, [Qwen-Image 2.1](https://huggingface.co/Qwen/Qwen-Image-2.1) by the Qwen team,-[Unsloth](https://huggingface.co/unsloth)'s GGUF conversions, [Tauri](https://tauri.app) and+leejet, [Qwen-Image 2.1](https://huggingface.co/Qwen/Qwen-Image-2.1) and its Turbo model by the+Qwen team, DogukanUrker's Turbo GGUF conversions, [Tauri](https://tauri.app) and4x-UltraSharp by Kim2091. Thank you.<p align="center">diff --git a/crates/qls-core/src/catalog.rs b/crates/qls-core/src/catalog.rsindex 98d0b64..c3c6ef2 100644--- a/crates/qls-core/src/catalog.rs+++ b/crates/qls-core/src/catalog.rs@@ -1,5 +1,5 @@//! What the first-run wizard installs: the stable-diffusion.cpp build the app was verified-//! with, the official Qwen-Image 2.1 weights, and the VRAM presets that choose between them.+//! with, the official Qwen-Image 2.1 Turbo weights, and the VRAM presets that choose between them.//!//! Every file is pinned by URL, size and SHA-256 (from the Hugging Face / GitHub APIs,//! 2026-10-08). If a link moves, the wizard reports it and asks the user to download the@@ -135,32 +135,25 @@ pub fn engine_downloads(backend: GpuBackend) -> Vec<Download> {}}-const UNSLOTH: &str = "https://huggingface.co/unsloth/Qwen-Image-2.1-GGUF/tree/main";const QWEN_TE: &str = "https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct-GGUF/tree/main";-/// Official Qwen-Image 2.1 weights, 4-bit (Unsloth GGUF of Qwen/Qwen-Image-2.1).-pub const DIFFUSION_Q4_K_M: Download = Download {- id: "diffusion_q4_k_m",- label: "Qwen-Image 2.1 Q4_K_M",- kind: FileKind::Model,- url: "https://huggingface.co/unsloth/Qwen-Image-2.1-GGUF/resolve/main/qwen-image-2.1-Q4_K_M.gguf",- page: UNSLOTH,- size: 4_199_565_024,- sha256: "631d532e7ca71e8d90a87c71d3699761a812039d22e3370e87498d87754660fe",- dest: "models/qwen21/qwen-image-2.1-Q4_K_M.gguf",- provides: &[],-};+const TURBO_GGUF: &str = "https://huggingface.co/DogukanUrker/Qwen-Image-2.1-Turbo-GGUF";-/// Official weights, 8-bit: closest to the original, for cards with room to spare.-pub const DIFFUSION_Q8_0: Download = Download {- id: "diffusion_q8_0",- label: "Qwen-Image 2.1 Q8_0",+/// The image model: Qwen's official 8-step distilled Qwen-Image 2.1 (Qwen/Qwen-Image-2.1-Turbo,+/// Qwen Research License like the base model), as a GGUF converted with stable-diffusion.cpp.+/// Same-seed A/B on an RTX 5070 Ti (2026-10-10): ~2x faster than the 20-step base model at+/// equal quality, faithful edits. The base Qwen-Image 2.1 weights were dropped on 2026-10-09.+/// Every preset uses this 4-bit file (user choice, 2026-10-09; the repo's Q4_K was judged+/// almost identical to its Q8_0).+pub const TURBO_Q4_K: Download = Download {+ id: "turbo_q4_k",+ label: "Qwen-Image 2.1 Turbo Q4_K",kind: FileKind::Model,- url: "https://huggingface.co/unsloth/Qwen-Image-2.1-GGUF/resolve/main/qwen-image-2.1-Q8_0.gguf",- page: UNSLOTH,- size: 7_640_860_384,- sha256: "c0ed4b2ffd56cbe9c3df1e4a4098045256484ebe94ba5a7e4338d35ec046baa5",- dest: "models/qwen21/qwen-image-2.1-Q8_0.gguf",+ url: "https://huggingface.co/DogukanUrker/Qwen-Image-2.1-Turbo-GGUF/resolve/main/qwen-image-2.1-turbo-Q4_K.gguf",+ page: TURBO_GGUF,+ size: 4_050_916_384,+ sha256: "f8d5611b495848b632f8ae14dc7da6525fe2796eb80998f8dee5e04d0a2f69eb",+ dest: "models/qwen21/qwen-image-2.1-turbo-Q4_K.gguf",provides: &[],};@@ -227,23 +220,6 @@ pub const UPSCALER: Download = Download {provides: &[],};-/// Turbo: Qwen's official 8-step distilled Qwen-Image 2.1 (Qwen/Qwen-Image-2.1-Turbo, Qwen-/// Research License like the base model), as a GGUF converted with stable-diffusion.cpp.-/// A separate diffusion model: the server restarts when a job switches between it and the-/// base model. Same-seed A/B on an RTX 5070 Ti (2026-10-10): ~2x faster than 20-step Fast,-/// equal quality, more faithful edits than the Viggle LoRA.-pub const TURBO_Q4_K: Download = Download {- id: "turbo",- label: "Qwen-Image 2.1 Turbo Q4_K (8 steps)",- kind: FileKind::Model,- url: "https://huggingface.co/DogukanUrker/Qwen-Image-2.1-Turbo-GGUF/resolve/main/qwen-image-2.1-turbo-Q4_K.gguf",- page: "https://huggingface.co/DogukanUrker/Qwen-Image-2.1-Turbo-GGUF",- size: 4_050_916_384,- sha256: "f8d5611b495848b632f8ae14dc7da6525fe2796eb80998f8dee5e04d0a2f69eb",- dest: "models/qwen21/qwen-image-2.1-turbo-Q4_K.gguf",- provides: &[],-};-/// Hardware presets: which weights to download and how to run them, by VRAM.#[derive(Debug, Clone, Copy, Serialize)]pub struct Preset {@@ -256,9 +232,8 @@ pub struct Preset {pub unified_label: &'static str,/// `summary` for a Mac (no "system RAM": it is the same memory).pub unified_summary: &'static str,+ /// The image model (a Turbo quantization).pub diffusion: Download,- /// The 8-step Turbo model (the default quality level).- pub turbo: Download,pub text_encoder: Download,pub text_encoder_placement: TextEncoderPlacement,/// Measured on real hardware of this class (otherwise only derived).@@ -275,8 +250,7 @@ pub const PRESETS: &[Preset] = &[unified_label: "16–24 GB Mac",unified_summary: "4-bit image model and text encoder; images of about 1–1.5 megapixels",min_vram_mib: 0,- diffusion: DIFFUSION_Q4_K_M,- turbo: TURBO_Q4_K,+ diffusion: TURBO_Q4_K,text_encoder: TEXT_ENCODER_Q4_K_M,text_encoder_placement: TextEncoderPlacement::Ram,verified: true,@@ -288,8 +262,7 @@ pub const PRESETS: &[Preset] = &[unified_label: "32–36 GB Mac",unified_summary: "4-bit image model and text encoder; native 2K for Quality",min_vram_mib: 14 * 1024,- diffusion: DIFFUSION_Q4_K_M,- turbo: TURBO_Q4_K,+ diffusion: TURBO_Q4_K,text_encoder: TEXT_ENCODER_Q4_K_M,text_encoder_placement: TextEncoderPlacement::Ram,verified: true,@@ -299,27 +272,25 @@ pub const PRESETS: &[Preset] = &[id: "24gb",label: "24 GB",unified_label: "48 GB Mac",- unified_summary: "8-bit image model (closest to the original); larger edits fit",+ unified_summary: "4-bit image model and text encoder; larger edits fit",min_vram_mib: 20 * 1024,- diffusion: DIFFUSION_Q8_0,- turbo: TURBO_Q4_K,+ diffusion: TURBO_Q4_K,text_encoder: TEXT_ENCODER_Q4_K_M,text_encoder_placement: TextEncoderPlacement::Ram,verified: false,- summary: "8-bit model (closest to the original); larger edits fit",+ summary: "4-bit model; text encoder in system RAM; larger edits fit",},Preset {id: "32gb",label: "32 GB+",unified_label: "64 GB+ Mac",- unified_summary: "8-bit image model and 8-bit text encoder",+ unified_summary: "4-bit image model and 8-bit text encoder",min_vram_mib: 28 * 1024,- diffusion: DIFFUSION_Q8_0,- turbo: TURBO_Q4_K,+ diffusion: TURBO_Q4_K,text_encoder: TEXT_ENCODER_Q8_0,text_encoder_placement: TextEncoderPlacement::Ram,verified: false,- summary: "8-bit model and 8-bit text encoder",+ summary: "4-bit model and 8-bit text encoder",},];@@ -340,7 +311,7 @@ pub fn recommended_preset(vram_mib: Option<u64>) -> &'static Preset {/// Everything a preset needs on `backend`, in download order (small, essential files first).pub fn downloads_for(p: &Preset, backend: GpuBackend, with_upscaler: bool) -> Vec<Download> {let mut v = engine_downloads(backend);- v.extend([VAE, VISION_PROJECTOR, p.text_encoder, p.turbo, p.diffusion]);+ v.extend([VAE, VISION_PROJECTOR, p.text_encoder, p.diffusion]);if with_upscaler {v.push(UPSCALER);}@@ -379,7 +350,7 @@ mod tests {#[test]fn catalog_is_well_formed() {- let all = [ENGINE_CUDA, CUDA_RUNTIME, ENGINE_VULKAN, ENGINE_METAL, DIFFUSION_Q4_K_M, DIFFUSION_Q8_0, VAE, TEXT_ENCODER_Q4_K_M, TEXT_ENCODER_Q8_0, VISION_PROJECTOR, UPSCALER];+ let all = [ENGINE_CUDA, CUDA_RUNTIME, ENGINE_VULKAN, ENGINE_METAL, TURBO_Q4_K, VAE, TEXT_ENCODER_Q4_K_M, TEXT_ENCODER_Q8_0, VISION_PROJECTOR, UPSCALER];for d in all {assert!(d.url.starts_with("https://"), "{}", d.id);assert_eq!(d.sha256.len(), 64, "{}", d.id);@@ -391,9 +362,9 @@ mod tests {// The default upscaler matches the one Settings offers first.assert!(UPSCALER.dest.ends_with(&format!("{}.pth", crate::config::DEFAULT_UPSCALER)));for p in PRESETS {- assert_eq!(downloads_for(p, GpuBackend::Cuda, true).len(), 8);+ assert_eq!(downloads_for(p, GpuBackend::Cuda, true).len(), 7);let vk = downloads_for(p, GpuBackend::Vulkan, false);- assert_eq!(vk.len(), 6);+ assert_eq!(vk.len(), 5);assert!(vk.iter().all(|d| d.id != "engine_cuda" && d.id != "cuda_runtime"));}}diff --git a/crates/qls-core/src/config.rs b/crates/qls-core/src/config.rsindex 54ae183..2a5b63b 100644--- a/crates/qls-core/src/config.rs+++ b/crates/qls-core/src/config.rs@@ -26,7 +26,7 @@ pub const UPSCALER_CHOICES: &[(&str, &str, &str)] = &[pub const DEFAULT_UPSCALER: &str = UPSCALER_CHOICES[0].0;/// Default before schema 2; configs still on it are moved to [`DEFAULT_UPSCALER`].const OLD_DEFAULT_UPSCALER: &str = "RealESRGAN_x4plus";-const SCHEMA_VERSION: u32 = 6;+const SCHEMA_VERSION: u32 = 7;/// Profile id of the official Qwen-Image 2.1 weights (the default since schema 5).pub const OFFICIAL_PROFILE_ID: &str = "qwen-image-2.1";@@ -107,8 +107,8 @@ impl GpuBackend {}}-/// Effort of a Detailed upscale (low-denoise re-render at ~2K before the upscaler model).-/// Generation itself always runs in one pass (two-pass refine removed 2026-10-06).+/// Effort of the refine pass of older versions (two-pass generation, removed 2026-10-06;+/// Detailed upscale, removed 2026-10-09). Kept to read their gallery records.#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]#[serde(rename_all = "snake_case")]pub enum RefineMode {@@ -121,66 +121,27 @@ pub enum RefineMode {Best,}+/// Per-model planning settings. Sampling itself is fixed by the Turbo model: its 8-step+/// schedule (`planner::TURBO_SIGMAS`) at CFG 1.#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]#[serde(default)]pub struct RecommendedSettings {pub sampler: String,- pub scheduler: Option<String>,- /// 1.0 = no classifier-free guidance: one model pass per step, negative prompt unused.- pub cfg: f32,- /// CFG for modes that start from an image (edit, multi-reference, inpaint, outpaint,- /// Detailed upscale).- pub cfg_edit: f32,- pub steps_fast: u32,- pub steps_balanced: u32,- pub steps_quality: u32,- pub steps_ultra: u32,/// Pixel area used by Auto resolution at each quality level.pub area_fast: u64,pub area_balanced: u64,pub area_quality: u64,- pub area_ultra: u64,pub align: u32,pub max_side: u32,pub max_references: u32,- pub negative_prompt: String,- /// Detailed upscale: largest re-render area and effective steps per effort.- pub hires_max_area: u64,- pub hires_steps_fast: u32,- pub hires_steps_best: u32,- /// EasyCache reuse threshold of a Fast Detailed upscale.- pub easycache_threshold: f32,}impl Default for RecommendedSettings {fn default() -> Self {- // Official Qwen-Image 2.1 settings (QwenLM/Qwen-Image-2.1 README, diffusers- // QwenImage21Pipeline): no CFG ("meant to be sampled without guidance"), 40 steps,- // native 2K buckets; flow-matching Euler, whose resolution-dependent schedule- // sd-server selects automatically. Only Ultra runs the official 40 steps; the other- // presets use 20 (judged enough by the user, 2026-10-09) and differ in size.- Self {- sampler: "euler".into(),- scheduler: None,- cfg: 1.0,- cfg_edit: 1.0,- steps_fast: 20,- steps_balanced: 20,- steps_quality: 20,- steps_ultra: 40,- area_fast: 1024 * 1024,- area_balanced: 1536 * 1536,- area_quality: 2048 * 2048,- area_ultra: 2048 * 2048,- align: 32,- max_side: 4096,- max_references: 10,- negative_prompt: String::new(),- hires_max_area: 2048 * 1152,- hires_steps_fast: 6,- hires_steps_best: 8,- easycache_threshold: 0.2,- }+ // Official Qwen-Image 2.1 Turbo settings (Qwen/Qwen-Image-2.1-Turbo model card): its+ // saved 8-step schedule with flow-matching Euler, no CFG, native 2K buckets. The+ // presets differ only in size: ~1 MP, 1.5K and native 2K.+ Self { sampler: "euler".into(), area_fast: 1024 * 1024, area_balanced: 1536 * 1536, area_quality: 2048 * 2048, align: 32, max_side: 4096, max_references: 10 }}}@@ -223,14 +184,14 @@ impl Default for ModelProfile {}impl ModelProfile {- /// The official Qwen-Image 2.1 weights a hardware preset downloads (Unsloth GGUF of- /// Qwen/Qwen-Image-2.1, Qwen's own Qwen3-VL GGUF, the 2.1 VAE).+ /// The official weights a hardware preset downloads (GGUF of Qwen/Qwen-Image-2.1-Turbo,+ /// Qwen's own Qwen3-VL GGUF, the 2.1 VAE).pub fn official(sdcpp_dir: &Path, preset: &crate::catalog::Preset) -> Self {use crate::catalog::{VAE, VISION_PROJECTOR};let quant = preset.diffusion.dest.rsplit('-').next().unwrap_or("").trim_end_matches(".gguf");Self {id: OFFICIAL_PROFILE_ID.into(),- display_name: format!("Qwen-Image 2.1 {quant} (official)"),+ display_name: format!("Qwen-Image 2.1 Turbo {quant} (official)"),diffusion_model: preset.diffusion.path(sdcpp_dir),vae: VAE.path(sdcpp_dir),text_encoder: preset.text_encoder.path(sdcpp_dir),@@ -300,8 +261,6 @@ pub struct AppConfig {pub upscaler_model: String,/// ESRGAN tile size in pixels; 0 = backend default (128).pub upscale_tile_size: u32,- /// Default effort of a Detailed upscale.- pub refine_mode: RefineMode,pub extra_server_args: Vec<String>,pub output_dir: PathBuf,pub keep_server_running: bool,@@ -340,7 +299,6 @@ impl Default for AppConfig {upscalers_dir: None,upscaler_model: DEFAULT_UPSCALER.into(),upscale_tile_size: 0,- refine_mode: RefineMode::Fast,extra_server_args: vec![],output_dir: default_output_dir(),keep_server_running: false,@@ -449,57 +407,18 @@ impl AppConfig {if c.schema_version < 2 && c.upscaler_model.trim() == OLD_DEFAULT_UPSCALER {c.upscaler_model = DEFAULT_UPSCALER.into();}- if c.schema_version < 3 {- // Presets saved with the old defaults move to the new ones; edited values stay.- for p in &mut c.profiles {- let r = &mut p.recommended_settings;- if r.steps_balanced == 30 {- r.steps_balanced = 20;- }- if r.steps_quality == 40 {- r.steps_quality = 20;- }- if r.area_quality == 1536 * 1536 {- r.area_quality = 2_000_000;- }- }- }- if c.schema_version < 4 {- // Old defaults came from sd.cpp's example (CFG 6, edits 4, 20 steps);- // move them to the official settings. Edited values stay.- for p in &mut c.profiles {- let r = &mut p.recommended_settings;- if r.cfg == 6.0 {- r.cfg = 1.0;- }- if r.cfg_edit == 4.0 {- r.cfg_edit = 1.0;- }- if r.steps_balanced == 20 {- r.steps_balanced = 40;- }- if r.steps_quality == 20 {- r.steps_quality = 40;- }- if r.area_quality == 2_000_000 {- r.area_quality = 2048 * 2048;- }- }- }- if c.schema_version < 6 {- // 20 steps for Balanced and Quality, Balanced at 1.5K (Ultra takes the- // official 40 steps). Edited values stay.+ if c.schema_version < 7 {+ // Turbo only (2026-10-09): the official profile moves from the base+ // Qwen-Image 2.1 weights to the preset's Turbo model, and every profile+ // gets the new presets (the old step/CFG settings no longer exist).+ let preset = c.preset();for p in &mut c.profiles {- let r = &mut p.recommended_settings;- if r.steps_balanced == 40 {- r.steps_balanced = 20;- }- if r.steps_quality == 40 {- r.steps_quality = 20;- }- if r.area_balanced == 1024 * 1024 {- r.area_balanced = 1536 * 1536;+ if p.id == OFFICIAL_PROFILE_ID {+ let official = ModelProfile::official(&c.sdcpp_dir, preset);+ p.display_name = official.display_name;+ p.diffusion_model = official.diffusion_model;}+ p.recommended_settings = RecommendedSettings::default();}}// Paths into the data folder of the app's old name (models installed by the@@ -620,22 +539,6 @@ impl AppConfig {}}- /// The Turbo model of the hardware preset, if it is installed.- pub fn turbo_model(&self) -> Option<PathBuf> {- let t = self.preset().turbo;- t.is_present(&self.sdcpp_dir).then(|| t.path(&self.sdcpp_dir))- }-- /// This configuration with the server running the Turbo model instead of the active- /// profile's diffusion model (same encoder, VAE and launch flags). None if not installed.- pub fn with_turbo(&self) -> Option<AppConfig> {- let path = self.turbo_model()?;- let mut c = self.clone();- let id = c.active_profile.clone();- c.profiles.iter_mut().find(|p| p.id == id)?.diffusion_model = path;- Some(c)- }-/// The configured ESRGAN model file, if present. sd-server resolves names the same/// way: `<dir>/<name>.<ext>`, top level only.pub fn upscaler_file(&self) -> Option<PathBuf> {@@ -682,8 +585,8 @@ mod tests {let c = AppConfig::default();let p = c.profile();assert_eq!(p.id, OFFICIAL_PROFILE_ID);- assert_eq!(p.display_name, "Qwen-Image 2.1 Q4_K_M (official)");- assert!(p.diffusion_model.ends_with("qwen-image-2.1-Q4_K_M.gguf"));+ assert_eq!(p.display_name, "Qwen-Image 2.1 Turbo Q4_K (official)");+ assert!(p.diffusion_model.ends_with("qwen-image-2.1-turbo-Q4_K.gguf"));assert!(p.diffusion_model.starts_with(default_sdcpp_dir()));assert_eq!(c.hardware_preset, "16gb");assert_eq!(c.planning_vram_mib(Some(16303)), Some(16303));@@ -693,7 +596,6 @@ mod tests {assert!(!c.keep_server_running);assert!(c.validate().is_ok());assert_eq!(p.files().len(), 4);- assert_eq!(c.refine_mode, RefineMode::Fast);assert_eq!(c.upscaler_model, "4x-UltraSharp");assert_eq!(c.upscalers_dir(), default_sdcpp_dir().join("models").join("upscalers"));}@@ -740,14 +642,14 @@ mod tests {let off = c.profiles.iter().find(|p| p.id == OFFICIAL_PROFILE_ID).unwrap();// Catalog paths are joined per component, so the separator is the platform's own.let sd = |f: &str| crate::catalog::join_rel(Path::new(r"D:\sd"), &format!("models/qwen21/{f}"));- assert_eq!(off.diffusion_model, sd("qwen-image-2.1-Q4_K_M.gguf"));+ assert_eq!(off.diffusion_model, sd("qwen-image-2.1-turbo-Q4_K.gguf"));// Saved again, nothing is added twice.c.save_to(&p).unwrap();assert_eq!(AppConfig::load_from(&p).profiles.len(), 2);// A file without profiles uses its own folder and preset.std::fs::write(&p, r#"{"sdcppDir":"D:\\sd","hardwarePreset":"24gb"}"#).unwrap();let c = AppConfig::load_from(&p);- assert_eq!(c.profile().diffusion_model, sd("qwen-image-2.1-Q8_0.gguf"));+ assert_eq!(c.profile().diffusion_model, sd("qwen-image-2.1-turbo-Q4_K.gguf"));}#[test]@@ -776,13 +678,13 @@ mod tests {#[test]fn presets_switch_weights_and_keep_tuning() {let mut c = AppConfig::default();- c.profiles[0].recommended_settings.steps_fast = 12;+ c.profiles[0].recommended_settings.area_fast = 768 * 768;c.apply_preset(crate::catalog::preset("32gb").unwrap());let p = c.profile();- assert!(p.diffusion_model.ends_with("qwen-image-2.1-Q8_0.gguf"));+ assert!(p.diffusion_model.ends_with("qwen-image-2.1-turbo-Q4_K.gguf"), "4-bit Turbo on every preset");assert!(p.text_encoder.ends_with("Qwen3VL-8B-Instruct-Q8_0.gguf"));- assert_eq!(p.display_name, "Qwen-Image 2.1 Q8_0 (official)");- assert_eq!(p.recommended_settings.steps_fast, 12);+ assert_eq!(p.display_name, "Qwen-Image 2.1 Turbo Q4_K (official)");+ assert_eq!(p.recommended_settings.area_fast, 768 * 768);assert_eq!((c.hardware_preset.as_str(), c.profiles.len()), ("32gb", 1));c.vram_override_mib = 12_288;assert_eq!(c.planning_vram_mib(Some(16303)), Some(12_288));@@ -807,35 +709,24 @@ mod tests {}#[test]- fn old_quality_presets_are_migrated() {+ fn base_model_installs_move_to_turbo() {let dir = tempfile::tempdir().unwrap();let p = dir.path().join("config.json");- let old = r#"{"schemaVersion":2,"profiles":[{"id":"a","recommendedSettings":{"steps_balanced":30,"steps_quality":40,"area_quality":2359296}}]}"#;+ let old = r#"{"schemaVersion":6,"sdcppDir":"D:\\sd","hardwarePreset":"24gb","activeProfile":"qwen-image-2.1","profiles":[+ {"id":"qwen-image-2.1","displayName":"Qwen-Image 2.1 Q8_0 (official)","diffusionModel":"D:\\sd\\models\\qwen21\\qwen-image-2.1-Q8_0.gguf","backendArgs":["--x"],+ "recommendedSettings":{"steps_fast":20,"steps_ultra":40,"cfg":1.0,"area_ultra":4194304,"area_fast":1048576}},+ {"id":"mine","diffusionModel":"D:\\sd\\mine.gguf","recommendedSettings":{"area_quality":1000000}}]}"#;std::fs::write(&p, old).unwrap();- let r = AppConfig::load_from(&p).profiles[0].recommended_settings.clone();- // Schema 3, 4 and 6 run in sequence and end on the current presets.- assert_eq!((r.steps_balanced, r.steps_quality, r.area_quality, r.cfg_edit), (20, 20, 2048 * 2048, 1.0));- // Values the user changed are kept.- let custom = r#"{"schemaVersion":2,"profiles":[{"id":"a","recommendedSettings":{"steps_balanced":25,"steps_quality":50}}]}"#;- std::fs::write(&p, custom).unwrap();- let r = AppConfig::load_from(&p).profiles[0].recommended_settings.clone();- assert_eq!((r.steps_balanced, r.steps_quality), (25, 50));- }-- #[test]- fn sdcpp_example_settings_move_to_official() {- let dir = tempfile::tempdir().unwrap();- let p = dir.path().join("config.json");- let old = r#"{"schemaVersion":3,"profiles":[{"id":"a","recommendedSettings":{"cfg":6.0,"cfg_edit":4.0,"steps_fast":20,"steps_balanced":20,"steps_quality":20,"area_quality":2000000}}]}"#;- std::fs::write(&p, old).unwrap();- let r = AppConfig::load_from(&p).profiles[0].recommended_settings.clone();- assert_eq!((r.cfg, r.cfg_edit), (1.0, 1.0));- assert_eq!((r.steps_fast, r.steps_balanced, r.steps_quality, r.area_quality), (20, 20, 20, 2048 * 2048));- assert_eq!(r, RecommendedSettings::default());- let custom = r#"{"schemaVersion":3,"profiles":[{"id":"a","recommendedSettings":{"cfg":3.0,"cfg_edit":2.5,"steps_balanced":28}}]}"#;- std::fs::write(&p, custom).unwrap();- let r = AppConfig::load_from(&p).profiles[0].recommended_settings.clone();- assert_eq!((r.cfg, r.cfg_edit, r.steps_balanced), (3.0, 2.5, 28));+ let c = AppConfig::load_from(&p);+ let off = c.profile();+ assert_eq!(off.diffusion_model, crate::catalog::join_rel(Path::new(r"D:\sd"), "models/qwen21/qwen-image-2.1-turbo-Q4_K.gguf"));+ assert_eq!(off.display_name, "Qwen-Image 2.1 Turbo Q4_K (official)");+ assert_eq!(off.backend_args, vec!["--x".to_string()], "launch flags stay");+ assert_eq!(off.recommended_settings, RecommendedSettings::default());+ let mine = c.profiles.iter().find(|p| p.id == "mine").unwrap();+ assert_eq!(mine.diffusion_model, PathBuf::from(r"D:\sd\mine.gguf"), "other profiles keep their model");+ assert_eq!(mine.recommended_settings, RecommendedSettings::default());+ assert_eq!(c.schema_version, SCHEMA_VERSION);}#[test]@@ -850,8 +741,7 @@ mod tests {assert!(c.upscaler_file().is_none());// Older config files without the new fields keep loading with defaults.let old: AppConfig = serde_json::from_str(r#"{"serverPort": 41000, "vaeTileSize": 512}"#).unwrap();- assert_eq!(old.refine_mode, RefineMode::Fast);- assert_eq!(old.profile().recommended_settings.hires_max_area, 2048 * 1152);+ assert_eq!(old.profile().recommended_settings.area_quality, 2048 * 2048);}#[test]diff --git a/crates/qls-core/src/engine.rs b/crates/qls-core/src/engine.rsindex ea90562..dcd6236 100644--- a/crates/qls-core/src/engine.rs+++ b/crates/qls-core/src/engine.rs@@ -4,7 +4,6 @@use std::collections::{HashMap, VecDeque};use std::path::{Path, PathBuf};-use std::sync::atomic::{AtomicBool, Ordering};use std::sync::{Arc, Mutex, RwLock};use std::time::{Duration, Instant};@@ -19,7 +18,7 @@ use crate::geometry::Size;use crate::imaging::{self, LoadedImage};use crate::paths;use crate::pipeline;-use crate::planner::{self, GenerationRequest, Mode, OutputFormat, Plan, PlanInputs, ResolutionMode, ResolvedMode, UpscaleMethod};+use crate::planner::{self, GenerationRequest, Mode, OutputFormat, Plan, PlanInputs, ResolutionMode, ResolvedMode};use crate::process::{BackendProgress, BackendStage, ProgressParser, ServerManager, ServerState};use crate::sdcpp::{BackendJobStatus, CancelOutcome, SdcppClient, UpscaleRequest};use crate::store::{GenerationRecord, InputRecord, PipelineRecord, ReferenceRecord, Store, new_id, now_rfc3339};@@ -87,9 +86,6 @@ pub enum Event {pub struct Engine {cfg: RwLock<AppConfig>,- /// The server should run the Turbo model (the last job's choice; Turbo is the default),- /// so starting it ahead of a job loads the model that job will most likely need.- prefer_turbo: AtomicBool,pub server: Arc<ServerManager>,pub store: Arc<Store>,/// Private mode: records in memory, files under `private_dir`; wiped by `clear_private`,@@ -128,13 +124,11 @@ pub fn plan_inputs(cfg: &AppConfig, image_sizes: Vec<Size>, mask: Option<(Size,mask,vram_total_mib,upscaler: cfg.upscaler_file().map(|_| cfg.upscaler_model.trim().to_string()),- refine: cfg.refine_mode,server_vae_tiling: cfg.vae_tile_size > 0,sage_attention: cfg.uses_sage_attention(),speed_factor: None,hide_uncalibrated: !crate::speed::trust_uncalibrated(cfg),unified_memory: false,- turbo_available: cfg.turbo_model().is_some(),}}@@ -165,7 +159,6 @@ impl Engine {installer: crate::installer::Installer::new(),backend_version: Mutex::new(None),last_activity: Mutex::new(Instant::now()),- prefer_turbo: AtomicBool::new(true),}))}@@ -337,14 +330,7 @@ impl Engine {created_at: now_rfc3339(),started_at: None,finished_at: None,- prompt: if upscale && request.prompt.trim().is_empty() {- match request.upscale.map(|u| u.method).unwrap_or_default() {- UpscaleMethod::Quick => "Upscale (Quick)".into(),- UpscaleMethod::Detailed => "Upscale (Detailed)".into(),- }- } else {- request.prompt.clone()- },+ prompt: if upscale && request.prompt.trim().is_empty() { "Upscale".into() } else { request.prompt.clone() },client: request.client.clone(),plan: None,seed: request.seed,@@ -471,16 +457,6 @@ impl Engine {Ok((img, rec))}- /// The configuration to start the server with: the Turbo model when the last job used it- /// (or no job ran yet) and it is installed, otherwise the active profile's model.- pub fn server_config(&self) -> AppConfig {- self.server_config_for(&self.config(), self.prefer_turbo.load(Ordering::Relaxed))- }-- fn server_config_for(&self, cfg: &AppConfig, turbo: bool) -> AppConfig {- turbo.then(|| cfg.with_turbo()).flatten().unwrap_or_else(|| cfg.clone())- }-/// How this machine's measured speed compares with the time model (None: not measured).fn speed_factor(&self, cfg: &AppConfig) -> Option<f32> {self.speed.get(&crate::speed::machine_key(cfg, self.gpu().as_ref())).map(|c| c.factor)@@ -546,7 +522,7 @@ impl Engine {let seed = request.seed.unwrap_or_else(random_seed);let mut request = request;if plan.mode == ResolvedMode::Upscale && request.prompt.trim().is_empty() {- request.prompt = self.upscale_prompt(&request, plan.steps == 0);+ request.prompt = self.upscale_prompt(&request);}self.update(id, |j| {j.view.plan = Some(plan.clone());@@ -556,16 +532,13 @@ impl Engine {// 3. Backend.// A job that also starts the server is not a fair speed sample (startup, first load).- // Turbo runs on its own diffusion model: switching restarts the server with the other one.- self.prefer_turbo.store(plan.turbo, Ordering::Relaxed);- let run_cfg = self.server_config_for(&cfg, plan.turbo);- let model_loaded = self.server.capabilities().is_some_and(|c| c.model_matches(&run_cfg.profile().diffusion_model));+ let model_loaded = self.server.capabilities().is_some_and(|c| c.model_matches(&profile.diffusion_model));let mut cold_start = false;if self.server.status().state != ServerState::Ready || self.server.owned_alive() == Some(false) || !model_loaded {cold_start = true;self.update(id, |j| j.view.status = JobStatus::StartingBackend);self.emit_server();- let r = self.server.ensure_ready(&run_cfg).await;+ let r = self.server.ensure_ready(&cfg).await;self.emit_server();r?;}@@ -587,7 +560,7 @@ impl Engine {j.view.notes.push(format!("Upscaler model {} not found; enlarged with Lanczos. Put {}.pth in the upscalers folder for sharper results.", cfg.upscaler_model, cfg.upscaler_model))});}- let quick_upscale = plan.upscale.map(|u| u.method == UpscaleMethod::Quick).unwrap_or(false);+ let quick_upscale = plan.upscale.is_some();let icc = images.first().and_then(|i| i.icc_profile.clone());let (contents, post) = if quick_upscale {@@ -605,19 +578,6 @@ impl Engine {};(vec![src.pixels], post)} else {- let mut images = images;- if plan.upscale.is_some() {- // Detailed: bring the source to the refine size first (ESRGAN when enlarging).- let target = Size::new(plan.content.width, plan.content.height);- let src = std::mem::replace(&mut images[0].pixels, image::RgbaImage::new(1, 1));- let (enlarged, _) = self.enlarge(id, &client, src, Some(target), esrgan.as_deref()).await?;- images[0].pixels = enlarged;- self.update(id, |j| {- j.view.status = JobStatus::Preparing;- j.view.stage = None;- });- }-// 4. Build the request (CPU work).let plan2 = plan.clone();let prompt = request.prompt.clone();@@ -658,7 +618,7 @@ impl Engine {}}if self.is_cancelled(id) {- return self.cancel_running(id, &client, &accepted.id, &self.server_config()).await;+ return self.cancel_running(id, &client, &accepted.id, &self.config()).await;}if last_poll.elapsed() >= Duration::from_millis(500) {last_poll = Instant::now();@@ -745,7 +705,7 @@ impl Engine {refine_steps: None,refine_denoise: None,hires_upscaler: None,- cache_threshold: plan.cache_threshold,+ cache_threshold: None,enlarged_from: enlarged_with.is_some().then_some(before),enlarged_with,};@@ -777,15 +737,12 @@ impl Engine {Ok(())}- /// Prompt for an upscale request that has none: the source's own prompt for- /// text-to-image results, otherwise a neutral description (an edit instruction such- /// as "make it darker" would keep pushing the image during the refine).- fn upscale_prompt(&self, req: &GenerationRequest, quick: bool) -> String {+ /// Label of an upscale request that has no prompt: the source's own prompt, if any.+ fn upscale_prompt(&self, req: &GenerationRequest) -> String {let source = req.images.first().and_then(|s| s.strip_prefix("gen:")).and_then(|g| self.gen_store(g).get_generation(g).ok());match source {- Some(g) if g.mode == "generate" || (quick && !g.prompt.trim().is_empty()) => g.prompt,- _ if quick => "Upscaled image".into(),- _ => planner::UPSCALE_PROMPT.into(),+ Some(g) if !g.prompt.trim().is_empty() => g.prompt,+ _ => "Upscaled image".into(),}}@@ -958,7 +915,7 @@ impl Engine {working_height: plan.working.height,model: cfg.profile().model_name(),sampler: plan.sampler.clone(),- scheduler: plan.scheduler.clone(),+ scheduler: None,steps: plan.steps,cfg: plan.cfg,strength: plan.strength,@@ -1093,7 +1050,6 @@ pub fn write_atomic(path: &Path, bytes: &[u8]) -> AppResult<()> {#[cfg(test)]mod tests {use super::*;- use crate::config::RefineMode;/// End to end on a real iPhone HEIC (QLS_TEST_HEIC, ffmpeg on PATH): import, simulated/// edit (left half 2 stops darker), HDR decision and Ultra HDR file. QLS_TEST_OUT keeps it.@@ -1177,7 +1133,7 @@ mod tests {let up = GenerationRequest { mode: Mode::Upscale, ..Default::default() };assert!(e.submit(up.clone(), None).is_err());let j3 = e.submit(GenerationRequest { images: vec!["gen:x".into()], ..up }, None).unwrap();- assert_eq!(j3.prompt, "Upscale (Quick)");+ assert_eq!(j3.prompt, "Upscale");// Closing the desktop app cancels only its own jobs.let ui = e.submit(GenerationRequest { prompt: "ui job".into(), client: Some("ui".into()), ..Default::default() }, None).unwrap();let mcp = e.submit(GenerationRequest { prompt: "mcp job".into(), client: Some("mcp".into()), ..Default::default() }, None).unwrap();@@ -1221,14 +1177,11 @@ mod tests {let i = plan_inputs(&cfg, vec![], None, Some(16303));assert_eq!(i.upscaler, None, "no model file -> Lanczos");assert!(i.server_vae_tiling && i.sage_attention);- assert_eq!(i.refine, RefineMode::Fast);std::fs::write(dir.path().join("4x-UltraSharp.pth"), b"x").unwrap();cfg.vae_tile_size = 0;- cfg.refine_mode = RefineMode::Best;let i = plan_inputs(&cfg, vec![], None, None);assert_eq!(i.upscaler.as_deref(), Some("4x-UltraSharp"));assert!(!i.server_vae_tiling);- assert_eq!(i.refine, RefineMode::Best);}#[test]diff --git a/crates/qls-core/src/pipeline.rs b/crates/qls-core/src/pipeline.rsindex 0ccd287..1ea3baf 100644--- a/crates/qls-core/src/pipeline.rs+++ b/crates/qls-core/src/pipeline.rs@@ -169,16 +169,16 @@ pub fn prepare(plan: &Plan, prompt: &str, seed: i64, images: &[LoadedImage], masimage_preprocess: Vec::new(),sample_params: SampleParams {sample_method: Some(plan.sampler.clone()),- scheduler: plan.scheduler.clone(),+ scheduler: None,sample_steps: plan.steps,- flow_shift: plan.flow_shift,+ flow_shift: None,custom_sigmas: plan.custom_sigmas.clone(),guidance: Guidance { txt_cfg: plan.cfg, img_cfg: None },},vae_tiling_params: vae_tiling_params(plan.vae_tiling, opts.server_vae_tile_size),hires: None,- cache_mode: plan.cache_threshold.map(|_| "easycache".to_string()),- cache_option: plan.cache_threshold.map(|t| format!("threshold={t}")),+ cache_mode: None,+ cache_option: None,output_format: "png".into(),embed_image_metadata: false,};@@ -276,17 +276,7 @@ pub fn prepare(plan: &Plan, prompt: &str, seed: i64, images: &[LoadedImage], mas.round() as u32;kind = PostKind::Outpaint { source: src.clone(), feather: feather_final.max(2) };}- ResolvedMode::Upscale => {- // Detailed upscale: plain img2img over the (already enlarged) image.- need_images(1)?;- if plan.steps == 0 {- return Err(AppError::internal("a quick upscale has no diffusion request"));- }- let canvas = to_canvas(&images[0].pixels, &plan.references[0].canvas);- req.init_image = Some(png_b64(&canvas)?);- req.strength = plan.strength;- req.image_preprocess = vec!["target=init,mode=none".into()];- }+ ResolvedMode::Upscale => return Err(AppError::internal("an upscale has no diffusion request")),}Ok(PreparedJob {@@ -482,8 +472,7 @@ mod tests {use super::*;use crate::config::RecommendedSettings;use crate::geometry::ExpansionUnits;- use crate::config::RefineMode;- use crate::planner::{GenerationRequest, Mode, OutpaintSpec, PlanInputs, Quality, ResolutionMode, UpscaleMethod, UpscaleSpec, plan};+ use crate::planner::{GenerationRequest, Mode, OutpaintSpec, PlanInputs, Quality, ResolutionMode, UpscaleSpec, plan};use crate::sdcpp::b64_decode;fn env(sizes: Vec<Size>) -> PlanInputs {@@ -516,14 +505,14 @@ mod tests {let mut r = req("a cozy mountain cabin");r.aspect_ratio = Some("16:9".into());r.quality = Quality::Quality;- r.advanced.refine = Some(RefineMode::Best);let p = plan(&r, &env(vec![]), &RecommendedSettings::default()).unwrap();let j = prepare(&p, &r.prompt, 42, &[], None, &esrgan_opts()).unwrap();let v = serde_json::to_value(&j.request).unwrap();assert_eq!((v["width"].as_u64(), v["height"].as_u64()), (Some(p.working.width as u64), Some(p.working.height as u64)));assert!(v.get("hires").map(|h| h.is_null()).unwrap_or(true), "no second pass");assert!(v.get("cache_mode").map(|c| c.is_null()).unwrap_or(true));- assert_eq!(v["sample_params"]["sample_steps"], 20);+ assert_eq!(v["sample_params"]["sample_steps"], 8);+ assert_eq!(v["sample_params"]["custom_sigmas"].as_array().unwrap().len(), 9, "Turbo's schedule");assert_eq!(v["sample_params"]["guidance"]["txt_cfg"], 1.0, "official: no CFG");assert!(p.working.area() > 2_500_000, "Quality renders toward native 2K: {:?}", p.working);}@@ -549,26 +538,11 @@ mod tests {}#[test]- fn detailed_upscale_is_img2img_at_2k() {+ fn upscales_never_reach_img_gen() {let img = photo(1376, 768);- let r = GenerationRequest {- mode: Mode::Upscale,- upscale: Some(UpscaleSpec { method: UpscaleMethod::Detailed, width: Some(5120), height: Some(2880), scale: None }),- preserve_dimensions: true,- ..Default::default()- };+ let r = GenerationRequest { mode: Mode::Upscale, upscale: Some(UpscaleSpec { width: Some(5120), ..Default::default() }), ..Default::default() };let p = plan(&r, &env(vec![img.size()]), &RecommendedSettings::default()).unwrap();- let j = prepare(&p, crate::planner::UPSCALE_PROMPT, 9, std::slice::from_ref(&img), None, &esrgan_opts()).unwrap();- assert_eq!((j.request.width, j.request.height), (2048, 1152));- assert_eq!(decode(j.request.init_image.as_ref().unwrap()).dimensions(), (2048, 1152));- assert!(j.request.ref_images.is_empty() && j.request.mask_image.is_none() && j.request.hires.is_none());- assert_eq!(j.request.strength, Some(0.3));- assert_eq!(j.request.image_preprocess, vec!["target=init,mode=none".to_string()]);- assert_eq!(enlarge_target(&j.post), Some(Size::new(5120, 2880)));-- let quick = GenerationRequest { upscale: Some(UpscaleSpec::default()), ..r };- let p = plan(&quick, &env(vec![img.size()]), &RecommendedSettings::default()).unwrap();- assert!(prepare(&p, "", 9, std::slice::from_ref(&img), None, &esrgan_opts()).is_err(), "quick upscales never reach img_gen");+ assert!(prepare(&p, "", 9, std::slice::from_ref(&img), None, &esrgan_opts()).is_err(), "the upscaler model only");}#[test]@@ -683,7 +657,6 @@ mod tests {let img = photo(1920, 1080);let mut r = req("make it night");r.resolution = ResolutionMode::Source;- r.advanced.refine = Some(RefineMode::Off);let p = plan(&r, &PlanInputs { image_sizes: vec![img.size()], vram_total_mib: Some(16303), ..Default::default() }, &RecommendedSettings::default()).unwrap();let j = prepare(&p, &r.prompt, 7, std::slice::from_ref(&img), None, &BackendOptions::default()).unwrap();assert_eq!((j.request.width, j.request.height), (1920, 1088));@@ -879,9 +852,9 @@ mod tests {let v = serde_json::to_value(&j.request).unwrap();assert!(v.get("ref_images").is_none() && v.get("init_image").is_none());assert_eq!(v["seed"], 5);- assert_eq!(v["width"], 1536);- let out = postprocess(fake_backend(1536, 1536), &j.post).unwrap();- assert_eq!(out.dimensions(), (1536, 1536));+ assert_eq!(v["width"], 1024);+ let out = postprocess(fake_backend(1024, 1024), &j.post).unwrap();+ assert_eq!(out.dimensions(), (1024, 1024));}#[test]diff --git a/crates/qls-core/src/planner.rs b/crates/qls-core/src/planner.rsindex 9e798dd..556984e 100644--- a/crates/qls-core/src/planner.rs+++ b/crates/qls-core/src/planner.rs@@ -7,7 +7,7 @@ use std::sync::LazyLock;use regex::Regex;use serde::{Deserialize, Serialize};-use crate::config::{RecommendedSettings, RefineMode};+use crate::config::RecommendedSettings;use crate::error::{AppError, ErrorCode};use crate::geometry::{self, CanvasLimits, Expansion, ExpansionUnits, OutpaintPlan, Rect, Size, WorkingCanvas, aspect_label, dims_for_area,@@ -99,11 +99,11 @@ impl InpaintAction {#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]#[serde(rename_all = "snake_case")]pub enum UpscaleMethod {- /// ESRGAN only (seconds).+ /// The upscaler model (ESRGAN) only, straight from the image. "detailed" (a low-denoise+ /// diffusion refine, removed 2026-10-09: Turbo cannot refine at low strength) maps here.#[default]+ #[serde(alias = "detailed")]Quick,- /// Low-denoise img2img refine at up to ~2K, then ESRGAN to the target.- Detailed,}/// Target of an upscale job. Exact `width`+`height` win, then one side (aspect kept),@@ -123,22 +123,19 @@ pub struct UpscaleSpec {/// Largest upscale result: 8192 px per side (the ESRGAN endpoint's limit) and ~40 MP.pub const MAX_UPSCALE_SIDE: u32 = 8192;pub const MAX_UPSCALE_AREA: u64 = 40_000_000;-/// Denoise of the Detailed upscale refine (img2img).-pub const DETAILED_DENOISE: f32 = 0.3;-/// Prompt for refining images that have no usable description (inputs, edit results).-pub const UPSCALE_PROMPT: &str = "A sharp, highly detailed, high-quality image with clean fine textures.";#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]#[serde(rename_all = "snake_case")]pub enum Quality {+ /// ~1 MP (768² on Apple Silicon, then enlarged). Older versions' "turbo" maps here.+ #[default]+ #[serde(alias = "turbo")]Fast,+ /// ~1.5K.Balanced,+ /// Native 2K, Qwen's recommended size. Older versions' "ultra" (2K, 40 steps) maps here.+ #[serde(alias = "ultra")]Quality,- Ultra,- /// ~1 MP in 8 steps with Qwen's distilled Turbo model (`catalog::TURBO_Q4_K`). The- /// default; plans fall back to Balanced when the Turbo model is not installed.- #[default]- Turbo,}#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]@@ -194,19 +191,13 @@ pub struct OutpaintSpec {#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]#[serde(default)]pub struct AdvancedOptions {- pub steps: Option<u32>,- pub cfg: Option<f32>,pub sampler: Option<String>,- pub scheduler: Option<String>,/// Edit/inpaint denoising strength (0..1).pub strength: Option<f32>,pub batch_count: Option<u32>,pub output_format: Option<OutputFormat>,/// None = automatic.pub vae_tiling: Option<bool>,- pub flow_shift: Option<f32>,- /// Effort of a Detailed upscale (Fast or Best); None = the app setting.- pub refine: Option<RefineMode>,/// Keep the HDR gain map of a HEIC source (Ultra HDR JPEG output); None = on.pub hdr: Option<bool>,}@@ -292,13 +283,13 @@ pub struct Plan {pub working: Size,/// Content area inside `working` that maps to the output (rest is alignment padding).pub content: Rect,+ /// Sampling steps (Turbo's 8; 0 = no diffusion, a Quick upscale).pub steps: u32,+ /// Always 1 (Turbo runs without classifier-free guidance).pub cfg: f32,pub sampler: String,- pub scheduler: Option<String>,pub strength: Option<f32>,pub batch_count: u32,- pub flow_shift: Option<f32>,pub vae_tiling: bool,pub output_format: OutputFormat,pub negative_prompt: String,@@ -316,18 +307,12 @@ pub struct Plan {pub notes: Vec<String>,pub optimized_for_vram: bool,pub estimated_seconds: f32,- /// EasyCache threshold (Detailed upscale only); None = off.- #[serde(default)]- pub cache_threshold: Option<f32>,/// ESRGAN model used to enlarge the result; None = Lanczos.#[serde(default)]pub upscaler: Option<String>,#[serde(default)]pub upscale: Option<UpscalePlan>,- /// Run on the Turbo model instead of the profile's diffusion model.- #[serde(default)]- pub turbo: bool,- /// Exact noise schedule (Turbo); empty = the server's default for `steps`.+ /// Exact noise schedule (Turbo's); empty when no diffusion runs.#[serde(default)]pub custom_sigmas: Vec<f32>,}@@ -341,8 +326,6 @@ pub struct PlanInputs {pub vram_total_mib: Option<u64>,/// ESRGAN model available to the server (`AppConfig::upscaler_file`).pub upscaler: Option<String>,- /// App default effort of a Detailed upscale (per-job override in `AdvancedOptions::refine`).- pub refine: RefineMode,/// The server was launched with `--vae-tiling` (tiles every decode by default).pub server_vae_tiling: bool,/// SageAttention is enabled (faster steps; used for estimates only).@@ -355,8 +338,6 @@ pub struct PlanInputs {/// Apple Silicon (unified memory): the GPU is several times slower than the discrete/// cards the presets were tuned on, so Fast renders smaller (`UNIFIED_FAST_AREA`).pub unified_memory: bool,- /// The Turbo model is installed (`AppConfig::turbo_model`).- pub turbo_available: bool,}// ---------------------------------------------------------------------------------------@@ -509,9 +490,6 @@ pub fn resolution_area(mode: ResolutionMode, quality: Quality, rec: &RecommendedQuality::Fast => rec.area_fast,Quality::Balanced => rec.area_balanced,Quality::Quality => rec.area_quality,- Quality::Ultra => rec.area_ultra,- // ~1 MP, like the distillation's training and Fast.- Quality::Turbo => rec.area_fast,}),ResolutionMode::K1 => Some(1024 * 1024),ResolutionMode::K15 => Some(1536 * 1536),@@ -558,10 +536,12 @@ pub const UNIFIED_FAST_AREA: u64 = 768 * 768;pub const PIXELS_PER_TOKEN: u64 = 256; // 8x VAE downscale, 2x2 patches-/// Turbo's noise schedule: `sample_sigmas` of Qwen/Qwen-Image-2.1-Turbo's model_index.json+/// The noise schedule of every diffusion job: `sample_sigmas` of Qwen/Qwen-Image-2.1-Turbo's model_index.json/// (8 steps, fixed at every resolution, no dynamic shift), sent verbatim because sd.cpp's/// own Qwen schedule shifts by resolution and has a 0.02 terminal shift.pub const TURBO_SIGMAS: [f32; 9] = [1.0, 0.978453, 0.95418, 0.926626, 0.89508, 0.845148, 0.704534, 0.414568, 0.0];+/// Turbo's step count (fixed: Qwen evaluated no other schedule).+pub const TURBO_STEPS: u32 = TURBO_SIGMAS.len() as u32 - 1;/// Area of the inpaint guide reference (the region with the painted area marked), as a/// share of the working canvas: enough to locate the area, cheap in tokens.@@ -569,7 +549,7 @@ pub const INPAINT_GUIDE_AREA: f64 = 0.25;/// Seconds per sampling step, from RTX 5070 Ti measurements at CFG 6 (two model passes per/// step): 1 MP ≈ 2.0 s (1.63 s with SageAttention), 2048x1152 ≈ 5.6 s (3.8 s with-/// SageAttention). CFG 1 runs one pass, so half of that (to re-measure).+/// SageAttention). CFG 1 (always, with Turbo) runs one pass, so half of that.fn step_seconds(tokens: f32, ref_tokens: f32, sage: bool, cfg: f32) -> f32 {let x = tokens / 4096.0;let base = if sage { 1.6 * x.powf(1.1) } else { 2.0 * x.powf(1.4) };@@ -594,32 +574,18 @@ fn decode_seconds(area: u64) -> f32 {}/// Rough wall-clock estimate of one diffusion job (single pass), excluding enlargement.-pub fn estimate_seconds(working: Size, refs: &[RefPlan], steps: u32, batch: u32, cache: bool, sage: bool, cfg: f32) -> f32 {+pub fn estimate_seconds(working: Size, refs: &[RefPlan], steps: u32, batch: u32, sage: bool, cfg: f32) -> f32 {let tokens = |s: Size| (s.area() / PIXELS_PER_TOKEN) as f32;let ref_tokens: f32 = refs.iter().map(|r| tokens(r.canvas.canvas)).sum();let encode = 4.0 + ref_tokens / 4096.0 * 3.0;- // EasyCache skipped ~1/3 of the refine steps in the 2K bench.- let cache_factor = if cache { 0.7 } else { 1.0 };- let t = encode + step_seconds(tokens(working), ref_tokens, sage, cfg) * steps as f32 * cache_factor;+ let t = encode + step_seconds(tokens(working), ref_tokens, sage, cfg) * steps as f32;(t + decode_seconds(working.area())) * batch as f32}/// Uncalibrated prediction of the backend part of a planned job (what `crate::speed`/// compares with the measured time): encode, sampling and decode, no enlargement.pub fn backend_seconds(p: &Plan, sage: bool) -> f32 {- let detailed = p.upscale.map(|u| u.method == UpscaleMethod::Detailed).unwrap_or(false);- let steps = if detailed { (p.steps as f32 * p.strength.unwrap_or(1.0)).ceil() as u32 } else { p.steps };- estimate_seconds(p.working, &p.references, steps, p.batch_count, p.cache_threshold.is_some(), sage, p.cfg)-}--fn steps_for(q: Quality, rec: &RecommendedSettings) -> u32 {- match q {- Quality::Fast => rec.steps_fast,- Quality::Balanced => rec.steps_balanced,- Quality::Quality => rec.steps_quality,- Quality::Ultra => rec.steps_ultra,- Quality::Turbo => TURBO_SIGMAS.len() as u32 - 1,- }+ estimate_seconds(p.working, &p.references, p.steps, p.batch_count, sage, p.cfg)}fn limits(max_area: u64, rec: &RecommendedSettings) -> CanvasLimits {@@ -730,30 +696,20 @@ pub fn plan(req: &GenerationRequest, inputs: &PlanInputs, rec: &RecommendedSettireturn Err(AppError::invalid("Describe what to generate or change."));}let mut notes = Vec::new();- // Turbo (the default) needs its model; without it the job runs as Balanced.- let quality = if req.quality == Quality::Turbo && !inputs.turbo_available {- notes.push("The Turbo model is not installed, so this used Balanced. Add it in Settings → Models → Set up models….".into());- Quality::Balanced- } else {- req.quality- };- // Turbo: its fixed schedule, CFG 1 (an upscale keeps its own settings).- let turbo = quality == Quality::Turbo && mode != ResolvedMode::Upscale;- let default_cfg = if mode == ResolvedMode::Generate { rec.cfg } else { rec.cfg_edit };- let cfg = if turbo { 1.0 } else { req.advanced.cfg.unwrap_or(default_cfg).clamp(0.0, 30.0) };+ let quality = req.quality;+ // Turbo: its fixed 8-step schedule without CFG (model card).+ let cfg = 1.0;let budget_tokens = token_budget(inputs.vram_total_mib);let budget_area = budget_tokens * PIXELS_PER_TOKEN;let tier_area = resolution_area(req.resolution, quality, rec);let adv = &req.advanced;- let mut steps = if turbo { steps_for(Quality::Turbo, rec) } else { adv.steps.unwrap_or_else(|| steps_for(quality, rec)).clamp(1, 150) };+ let mut steps = TURBO_STEPS;let batch_count = if mode == ResolvedMode::Upscale { 1 } else { adv.batch_count.unwrap_or(1).clamp(1, 8) };let mut optimized = false;// Largest area actually rendered; the output keeps its size and is enlarged afterwards.let render_cap = (inputs.unified_memory && quality == Quality::Fast && req.resolution == ResolutionMode::Auto).then_some(UNIFIED_FAST_AREA);// Diffusion always runs in one pass; larger outputs are enlarged with the upscaler// model (user A/B test, 2026-10-06: the two-pass refine made results worse).- // `refine` only sets the effort of a Detailed upscale.- let refine = adv.refine.unwrap_or(inputs.refine);let mut upscale = None;// Shared: cap an area by the VRAM budget given references totalling `n_refs` times it.@@ -878,23 +834,9 @@ pub fn plan(req: &GenerationRequest, inputs: &PlanInputs, rec: &RecommendedSettilet spec = req.upscale.unwrap_or_default();output = upscale_target(src, &spec)?;upscale = Some(UpscalePlan { method: spec.method, source: src });- match spec.method {- UpscaleMethod::Quick => {- // No diffusion: the "working" image is the source itself.- working = WorkingCanvas { source: src, content: src, canvas: src, content_offset: (0, 0), scale: 1.0 };- steps = 0;- }- UpscaleMethod::Detailed => {- // img2img at up to ~2K in the target's shape; the server trims the- // schedule by `strength`, so `steps` = effective steps / strength.- working = plan_working_canvas(output, &CanvasLimits { min_side: 64, ..limits(rec.hires_max_area.min(budget_area), rec) });- let s = adv.strength.unwrap_or(DETAILED_DENOISE).clamp(0.05, 1.0);- let effective = if refine == RefineMode::Best { rec.hires_steps_best } else { rec.hires_steps_fast };- steps = adv.steps.unwrap_or_else(|| (effective as f32 / s).ceil() as u32).clamp(1, 150);- strength = Some(s);- references.push(RefPlan { index: 0, source: src, canvas: working });- }- }+ // No diffusion: the upscaler model works on the source itself.+ working = WorkingCanvas { source: src, content: src, canvas: src, content_offset: (0, 0), scale: 1.0 };+ steps = 0;}ResolvedMode::Inpaint => {let src = inputs.image_sizes[0];@@ -952,7 +894,7 @@ pub fn plan(req: &GenerationRequest, inputs: &PlanInputs, rec: &RecommendedSetti}optimized |= sources_reduced;- let quick_upscale = upscale.map(|u| u.method == UpscaleMethod::Quick).unwrap_or(false);+ let quick_upscale = upscale.is_some();if !quick_upscale && !working.canvas.is_aligned(rec.align) {return Err(AppError::new(ErrorCode::Internal, "Working size is not aligned.").detail(format!("{:?}", working.canvas)));}@@ -976,33 +918,21 @@ pub fn plan(req: &GenerationRequest, inputs: &PlanInputs, rec: &RecommendedSettiinputs.upscaler.as_deref().unwrap_or("Lanczos")));}- let detailed_upscale = upscale.map(|u| u.method == UpscaleMethod::Detailed).unwrap_or(false);- let cache_threshold = (detailed_upscale && refine != RefineMode::Best).then_some(rec.easycache_threshold);// Results are enlarged with ESRGAN when the model exists (Lanczos otherwise).let enlarge = output.area() as f64 > working.content.area() as f64 * 1.21;- // img2img only runs the last `strength` share of the schedule.- let sampled_steps = if detailed_upscale { (steps as f32 * strength.unwrap_or(1.0)).ceil() as u32 } else { steps };- let mut estimated_seconds = if quick_upscale {- 2.0- } else {- estimate_seconds(working.canvas, &references, sampled_steps, batch_count, cache_threshold.is_some(), inputs.sage_attention, cfg)- };- if inputs.upscaler.is_some() {- if enlarge || quick_upscale {- estimated_seconds += esrgan_seconds(working.content.area()) * batch_count as f32;- }- if detailed_upscale && working.content.area() as f64 > inputs.image_sizes[0].area() as f64 * 1.21 {- estimated_seconds += esrgan_seconds(inputs.image_sizes[0].area());- }+ let mut estimated_seconds =+ if quick_upscale { 2.0 } else { estimate_seconds(working.canvas, &references, steps, batch_count, inputs.sage_attention, cfg) };+ if inputs.upscaler.is_some() && (enlarge || quick_upscale) {+ estimated_seconds += esrgan_seconds(working.content.area()) * batch_count as f32;}estimated_seconds = match inputs.speed_factor {Some(f) => estimated_seconds * f,None if inputs.hide_uncalibrated => 0.0,None => estimated_seconds,};- let negative_prompt = req.negative_prompt.clone().unwrap_or_else(|| rec.negative_prompt.clone());- if !negative_prompt.trim().is_empty() && !uses_guidance(cfg) && !quick_upscale {- notes.push("The negative prompt is ignored at CFG 1; raise CFG in Advanced to use it.".into());+ let negative_prompt = req.negative_prompt.clone().unwrap_or_default();+ if !negative_prompt.trim().is_empty() && !quick_upscale {+ notes.push("The negative prompt is ignored: Turbo runs without CFG.".into());}Ok(Plan {mode,@@ -1015,10 +945,8 @@ pub fn plan(req: &GenerationRequest, inputs: &PlanInputs, rec: &RecommendedSettisteps,cfg,sampler: adv.sampler.clone().filter(|s| !s.is_empty()).unwrap_or_else(|| rec.sampler.clone()),- scheduler: adv.scheduler.clone().filter(|s| !s.is_empty() && s != "default").or_else(|| rec.scheduler.clone()),strength,batch_count,- flow_shift: adv.flow_shift,vae_tiling,output_format: adv.output_format.unwrap_or_default(),negative_prompt,@@ -1031,11 +959,9 @@ pub fn plan(req: &GenerationRequest, inputs: &PlanInputs, rec: &RecommendedSettinotes,optimized_for_vram: optimized,estimated_seconds,- cache_threshold,upscaler: inputs.upscaler.clone(),upscale,- custom_sigmas: if turbo { TURBO_SIGMAS.to_vec() } else { Vec::new() },- turbo,+ custom_sigmas: if quick_upscale { Vec::new() } else { TURBO_SIGMAS.to_vec() },})}@@ -1096,35 +1022,28 @@ mod tests {assert!(p.auto_mode);assert_eq!(p.output, Size::new(1536, 1536), "Balanced = 1.5K");assert_eq!(p.working, Size::new(1536, 1536));- assert_eq!((p.steps, p.cfg, p.sampler.as_str()), (20, 1.0, "euler"), "20 steps, no CFG (official)");+ assert_eq!((p.steps, p.cfg, p.sampler.as_str()), (8, 1.0, "euler"), "Turbo: 8 steps, no CFG (official)");assert!(p.vae_tiling, "decodes above ~1.5 MP are tiled");assert!(p.references.is_empty());}#[test]- fn turbo_is_the_default_and_uses_its_model_and_schedule() {- assert_eq!(GenerationRequest::default().quality, Quality::Turbo, "the default");- let mut r = req("a lighthouse at dusk");- r.quality = Quality::Turbo;- r.advanced.cfg = Some(4.0);- r.advanced.steps = Some(30);- let i = PlanInputs { turbo_available: true, ..inputs(&[]) };- let p = plan(&r, &i, &rec()).unwrap();- assert_eq!(p.working, Size::new(1024, 1024), "~1 MP");- assert_eq!((p.steps, p.cfg, p.turbo), (8, 1.0, true), "fixed steps, no CFG");- assert_eq!(p.custom_sigmas, TURBO_SIGMAS.to_vec());- // Edits too; other qualities never run on the Turbo model.- let p = plan(&r, &PlanInputs { turbo_available: true, ..inputs(&[(1200, 800)]) }, &rec()).unwrap();- assert!(p.turbo && p.custom_sigmas.len() == 9);- r.quality = Quality::Fast;- let p = plan(&r, &i, &rec()).unwrap();- assert!(!p.turbo && p.custom_sigmas.is_empty());- // Not installed: Balanced, with a note.- r.quality = Quality::Turbo;- r.advanced = Default::default();- let p = plan(&r, &inputs(&[]), &rec()).unwrap();- assert!(!p.turbo && p.quality == Quality::Balanced && p.steps == 20);- assert!(p.notes.iter().any(|n| n.contains("Turbo model is not installed")));+ fn every_job_runs_turbos_schedule() {+ assert_eq!(GenerationRequest::default().quality, Quality::Fast, "the default");+ for q in [Quality::Fast, Quality::Balanced, Quality::Quality] {+ for sizes in [&[][..], &[(1200, 800)][..], &[(1200, 800), (900, 900)][..]] {+ let mut r = req("a lighthouse at dusk");+ r.quality = q;+ let p = plan(&r, &inputs(sizes), &rec()).unwrap();+ assert_eq!((p.steps, p.cfg), (8, 1.0), "{q:?}: fixed steps, no CFG");+ assert_eq!(p.custom_sigmas, TURBO_SIGMAS.to_vec());+ }+ }+ let r = req("a lighthouse at dusk");+ assert_eq!(plan(&GenerationRequest { quality: Quality::Fast, ..r }, &inputs(&[]), &rec()).unwrap().working, Size::new(1024, 1024), "Fast = ~1 MP");+ // Older clients' quality names still load.+ let q = |s: &str| serde_json::from_str::<Quality>(s).unwrap();+ assert_eq!((q(r#""turbo""#), q(r#""ultra""#), q(r#""quality""#)), (Quality::Fast, Quality::Quality, Quality::Quality));}#[test]@@ -1150,16 +1069,13 @@ mod tests {}#[test]- fn negative_prompt_needs_cfg() {+ fn negative_prompt_is_ignored() {let mut r = req("a lighthouse at dusk");r.negative_prompt = Some("blurry".into());let p = plan(&r, &inputs(&[]), &rec()).unwrap();assert_eq!(p.negative_prompt, "blurry", "still sent; the server ignores it at CFG 1");assert!(p.notes.iter().any(|n| n.contains("negative prompt is ignored")));- r.advanced.cfg = Some(4.0);- let p = plan(&r, &inputs(&[]), &rec()).unwrap();- assert!(!p.notes.iter().any(|n| n.contains("negative prompt")));- assert!(p.estimated_seconds > plan(&req("a lighthouse at dusk"), &inputs(&[]), &rec()).unwrap().estimated_seconds * 1.6, "CFG > 1 doubles the steps' cost");+ assert!(!plan(&req("a fox"), &inputs(&[]), &rec()).unwrap().notes.iter().any(|n| n.contains("negative prompt")));}#[test]@@ -1185,21 +1101,14 @@ mod tests {r.resolution = ResolutionMode::Auto;r.quality = Quality::Fast;let p = plan(&r, &inputs(&[]), &rec()).unwrap();- assert_eq!(p.steps, 20);assert!(p.output.area() <= 1_100_000);r.quality = Quality::Balanced;let p = plan(&r, &inputs(&[]), &rec()).unwrap();- assert_eq!(p.steps, 20);assert!(p.output.area() > 1_100_000 && p.output.area() <= 1536 * 1536 * 102 / 100, "Balanced = about 1.5K");r.quality = Quality::Quality;let p = plan(&r, &inputs(&[]), &rec()).unwrap();- assert_eq!(p.steps, 20);assert_eq!(p.working, Size::new(2752, 1536), "Quality = official native 2K bucket");assert_eq!(p.output, p.working);- r.quality = Quality::Ultra;- let p = plan(&r, &inputs(&[]), &rec()).unwrap();- assert_eq!(p.steps, 40, "Ultra = official 40 steps");- assert_eq!(p.working, Size::new(2752, 1536));}#[test]@@ -1249,27 +1158,23 @@ mod tests {assert!(p.notes.iter().any(|n| n.contains("enlarged to 4032×3024")));}- fn env(upscaler: bool, refine: RefineMode) -> PlanInputs {- PlanInputs { upscaler: upscaler.then(|| "RealESRGAN_x4plus".to_string()), refine, sage_attention: true, ..inputs(&[]) }+ fn env(upscaler: bool) -> PlanInputs {+ PlanInputs { upscaler: upscaler.then(|| "RealESRGAN_x4plus".to_string()), sage_attention: true, ..inputs(&[]) }}#[test]fn generation_is_always_one_pass() {- // Any refine setting, any size: one diffusion pass, no cache.- for refine in [RefineMode::Off, RefineMode::Fast, RefineMode::Best] {- for (res, aspect) in [(ResolutionMode::Auto, "16:9"), (ResolutionMode::K15, "1:1"), (ResolutionMode::K2, "9:16")] {- for q in [Quality::Fast, Quality::Balanced, Quality::Quality, Quality::Ultra] {- let mut r = req("a cozy mountain cabin");- r.aspect_ratio = Some(aspect.into());- r.resolution = res;- r.quality = q;- r.advanced.refine = Some(refine);- let p = plan(&r, &env(true, refine), &rec()).unwrap();- assert_eq!(p.cache_threshold, None, "{res:?} {aspect} {q:?}");- assert!(!p.notes.iter().any(|n| n.contains("Two passes")));- assert!(p.working.is_aligned(32));- assert!(p.working.area() as f64 <= (token_budget(Some(16303)) * 256) as f64 * 1.02, "{:?}", p.working);- }+ // Any size: one diffusion pass within the budget.+ for (res, aspect) in [(ResolutionMode::Auto, "16:9"), (ResolutionMode::K15, "1:1"), (ResolutionMode::K2, "9:16")] {+ for q in [Quality::Fast, Quality::Balanced, Quality::Quality] {+ let mut r = req("a cozy mountain cabin");+ r.aspect_ratio = Some(aspect.into());+ r.resolution = res;+ r.quality = q;+ let p = plan(&r, &env(true), &rec()).unwrap();+ assert!(!p.notes.iter().any(|n| n.contains("Two passes")), "{res:?} {aspect} {q:?}");+ assert!(p.working.is_aligned(32));+ assert!(p.working.area() as f64 <= (token_budget(Some(16303)) * 256) as f64 * 1.02, "{:?}", p.working);}}}@@ -1280,7 +1185,7 @@ mod tests {let mut r = req("a city at night");r.aspect_ratio = Some("16:9".into());r.resolution = ResolutionMode::K2;- let p = plan(&r, &env(true, RefineMode::Fast), &rec()).unwrap();+ let p = plan(&r, &env(true), &rec()).unwrap();assert_eq!(p.output, Size::new(2752, 1536));assert!(p.vae_tiling, "large decode is tiled");@@ -1289,7 +1194,7 @@ mod tests {r.resolution = ResolutionMode::Custom;r.width = Some(3840);r.height = Some(2160);- let p = plan(&r, &env(true, RefineMode::Fast), &rec()).unwrap();+ let p = plan(&r, &env(true), &rec()).unwrap();assert_eq!(p.output, Size::new(3840, 2160), "exact requested size is delivered");assert!(p.working.area() as f64 <= (token_budget(Some(16303)) * 256) as f64 * 1.02, "alignment padding only");assert!((p.content.width as f64 / p.content.height as f64 / (3840.0 / 2160.0) - 1.0).abs() < 0.01);@@ -1298,7 +1203,7 @@ mod tests {#[test]fn edits_are_one_pass_and_enlarged_to_the_source() {- let i = PlanInputs { image_sizes: vec![Size::new(5120, 2880)], ..env(true, RefineMode::Fast) };+ let i = PlanInputs { image_sizes: vec![Size::new(5120, 2880)], ..env(true) };let mut r = req("make it a dark version");r.quality = Quality::Fast;let p = plan(&r, &i, &rec()).unwrap();@@ -1306,7 +1211,7 @@ mod tests {assert_eq!(p.working, Size::new(1376, 768));assert_eq!(p.references[0].canvas.canvas, p.working);assert_eq!(p.output, Size::new(5120, 2880));- assert_eq!((p.steps, p.cfg), (20, 1.0));+ assert_eq!((p.steps, p.cfg), (8, 1.0));let esrgan = p.estimated_seconds;let p2 = plan(&r, &PlanInputs { upscaler: None, ..i.clone() }, &rec()).unwrap();assert!(esrgan > p2.estimated_seconds, "the enlargement is included in the estimate");@@ -1317,9 +1222,9 @@ mod tests {fn quality_edit_shares_the_2k_budget_with_its_reference() {let mut r = req("remove the people");r.quality = Quality::Quality;- let i = PlanInputs { image_sizes: vec![Size::new(5712, 4284)], ..env(true, RefineMode::Best) };+ let i = PlanInputs { image_sizes: vec![Size::new(5712, 4284)], ..env(true) };let p = plan(&r, &i, &rec()).unwrap();- assert_eq!((p.steps, p.cfg, p.cache_threshold), (20, 1.0, None));+ assert_eq!((p.steps, p.cfg), (8, 1.0));// Native 2K plus a 2K reference exceeds 16 GB: both get half the budget (~2 MP each).// Each side rounds to 32 px, so allow the same 5 % slack as many_references_share_the_budget.assert!((1_850_000..=2_202_010).contains(&p.working.area()), "{:?}", p.working);@@ -1377,7 +1282,7 @@ mod tests {fn many_references_share_the_budget() {let mut r = req("combine");r.resolution = ResolutionMode::Source;- let i = PlanInputs { image_sizes: vec![Size::new(3000, 2000), Size::new(2000, 2000), Size::new(2000, 2000)], ..env(true, RefineMode::Fast) };+ let i = PlanInputs { image_sizes: vec![Size::new(3000, 2000), Size::new(2000, 2000), Size::new(2000, 2000)], ..env(true) };let p = plan(&r, &i, &rec()).unwrap();assert!(p.optimized_for_vram);let total: u64 = p.working.area() + p.references.iter().map(|r| r.canvas.canvas.area()).sum::<u64>();@@ -1401,32 +1306,17 @@ mod tests {#[test]fn upscale_plans() {let mut r = GenerationRequest { mode: Mode::Upscale, upscale: Some(UpscaleSpec { scale: Some(2.0), ..Default::default() }), ..Default::default() };- let i = PlanInputs { image_sizes: vec![Size::new(1376, 768)], ..env(true, RefineMode::Fast) };+ let i = PlanInputs { image_sizes: vec![Size::new(1376, 768)], ..env(true) };let p = plan(&r, &i, &rec()).unwrap();assert_eq!(p.mode, ResolvedMode::Upscale);assert_eq!(p.output, Size::new(2752, 1536));assert_eq!(p.steps, 0, "Quick runs no diffusion");assert_eq!(p.working, Size::new(1376, 768));- assert!(p.cache_threshold.is_none());+ assert!(p.custom_sigmas.is_empty() && p.references.is_empty());assert!(p.estimated_seconds < 20.0, "{}", p.estimated_seconds);- r.upscale = Some(UpscaleSpec { method: UpscaleMethod::Detailed, width: Some(5120), height: Some(2880), ..Default::default() });- let p = plan(&r, &i, &rec()).unwrap();- assert_eq!(p.output, Size::new(5120, 2880));- assert_eq!(p.working, Size::new(2048, 1152), "refine at ~2K in the target's shape");- assert_eq!(p.strength, Some(DETAILED_DENOISE));- assert_eq!(p.steps, 20, "6 effective steps at denoise 0.3");- assert_eq!(p.cfg, 1.0);- assert_eq!(p.cache_threshold, Some(0.2));- assert_eq!(p.batch_count, 1);- assert_eq!(p.references.len(), 1);-- r.advanced.refine = Some(RefineMode::Best);- let p = plan(&r, &i, &rec()).unwrap();- assert_eq!((p.steps, p.cache_threshold), (27, None));-r.mode = Mode::Upscale;- assert!(plan(&r, &env(true, RefineMode::Fast), &rec()).is_err(), "needs an image");+ assert!(plan(&r, &env(true), &rec()).is_err(), "needs an image");}#[test]@@ -1564,16 +1454,16 @@ mod tests {#[test]fn estimate_matches_benchmarks_roughly() {// Benchmarks ran at CFG 6.- let s = estimate_seconds(Size::new(1024, 1024), &[], 20, 1, false, false, 6.0);+ let s = estimate_seconds(Size::new(1024, 1024), &[], 20, 1, false, 6.0);assert!((40.0..55.0).contains(&s), "{s}");- let s = estimate_seconds(Size::new(2048, 2048), &[], 3, 1, false, false, 6.0);+ let s = estimate_seconds(Size::new(2048, 2048), &[], 3, 1, false, 6.0);assert!((40.0..60.0).contains(&s), "{s}");// 2K bench (sd-cli incl. ~3 s load): sage single pass 104 s.- let s = estimate_seconds(Size::new(2048, 1152), &[], 20, 1, false, true, 6.0);+ let s = estimate_seconds(Size::new(2048, 1152), &[], 20, 1, true, 6.0);assert!((80.0..105.0).contains(&s), "native {s}");// CFG 1 runs one model pass per step: 40 steps cost about what 20 did at CFG 6.- let one = estimate_seconds(Size::new(1024, 1024), &[], 40, 1, false, true, 1.0);- let two = estimate_seconds(Size::new(1024, 1024), &[], 20, 1, false, true, 6.0);+ let one = estimate_seconds(Size::new(1024, 1024), &[], 40, 1, true, 1.0);+ let two = estimate_seconds(Size::new(1024, 1024), &[], 20, 1, true, 6.0);assert!((one - two).abs() < 1.0, "{one} vs {two}");}@@ -1590,15 +1480,15 @@ mod tests {assert!(r.preserve_dimensions);assert_eq!(r.outpaint.unwrap().units, ExpansionUnits::Percent);assert_eq!(r.advanced.output_format, Some(OutputFormat::Webp));- assert!(r.upscale.is_none() && r.advanced.refine.is_none());+ assert!(r.upscale.is_none());+ // Older clients: Detailed upscales and their refine effort map to the upscaler model.let r: GenerationRequest = serde_json::from_str(- r#"{"prompt":"","mode":"upscale","images":["gen:abc"],"upscale":{"method":"detailed","width":3840},"advanced":{"refine":"best"}}"#,+ r#"{"prompt":"","mode":"upscale","images":["gen:abc"],"upscale":{"method":"detailed","width":3840},"advanced":{"refine":"best","cfg":4,"steps":30}}"#,).unwrap();assert_eq!(r.mode, Mode::Upscale);- assert_eq!(r.upscale.unwrap().method, UpscaleMethod::Detailed);+ assert_eq!(r.upscale.unwrap().method, UpscaleMethod::Quick);assert_eq!(r.upscale.unwrap().width, Some(3840));- assert_eq!(r.advanced.refine, Some(RefineMode::Best));}}diff --git a/crates/qls-core/src/process.rs b/crates/qls-core/src/process.rsindex 5b5832c..e1c44b5 100644--- a/crates/qls-core/src/process.rs+++ b/crates/qls-core/src/process.rs@@ -737,7 +737,7 @@ mod tests {let s = a.join(" ");let m = |f: &str| crate::catalog::join_rel(&cfg.sdcpp_dir, &format!("models/qwen21/{f}")).display().to_string();assert!(s.starts_with("--listen-ip 127.0.0.1 --listen-port 39150"));- assert!(s.contains(&format!("--diffusion-model {}", m("qwen-image-2.1-Q4_K_M.gguf"))));+ assert!(s.contains(&format!("--diffusion-model {}", m("qwen-image-2.1-turbo-Q4_K.gguf"))));assert!(s.contains(&format!("--vae {}", m("qwen_image_2.1_vae_bf16.safetensors"))));assert!(s.contains(&format!("--llm {}", m("Qwen3VL-8B-Instruct-Q4_K_M.gguf"))));assert!(s.contains(&format!("--llm_vision {}", m("mmproj-Qwen3VL-8B-Instruct-F16.gguf"))));diff --git a/crates/qls-service/src/api.rs b/crates/qls-service/src/api.rsindex 40514e2..01947b5 100644--- a/crates/qls-service/src/api.rs+++ b/crates/qls-service/src/api.rs@@ -188,8 +188,7 @@ async fn status(State(s): St) -> Json<Value> {"schedulers": srv.capabilities.as_ref().map(|c| c.schedulers.clone()).unwrap_or_default(),"upscale": srv.capabilities.as_ref().map(|c| c.upscale),},- "upscaler": { "model": cfg.upscaler_model, "available": cfg.upscaler_file().is_some(), "refine_mode": cfg.refine_mode },- "turbo": { "available": cfg.turbo_model().is_some() },+ "upscaler": { "model": cfg.upscaler_model, "available": cfg.upscaler_file().is_some() },"profile": { "id": cfg.profile().id, "display_name": cfg.profile().display_name },"gpu": gpu,"active_job": s.engine.active_job(),@@ -335,7 +334,7 @@ async fn put_config(State(s): St, Json(cfg): Json<AppConfig>) -> ApiResult<Json<}async fn backend_start(State(s): St) -> ApiResult<Json<Value>> {- let cfg = s.engine.server_config();+ let cfg = s.engine.config();let engine = s.engine.clone();engine.emit_server();let r = engine.server.ensure_ready(&cfg).await;@@ -405,7 +404,7 @@ async fn diagnostics_json(State(s): St) -> ApiResult<Json<Value>> {let _ = writeln!(text, "{label}: {} ({})", p.display(), if p.is_file() { "ok" } else { "MISSING" });}let _ = writeln!(text, "Device: {}, text encoder: {:?}, VRAM reserve: {} GiB, flash attention: {}, sage attention: {}", cfg.device, cfg.text_encoder_placement, cfg.vram_reserve_gib, cfg.flash_attention, cfg.sage_attention);- let _ = writeln!(text, "VAE tile size: {}, refine: {:?}, upscale tile size: {}", cfg.vae_tile_size, cfg.refine_mode, cfg.upscale_tile_size);+ let _ = writeln!(text, "VAE tile size: {}, upscale tile size: {}", cfg.vae_tile_size, cfg.upscale_tile_size);let up = diagnostics::upscaler_check(&cfg);let _ = writeln!(text, "ESRGAN upscaler: {}", up.detail);let _ = writeln!(text, "Ports: server {}, service {}", cfg.server_port, cfg.service_port);@@ -581,7 +580,7 @@ async fn op_inpaint(State(s): St, Query(q): Query<OpQ>, Json(op): Json<SimpleOp>async fn op_outpaint(State(s): St, Query(q): Query<OpQ>, Json(op): Json<SimpleOp>) -> ApiResult<Json<JobView>> {run_simple(s, Mode::Outpaint, op, q.wait.unwrap_or(true)).await}-/// `{"image": "...", "scale": 2 | "width"/"height", "method": "quick"|"detailed", "prompt"?}`+/// `{"image": "...", "scale": 2 | "width"/"height", "prompt"?}`: the upscaler model only.async fn op_upscale(State(s): St, Query(q): Query<OpQ>, Json(op): Json<SimpleOp>) -> ApiResult<Json<JobView>> {run_simple(s, Mode::Upscale, op, q.wait.unwrap_or(true)).await}diff --git a/docs/engineering-notes.md b/docs/engineering-notes.mdindex 7855457..15355a7 100644--- a/docs/engineering-notes.md+++ b/docs/engineering-notes.md@@ -79,16 +79,15 @@ Details and the reasoning are in [platforms.md](platforms.md); the short versionmarked in color on a second reference and prompts "the area marked in red in `<image2>`"(the official 2.1 way to point at a region). Removals blur the content out of `<image1>`first so the model rebuilds background instead of copying the object back.-- Recommended settings follow the official Qwen-Image 2.1 release (QwenLM/Qwen-Image-2.1- README, diffusers `QwenImage21Pipeline`): `euler`, **no CFG** (1.0, "meant to be sampled- without guidance"), 40 steps, native 2K sizes; sd-server picks the same resolution-dependent- flow schedule (exponential shift 0.5–0.9, terminal 0.02). sd.cpp's own docs use CFG 6, which+- Sampling follows the official Qwen-Image 2.1 Turbo release (see Turbo below): `euler`,+ **no CFG**, its saved 8-step schedule, native 2K sizes. sd.cpp's own docs use CFG 6, whichruns a second, unconditional model pass every step; the app used that until 2026-10-07.- At CFG 1 the negative prompt is ignored.- Presets (since 2026-10-09; 20 steps judged enough, only Ultra keeps the official 40):- Fast 20 steps at ~1 MP; Balanced 20 steps at ~1.5K (1536²); Quality 20 steps and Ultra- 40 steps at the official 2K buckets (2048², 2752×1536…; edits share that budget with their- reference images, so they land near 2 MP on 16 GB).+ At CFG 1 the negative prompt is ignored, so the UI no longer offers one (the API still+ accepts it and notes that it was ignored).+ Presets (since 2026-10-09, Turbo only): **Fast** ~1 MP (the default), **Balanced** ~1.5K+ (1536²), **Quality** at the official 2K buckets (2048², 2752×1536…; edits share that budget+ with their reference images, so they land near 2 MP on 16 GB). Older preset names map on+ load: `turbo` → Fast, `ultra` → Quality.- Default launch (CUDA; other engines above): `--backend cuda0 --params-backend te=cpu --fa --sage-attn --vae-tiling--vae-tile-size 768 --vae-tile-overlap 0.125 --max-vram -1` plus `--hires-upscalers-dir`when the upscalers folder exists (text-encoder weights in RAM, computed on the GPU). Measured@@ -108,7 +107,7 @@ Details and the reasoning are in [platforms.md](platforms.md); the short version## Resolution and upscaling policyEvery job runs a single diffusion pass at the working size (Auto: ~1 MP for Fast, ~1.5K for-Balanced, native 2K for Quality and Ultra; or the 1K/1.5K/2K/Source/Custom choice), capped by the VRAM token budget+Balanced, native 2K for Quality; or the 1K/1.5K/2K/Source/Custom choice), capped by the VRAM token budgetthat the target shares with its reference images. The earlier two-pass mode (≈1 MP render →ESRGAN → low-denoise refine at 2K) was removed on 2026-10-06: in A/B tests the refine madeedits look worse than a single pass.@@ -120,24 +119,24 @@ the exact size; Lanczos is only used for shrinking or factors below 1.1×.On Apple Silicon, Fast at Auto resolution renders at most 768² (`planner::UNIFIED_FAST_AREA`)and is enlarged to the 1 MP output, because Mac GPUs are several times slower.-### Turbo (the default quality, 2026-10-10)+### Turbo (the only image model since 2026-10-09)-Quality level **Turbo** = ~1 MP in 8 steps on Qwen's official distilled model+Every job runs Qwen's official 8-step distilled model([Qwen/Qwen-Image-2.1-Turbo](https://huggingface.co/Qwen/Qwen-Image-2.1-Turbo), released2026-10-09, Qwen Research License like the base), as the stable-diffusion.cpp conversion-[DogukanUrker/Qwen-Image-2.1-Turbo-GGUF](https://huggingface.co/DogukanUrker/Qwen-Image-2.1-Turbo-GGUF)-Q4_K (4.05 GB, `catalog::TURBO_Q4_K`, part of every preset). t2i and edits.+[DogukanUrker/Qwen-Image-2.1-Turbo-GGUF](https://huggingface.co/DogukanUrker/Qwen-Image-2.1-Turbo-GGUF):+Q4_K (4.05 GB, `catalog::TURBO_Q4_K`) on every preset (the larger presets differ in working+size and text encoder only). t2i and edits. The base Qwen-Image 2.1 weights are no+longer downloaded; config schema 7 points the official profile at the preset's Turbo file (the+old base file stays on disk until the user deletes it).-- It is a separate diffusion model. `AppConfig::with_turbo` swaps it into the active profile;- the engine restarts the server when a job needs the other model (`Engine::server_config_for`),- and starts the server with the model of the last job (Turbo before any job). Switching costs a- full server start (encoder included), so mixing Turbo and other levels is slow.- Schedule: `planner::TURBO_SIGMAS` = `sample_sigmas` of the checkpoint's model_index.json([1, .978453, .95418, .926626, .89508, .845148, .704534, .414568, 0], fixed at everyresolution), sent as `sample_params.custom_sigmas` (used verbatim, steps = len − 1). sd.cpp's- default Qwen schedule shifts by resolution and has a 0.02 terminal shift. CFG is forced to 1;- Advanced steps/CFG are ignored.-- Not installed (configs from before Turbo): Turbo requests run as Balanced with a note.+ default Qwen schedule shifts by resolution and has a 0.02 terminal shift. CFG is always 1.+ Steps, CFG and scheduler are not settable (Qwen evaluated no other schedule); the sampler is.+- Turbo goes no further than native 2K: Qwen trained and published 2K buckets only, and 2048²+ is the measured VRAM limit on 16 GB. Larger outputs come from the upscaler model.- **Same-seed A/B, RTX 5070 Ti, 1024², 3 t2i + 3 edits** (`scripts/dev/compare-fast-modes.py`):Fast (20 steps) 19.1 s t2i / 23.8 s edit; Viggle v0.3 LoRA (6 steps) 10.1 / 13.6 s; officialTurbo (8 steps) 9.5 / 13.1 s. ~4.5 s per image are fixed (encode, 2.7 s decode), so the@@ -151,10 +150,12 @@ Q4_K (4.05 GB, `catalog::TURBO_Q4_K`, part of every preset). t2i and edits.weights, `proj_out.weight [4,64,4096]` = one output head per step), would need an sd.cpppatch. LightX2V Lightning for 2.1: not released (issue #1548).- Open: Turbo Q6_K / Q8_0 vs Q4_K (the comparison script has `official8_q6_k`,- `official8_q8_0`); Turbo above 1 MP.+ `official8_q8_0`); Turbo at 1.5K and 2K on real prompts.-The **Upscale** action has two methods: **Quick** (ESRGAN only) and **Detailed** (a low-denoise-0.3 img2img pass at about 2K, then ESRGAN to the target).+The **Upscale** action runs the upscaler model (ESRGAN) straight on the image. The Detailed+method (a low-denoise img2img pass at about 2K first) was removed on 2026-10-09: Turbo's+schedule leaves only 1–2 steps at strength 0.3. Requests with `"method": "detailed"` run as+the upscaler model only.## HDR@@ -177,8 +178,7 @@ path so it can be fetched by hand.In `%APPDATA%\Kokon\config.json`: `hardwarePreset` (`12gb|16gb|24gb|32gb`, written by thesetup screen), `vramOverrideMib` (plan sizes as if the GPU had this much VRAM; 0 = detect;-for testing), `refineMode` (`fast|best`, Detailed upscale effort; `off` is legacy),-`upscalersDir` (null = default folder), `upscalerModel` (`4x-UltraSharp`; configs on the old+for testing), `upscalersDir` (null = default folder), `upscalerModel` (`4x-UltraSharp`; configs on the old`RealESRGAN_x4plus` default move to it), `upscaleTileSize` (0 = backend default 128),`prefixCacheType`, `eagerLoad`, `sageAttention`.diff --git a/docs/platforms.md b/docs/platforms.mdindex 0f2459e..9c9124d 100644--- a/docs/platforms.md+++ b/docs/platforms.md@@ -50,7 +50,7 @@ pass. Kokon uses CFG 1, which is one pass per step.| --- | --- | --- || **Chip** | Apple M1 or newer (Intel Macs: no) | M-series Pro / Max / Ultra || **macOS** | 26 Tahoe (the engine binary's minimum) | latest |-| **Unified memory** | 16 GB: works, but slowly (lightest mode, ~1 MP, ~10 min on an M2 Pro) | 32 GB+ (everything stays loaded, Quality 2K); 48 GB+ gets the 8-bit model |+| **Unified memory** | 16 GB: works, but slowly (lightest mode, ~1 MP, ~10 min on an M2 Pro) | 32 GB+ (everything stays loaded, Quality 2K) || **Disk** | 15 GB free | 25 GB on the internal SSD |16 GB Macs run in the lightest setup: 1 MP, with each model's weights loaded when it runs and@@ -61,7 +61,7 @@ screen says so before downloading, and recommends 32 GB and a Pro/Max/Ultra chip**Fast on a Mac renders smaller** (2026-10-09): on unified memory, Fast at Auto resolutionrenders at most 768² (`planner::UNIFIED_FAST_AREA`) and the upscaler model enlarges the resultto the size Fast renders on a PC (1 MP). Sampling cost grows faster than the area, so this is-well under half the sampling time. Balanced, Quality, Ultra and explicit sizes are unchanged.+well under half the sampling time. Balanced, Quality and explicit sizes are unchanged.### Why macOS paging does not help here (verified in the source, 2026-10-09)@@ -105,12 +105,12 @@ VAE 0.25 GB ≈ 10.7 GB.| 16 GB | ~10.7 GB | ~4.5 GB | 4–6 GB card | lightest, 1 MP || 24 GB | ~16 GB | ~9.8 GB | 10 GB card | 12 GB preset || 32 GB | ~21 GB | ~15 GB | 16 GB card | 16 GB preset (2K) |-| 48 GB | ~32 GB | ~26 GB | 24 GB+ card | 24 GB preset (Q8 model) |+| 48 GB | ~32 GB | ~26 GB | 24 GB+ card | 24 GB preset || 64 GB+ | ~48 GB | ~42 GB | 32 GB+ card | 32 GB+ preset |### Expected speed-These are **estimates, not measured**, for 1 MP, 20 steps, CFG 1. They are derived from the+These are **estimates, not measured**, for 1 MP, 20 steps, CFG 1 (the base model; Turbo runs 8 steps, so roughly 40 % of the sampling time). They are derived from theM5 16 GB measurement (about 38 s per model pass at 1024², with the same engine build) andllama.cpp compute ratios. Our test machines: M2 Pro 16 GB (19-core GPU, 200 GB/s) about15–25 s per step, 6–9 min per image; M4 Pro 24 GB (20-core, 273 GB/s) about 12–18 s per@@ -165,8 +165,8 @@ so nobody with a base chip is surprised.### Speed roadmap for Macs-1. ✅ **Turbo**: Qwen's official 8-step model, now the default quality; the largest gain on- every platform. See the Turbo notes in `docs/engineering-notes.md`. Mac speed not measured yet.+1. ✅ **Turbo**: Qwen's official 8-step model, the only image model since 2026-10-09; the+ largest gain on every platform. See the Turbo notes in `docs/engineering-notes.md`. Mac speed not measured yet.2. ✅ Honest requirements: 16 GB works but slowly; 32 GB+ and a Pro/Max/Ultra chip recommended.3. ✅ Fast renders at 768² on Macs and enlarges (above).4. **Later: an MLX engine.** Apple's MLX framework (through [mflux](https://github.com/filipstrand/mflux))diff --git a/docs/upscale-plan.md b/docs/upscale-plan.mdindex dc7bb0c..1b82f0f 100644--- a/docs/upscale-plan.md+++ b/docs/upscale-plan.md@@ -1,5 +1,8 @@# Speed & upscaling: results log and implementation plan+> Historical plan. Since 2026-10-09 the app runs only Qwen-Image 2.1 Turbo (8 steps, CFG 1) and+> upscaling is the upscaler model only; the Detailed refine and the step presets below are gone.+Status as of 2026-10-06. Hardware: RTX 5070 Ti 16 GB, sd-server/sd-cli in `C:\AI\sdcpp`(stable-diffusion.cpp commit 3f8527a), Qwen Image 2.1 UC Q4_K_M + Qwen3VL-8B Q4_K_M TE.Benchmark script: `C:\AI\sdcpp\bench\bench-2k.ps1` (`-Only a,b`), outputs + logs in `C:\AI\sdcpp\bench\out`.diff --git a/mcp/src/index.ts b/mcp/src/index.tsindex 165a7b3..92b37df 100644--- a/mcp/src/index.ts+++ b/mcp/src/index.ts@@ -38,7 +38,7 @@ const DESCRIPTIONS: Record<keyof typeof schemas, { title: string; description: supscale_image: {title: "Upscale image",description:- "Enlarge an image (default 2x, or to a width/height up to 8192 px). method 'quick' runs the configured ESRGAN upscaler model only (UltraSharp by default; seconds, no new content); 'detailed' first re-renders fine detail at about 2K with a low-denoise refine, then the upscaler model (about a minute). Saves a new file; the input is never overwritten.",+ "Enlarge an image (default 2x, or to a width/height up to 8192 px). Runs the configured ESRGAN upscaler model on the image (UltraSharp by default; seconds, adds no new content). Saves a new file; the input is never overwritten.",},get_image_info: {title: "Image info",diff --git a/mcp/src/tools.ts b/mcp/src/tools.tsindex 6e08da2..1d36e71 100644--- a/mcp/src/tools.ts+++ b/mcp/src/tools.ts@@ -6,8 +6,8 @@ import { allowedRoots, checkInput, checkOutput, PathError } from "./paths.js";import { ServiceClient, ServiceError } from "./service.js";const quality = z- .enum(["turbo", "fast", "balanced", "quality", "ultra"])- .describe("turbo = ~1 MP in 8 steps with Qwen's distilled Turbo model (the default, fastest; runs as balanced if the Turbo model is not installed); fast = ~1 MP, 20 steps; balanced = ~1.5K, 20 steps; quality = native 2K, 20 steps (slower; edits share 2K with their references); ultra = native 2K, 40 steps (slowest)");+ .enum(["fast", "balanced", "quality"])+ .describe("All run Qwen-Image 2.1 Turbo (8 steps): fast = ~1 MP (the default, fastest); balanced = ~1.5K; quality = native 2K (slowest; edits share 2K with their references)");const seed = z.number().int().min(-1).max(2_147_483_647).describe("Seed for reproducible results; omit or -1 for random");const dim = z.number().int().min(64).max(4096);const aspect = z@@ -24,7 +24,6 @@ const preview = z.boolean().describe("Also return a small JPEG preview in the toexport const schemas = {generate_image: {prompt: prompt.describe("What to generate, in natural language"),- negative_prompt: z.string().max(2000).optional(),width: dim.optional().describe("Output width in pixels (needs height too). Omit to choose automatically."),height: dim.optional().describe("Output height in pixels (needs width too)."),aspect_ratio: aspect.optional(),@@ -40,7 +39,6 @@ export const schemas = {quality: quality.optional(),preserve_dimensions: z.boolean().optional().describe("Keep the input's exact width/height (default true)"),seed: seed.optional(),- negative_prompt: z.string().max(2000).optional(),include_preview: preview.optional(),},edit_images: {@@ -85,11 +83,6 @@ export const schemas = {scale: z.number().gt(1).max(8).optional().describe("Enlargement factor, e.g. 2 (default 2 when no width/height is given)"),width: z.number().int().min(64).max(8192).optional().describe("Target width in pixels; height follows the aspect ratio unless also given"),height: z.number().int().min(64).max(8192).optional().describe("Target height in pixels; width follows the aspect ratio unless also given"),- method: z- .enum(["quick", "detailed"])- .optional()- .describe("quick = the configured ESRGAN upscaler model only (UltraSharp by default; seconds, adds no new content, default); detailed = re-render fine detail at ~2K with low denoise, then the upscaler model (about a minute)"),- prompt: z.string().max(8000).optional().describe("Optional description used by the detailed refine (defaults to the image's own prompt or a neutral one)"),output_path: outputPath.optional(),include_preview: preview.optional(),},@@ -257,14 +250,13 @@ export const handlers = {ctx,{prompt: a.prompt,- negative_prompt: a.negative_prompt,mode: "generate",images: [],width: a.width,height: a.height,resolution: a.width ? "custom" : "auto",aspect_ratio: a.aspect_ratio,- quality: a.quality ?? "turbo",+ quality: a.quality ?? "fast",seed: a.seed,output_path: out,advanced: {},@@ -279,7 +271,7 @@ export const handlers = {const out = a.output_path ? checkOutput(a.output_path, ctx.cwd, r) : undefined;return runJob(ctx,- { prompt: a.prompt, negative_prompt: a.negative_prompt, mode: "edit", images: [img], quality: a.quality ?? "turbo", seed: a.seed, preserve_dimensions: a.preserve_dimensions ?? true, output_path: out, advanced: {} },+ { prompt: a.prompt, mode: "edit", images: [img], quality: a.quality ?? "fast", seed: a.seed, preserve_dimensions: a.preserve_dimensions ?? true, output_path: out, advanced: {} },!!a.include_preview,);},@@ -299,7 +291,7 @@ export const handlers = {height: a.height,resolution: a.width ? "custom" : "auto",aspect_ratio: a.aspect_ratio,- quality: a.quality ?? "turbo",+ quality: a.quality ?? "fast",seed: a.seed,output_path: out,advanced: {},@@ -320,7 +312,7 @@ export const handlers = {mode: "outpaint",images: [img],outpaint: { left: a.left, right: a.right, top: a.top, bottom: a.bottom, units: a.units },- quality: a.quality ?? "turbo",+ quality: a.quality ?? "fast",seed: a.seed,output_path: out,advanced: {},@@ -337,7 +329,7 @@ export const handlers = {if (!a.prompt && a.action !== "remove") throw new PathError("prompt must not be empty (only action 'remove' works without one).");return runJob(ctx,- { prompt: a.prompt, mode: "inpaint", inpaint_action: a.action, images: [img], mask, quality: a.quality ?? "turbo", seed: a.seed, output_path: out, advanced: {} },+ { prompt: a.prompt, mode: "inpaint", inpaint_action: a.action, images: [img], mask, quality: a.quality ?? "fast", seed: a.seed, output_path: out, advanced: {} },!!a.include_preview,);},@@ -350,10 +342,10 @@ export const handlers = {return runJob(ctx,{- prompt: a.prompt ?? "",+ prompt: "",mode: "upscale",images: [img],- upscale: { method: a.method ?? "quick", scale: a.scale, width: a.width, height: a.height },+ upscale: { method: "quick", scale: a.scale, width: a.width, height: a.height },output_path: out,advanced: {},},diff --git a/mcp/test/tools.test.ts b/mcp/test/tools.test.tsindex 4f487a9..9b9f4fe 100644--- a/mcp/test/tools.test.ts+++ b/mcp/test/tools.test.ts@@ -14,7 +14,8 @@ describe("input validation", () => {expect(obj("generate_image").safeParse({ prompt: "x", width: 5000, height: 512 }).success).toBe(false);expect(obj("generate_image").safeParse({ prompt: "x", aspect_ratio: "16:9" }).success).toBe(true);expect(obj("generate_image").safeParse({ prompt: "x", aspect_ratio: "wide" }).success).toBe(false);- expect(obj("generate_image").safeParse({ prompt: "x", quality: "ultra" }).success).toBe(true);+ expect(obj("generate_image").safeParse({ prompt: "x", quality: "quality" }).success).toBe(true);+ expect(obj("generate_image").safeParse({ prompt: "x", quality: "ultra" }).success).toBe(false);expect(obj("generate_image").safeParse({ prompt: "x", quality: "max" }).success).toBe(false);expect(obj("generate_image").safeParse({ prompt: "x", seed: -2 }).success).toBe(false);});@@ -36,12 +37,10 @@ describe("input validation", () => {});describe("upscale_image", () => {- it("validates factor, size and method", () => {+ it("validates factor and size", () => {expect(obj("upscale_image").safeParse({ image_path: "a.png" }).success).toBe(true);expect(obj("upscale_image").safeParse({ image_path: "a.png", scale: 1 }).success).toBe(false);- expect(obj("upscale_image").safeParse({ image_path: "a.png", scale: 2, method: "detailed" }).success).toBe(true);expect(obj("upscale_image").safeParse({ image_path: "a.png", width: 9000 }).success).toBe(false);- expect(obj("upscale_image").safeParse({ image_path: "a.png", method: "ultra" }).success).toBe(false);});it("scale and width together are rejected before any service call", async () => {const ctx = { client: {} as never, cwd: process.cwd(), progress: () => {} };diff --git a/src/components/Advanced.tsx b/src/components/Advanced.tsxindex d9f3b93..61228b9 100644--- a/src/components/Advanced.tsx+++ b/src/components/Advanced.tsx@@ -4,8 +4,8 @@ import type { Advanced, OutputFormat, Plan } from "../lib/types";import { Seg, Switch } from "./ui";// Verified against sd-server 3f8527a capabilities; replaced by the live list when loaded.+// Steps, CFG and scheduler are fixed by the Turbo model's 8-step schedule (no CFG).const FALLBACK_SAMPLERS = ["euler", "euler_a", "heun", "dpm2", "dpm++2s_a", "dpm++2m", "dpm++2mv2", "ipndm", "ipndm_v", "lcm", "ddim_trailing", "tcd", "res_multistep", "res_2s", "er_sde"];-const FALLBACK_SCHEDULERS = ["discrete", "karras", "exponential", "ays", "gits", "sgm_uniform", "simple", "smoothstep", "kl_optimal", "lcm", "beta", "flux"];function NumField(props: { label: string; value: number | null | undefined; placeholder: string; min: number; max: number; step?: number; onChange: (v: number | null) => void }) {return (@@ -32,7 +32,6 @@ function NumField(props: { label: string; value: number | null | undefined; placexport function AdvancedPanel({ plan }: { plan: Plan | null }) {const c = useStore((s) => s.composer);const samplers = useStore((s) => (s.status?.server as { samplers?: string[] } | undefined)?.samplers);- const schedulers = useStore((s) => (s.status?.server as { schedulers?: string[] } | undefined)?.schedulers);const a = c.advanced;const setA = (patch: Partial<Advanced>) => updateComposer({ advanced: { ...a, ...patch } });const editLike = plan && (plan.mode === "inpaint" || plan.mode === "outpaint" || plan.mode === "edit");@@ -56,9 +55,6 @@ export function AdvancedPanel({ plan }: { plan: Plan | null }) {</div></label>- <NumField label="Steps" value={a.steps} placeholder={String(plan?.steps ?? "Auto")} min={1} max={150} onChange={(v) => setA({ steps: v })} />- <NumField label="CFG" value={a.cfg} placeholder={String(plan?.cfg ?? "Auto")} min={0} max={30} step={0.5} onChange={(v) => setA({ cfg: v })} />-<label className="field-row"><span>Sampler</span><select className="select" value={a.sampler ?? ""} onChange={(e) => setA({ sampler: e.target.value || null })}>@@ -70,17 +66,6 @@ export function AdvancedPanel({ plan }: { plan: Plan | null }) {))}</select></label>- <label className="field-row">- <span>Scheduler</span>- <select className="select" value={a.scheduler ?? ""} onChange={(e) => setA({ scheduler: e.target.value || null })}>- <option value="">Default (model)</option>- {(schedulers?.length ? schedulers : FALLBACK_SCHEDULERS).map((s) => (- <option key={s} value={s}>- {s}- </option>- ))}- </select>- </label>{editLike && (<label className="field">@@ -122,12 +107,7 @@ export function AdvancedPanel({ plan }: { plan: Plan | null }) {<Switch on={a.vae_tiling ?? plan?.vae_tiling ?? false} onChange={(v) => setA({ vae_tiling: v })} label="VAE tiling" /></div>- <label className="field">- <span>Negative prompt</span>- <textarea className="input" rows={2} value={c.negative} placeholder="Optional; used only when CFG is above 1" onChange={(e) => updateComposer({ negative: e.target.value })} />- </label>-- <button className="btn" onClick={() => updateComposer({ advanced: {}, seed: null, negative: "" })}>+ <button className="btn" onClick={() => updateComposer({ advanced: {}, seed: null })}><RotateCcw size={14} /> Reset to automatic</button></>diff --git a/src/components/Composer.tsx b/src/components/Composer.tsxindex fb77c8d..f9107fa 100644--- a/src/components/Composer.tsx+++ b/src/components/Composer.tsx@@ -11,12 +11,11 @@ import { AdvancedPanel } from "./Advanced";import { AspectGrid, pickAspect, RatioIcon, resolutionLabel, ResolutionMenu } from "./SizeMenus";import { Option, Popover, Seg } from "./ui";+// All presets run Qwen-Image 2.1 Turbo (8 steps); they differ in size.const QUALITY: { value: Quality; label: string; sub: string }[] = [- { value: "turbo", label: "Turbo", sub: "~1 MP, 8 steps · fastest, recommended" },- { value: "fast", label: "Fast", sub: "~1 MP, 20 steps" },- { value: "balanced", label: "Balanced", sub: "~1.5K, 20 steps" },- { value: "quality", label: "Quality", sub: "native 2K, 20 steps · slower" },- { value: "ultra", label: "Ultra", sub: "native 2K, 40 steps · slowest" },+ { value: "fast", label: "Fast", sub: "~1 MP · fastest" },+ { value: "balanced", label: "Balanced", sub: "~1.5K" },+ { value: "quality", label: "Quality", sub: "native 2K · slowest" },];const INPAINT_ACTIONS: { value: InpaintAction; label: string; placeholder: string }[] = [@@ -285,7 +284,6 @@ function usePlanPreview(): { plan: Plan | null; error: string | null } {export function Composer() {const c = useStore((s) => s.composer);- const turboAvailable = useStore((s) => s.status?.turbo?.available ?? false);const hasProject = useStore((s) => s.session.length > 0);const { plan, error } = usePlanPreview();const taRef = useRef<HTMLTextAreaElement>(null);@@ -407,7 +405,7 @@ export function Composer() {)}>{(close) =>- QUALITY.map((q) => <Option key={q.value} selected={c.quality === q.value} label={q.label} sub={q.value === "turbo" && !turboAvailable ? "model not installed: runs as Balanced" : q.sub} onClick={() => (updateComposer({ quality: q.value }), close())} />)+ QUALITY.map((q) => <Option key={q.value} selected={c.quality === q.value} label={q.label} sub={q.sub} onClick={() => (updateComposer({ quality: q.value }), close())} />)}</Popover>diff --git a/src/components/Settings.tsx b/src/components/Settings.tsxindex 0712fed..a778b1d 100644--- a/src/components/Settings.tsx+++ b/src/components/Settings.tsx@@ -5,7 +5,7 @@ import { api } from "../lib/api";import { native } from "../lib/native";import { getState, refreshStatus, setState, toastError, toastInfo } from "../lib/store";import { UPSCALERS } from "../lib/logic";-import type { AppConfig, Check, ModelProfile, RefineMode, SetupReport, TextEncoderPlacement } from "../lib/types";+import type { AppConfig, Check, ModelProfile, SetupReport, TextEncoderPlacement } from "../lib/types";import { IconButton, Seg, Switch } from "./ui";import { autoCheckEnabled, checkForUpdate } from "../lib/updates";@@ -352,20 +352,6 @@ export function Settings() {<Switch on={cfg.eagerLoad} onChange={(v) => set({ eagerLoad: v })} /></div>)}- <div className="field">- <span>Detailed upscale</span>- <Seg<RefineMode>- value={cfg.refineMode === "best" ? "best" : "fast"}- options={[- { value: "fast", label: "Fast" },- { value: "best", label: "Best" },- ]}- onChange={(v) => set({ refineMode: v })}- />- <span className="muted">- Only for Upscale → Detailed, which re-renders fine detail at about 2K before the upscaler model. Fast: 6 steps with caching. Best: 8 steps, no cache. Generation always renders in one pass and is then enlarged with the upscaler model.- </span>- </div><label className="field-row"><span>ESRGAN tile size (px, 0 = default 128)</span><input className="input" type="number" min={0} max={1024} step={64} style={{ width: 90 }} value={cfg.upscaleTileSize} onChange={(e) => set({ upscaleTileSize: Math.max(0, Math.round(Number(e.target.value) || 0)) })} />diff --git a/src/components/Stage.tsx b/src/components/Stage.tsxindex 2df71c5..94ab3ac 100644--- a/src/components/Stage.tsx+++ b/src/components/Stage.tsx@@ -11,9 +11,9 @@ import { native } from "../lib/native";import {addAsReference, cancelJob, focusPrompt, getState, itemSource, removeSessionItem, reusePrompt, selectedItem, selectItem, sessionLabels, sessionLinks, setState, submitRequest, toastError, toastInfo, useStore, type SessionItem,} from "../lib/store";-import type { GenerationRecord, JobView, Mode, Size, UpscaleMethod } from "../lib/types";+import type { GenerationRecord, JobView, Mode, Size } from "../lib/types";import { CompareFrame } from "./Compare";-import { IconButton, Popover, Seg, useFit } from "./ui";+import { IconButton, Popover, useFit } from "./ui";import { FullscreenButton, ZoomImage } from "./Viewer";import { fileManager, shortcut } from "../lib/platform";@@ -158,10 +158,9 @@ function InfoPanel({ g }: { g: GenerationRecord }) {);}-/** Upscale menu: Quick (upscaler model only) or Detailed (refine at ~2K, then the upscaler model). */+/** Upscale menu: the upscaler model straight on the image (no diffusion). */function UpscaleMenu(props: { source: string; size: Size; original?: Size | null; parentId?: string | null; close: () => void }) {const { width: w, height: h } = props.size;- const [method, setMethod] = useState<UpscaleMethod>("quick");const up = useStore((s) => s.status?.upscaler);const via = up?.available ? upscalerLabel(up.model) : "Lanczos";const [customW, setCustomW] = useState(Math.min(MAX_UPSCALE_SIDE, w * 2));@@ -169,22 +168,12 @@ function UpscaleMenu(props: { source: string; size: Size; original?: Size | nullconst custom = sizeForWidth(w, h, customW);const customOk = custom.width > w && custom.width <= MAX_UPSCALE_SIDE && custom.height <= MAX_UPSCALE_SIDE && custom.width * custom.height <= MAX_UPSCALE_AREA;const go = (t: Size) => {- submitRequest(upscaleRequest(props.source, t, method, props.parentId));+ submitRequest(upscaleRequest(props.source, t, props.parentId));props.close();};return (<div style={{ width: 300, padding: 8, display: "flex", flexDirection: "column", gap: 10 }}>- <Seg<UpscaleMethod>- value={method}- options={[- { value: "quick", label: "Quick" },- { value: "detailed", label: "Detailed" },- ]}- onChange={setMethod}- />- <span className="muted">- {method === "quick" ? `${via} only: a few seconds, adds no new content.` : `Re-renders fine detail at about 2K (low denoise), then ${via}. About a minute.`}- </span>+ <span className="muted">{via}: a few seconds, adds no new content.</span>{targets.map((t) => (<button key={t.key} className="btn" onClick={() => go(t)}>{t.label} · {t.width}×{t.height}diff --git a/src/lib/logic.test.ts b/src/lib/logic.test.tsindex f0ceb5f..ad80642 100644--- a/src/lib/logic.test.ts+++ b/src/lib/logic.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from "vitest";import {- activeOverrides, buildRequest, compareBase, diffPixels, emptyComposer, expansionPixels, expansionPreset, jobFraction, jobLabel, moveRef, needsPrompt, persistentAdvanced, pipelineSummary,+ activeOverrides, buildRequest, compareBase, diffPixels, emptyComposer, expansionPixels, expansionPreset, jobFraction, jobLabel, moveRef, needsPrompt, normalizeQuality, persistentAdvanced, pipelineSummary,planPipeline, remainingSeconds, sizeForWidth, timeAgo, upscaleRequest, upscaleTargets, versionLabels, type Ref,formatBytes, installItemShort, installItemText, installProgress, installStep, installTimeLeft, timelineLinks, undoTarget, aspectLabel, parseRatio, sizeForRatio, expandToRatio, expandToSize, arcLayout,} from "./logic";@@ -22,7 +22,9 @@ describe("advanced overrides", () => {const saved = { batch_count: null, cfg: 4, flow_shift: null, hdr: false, output_format: "png" as const, refine: null, sampler: null, scheduler: null, steps: 20, strength: 1, vae_tiling: null };it("lists only the sampling overrides that are set", () => {- expect(activeOverrides(saved)).toEqual(["CFG 4", "Steps 20", "Strength 1"]);+ // Steps, CFG and scheduler are fixed by Turbo: old values are dropped, never shown.+ expect(activeOverrides(saved)).toEqual(["Strength 1"]);+ expect(activeOverrides({ sampler: "heun" })).toEqual(["Sampler heun"]);expect(activeOverrides({ output_format: "webp", hdr: true, batch_count: 2 })).toEqual([]);expect(activeOverrides({})).toEqual([]);});@@ -30,7 +32,18 @@ describe("advanced overrides", () => {it("keeps preferences but never persists sampling overrides", () => {expect(persistentAdvanced(saved)).toEqual({ hdr: false, output_format: "png" });expect(persistentAdvanced(undefined)).toEqual({});- expect(emptyComposer({ advanced: persistentAdvanced(saved) }).advanced.cfg).toBeUndefined();+ expect((emptyComposer({ advanced: persistentAdvanced(saved) }).advanced as Record<string, unknown>).cfg).toBeUndefined();+ });+});++describe("normalizeQuality", () => {+ it("maps older preset names", () => {+ expect(emptyComposer().quality).toBe("fast");+ expect(normalizeQuality("turbo")).toBe("fast");+ expect(normalizeQuality("ultra")).toBe("quality");+ expect(normalizeQuality("balanced")).toBe("balanced");+ expect(normalizeQuality(undefined, "quality")).toBe("quality");+ expect(emptyComposer({ quality: "turbo" as never }).quality).toBe("fast");});});@@ -134,8 +147,8 @@ describe("upscaling", () => {expect(sizeForWidth(1376, 768, 3000)).toEqual({ width: 3000, height: 1674 });});it("builds an upscale request without a prompt", () => {- const r = upscaleRequest("gen:abc", { width: 2752, height: 1536 }, "detailed", "abc");- expect(r).toMatchObject({ mode: "upscale", images: ["gen:abc"], prompt: "", parent_id: "abc", upscale: { method: "detailed", width: 2752, height: 1536 } });+ const r = upscaleRequest("gen:abc", { width: 2752, height: 1536 }, "abc");+ expect(r).toMatchObject({ mode: "upscale", images: ["gen:abc"], prompt: "", parent_id: "abc", upscale: { method: "quick", width: 2752, height: 1536 } });});it("summarises the pipeline for the details panel", () => {const g = {diff --git a/src/lib/logic.ts b/src/lib/logic.tsindex b5912a8..8966cd8 100644--- a/src/lib/logic.ts+++ b/src/lib/logic.ts@@ -1,6 +1,6 @@// Pure UI logic (unit-tested in logic.test.ts).-import type { Advanced, GenerationRecord, GenerationRequest, InpaintAction, InputRecord, InstallItem, JobView, Mode, OutpaintSpec, Plan, Quality, ResolutionMode, Size, UpscaleMethod } from "./types";+import type { Advanced, GenerationRecord, GenerationRequest, InpaintAction, InputRecord, InstallItem, JobView, Mode, OutpaintSpec, Plan, Quality, ResolutionMode, Size } from "./types";export interface Ref {key: string;@@ -15,7 +15,6 @@ export interface Ref {export interface Composer {prompt: string;- negative: string;refs: Ref[];/** Mask painted on refs[0] (input id of the mask PNG). */mask: { inputId: string; refKey: string } | null;@@ -32,16 +31,23 @@ export interface Composer {advanced: Advanced;}+/** A preset name from any version: older ones also had "turbo" (now Fast) and "ultra" (now Quality). */+export function normalizeQuality(q: unknown, fallback: Quality = "fast"): Quality {+ if (q === "fast" || q === "balanced" || q === "quality") return q;+ if (q === "turbo") return "fast";+ if (q === "ultra") return "quality";+ return fallback;+}+export const emptyComposer = (prefs?: Partial<Composer>): Composer => ({prompt: "",- negative: "",refs: [],mask: null,inpaintAction: "edit",outpaint: null,mode: "auto",aspect: prefs?.aspect ?? "auto",- quality: prefs?.quality ?? "turbo",+ quality: normalizeQuality(prefs?.quality),resolution: prefs?.resolution ?? "auto",customWidth: prefs?.customWidth ?? 1024,customHeight: prefs?.customHeight ?? 1024,@@ -84,7 +90,6 @@ export function buildRequest(c: Composer, parentId?: string | null): GenerationRconst shaped = !maskValid && !hasOutpaint(c.outpaint);return {prompt: c.prompt.trim(),- negative_prompt: c.negative.trim() || null,mode: c.mode,images: c.mode === "generate" ? [] : c.refs.map((r) => r.source),mask: maskValid ? `input:${c.mask!.inputId}` : null,@@ -110,13 +115,15 @@ export function needsPrompt(c: Composer): boolean {}/** Advanced fields that change how the model samples. They last for the session only: a value- * typed once (e.g. CFG 4 during a test) must not silently override the presets after a restart.- * `flow_shift` is no longer in the UI but may still sit in old saved preferences. */-const SAMPLING_OVERRIDES = ["steps", "cfg", "sampler", "scheduler", "strength", "flow_shift"];+ * typed once must not silently override the presets after a restart. */+const SAMPLING_OVERRIDES = ["sampler", "strength"];+/** Fields of older versions that Turbo's fixed schedule no longer uses (may sit in saved+ * preferences, projects and gallery records): dropped everywhere. */+const REMOVED_ADVANCED = ["steps", "cfg", "scheduler", "flow_shift", "refine"];-/** Labels of the sampling overrides currently set, e.g. ["CFG 4", "Steps 20"]. */+/** Labels of the sampling overrides currently set, e.g. ["Sampler heun", "Strength 0.8"]. */export function activeOverrides(a: Advanced): string[] {- const label: Record<string, string> = { steps: "Steps", cfg: "CFG", sampler: "Sampler", scheduler: "Scheduler", strength: "Strength", flow_shift: "Flow shift" };+ const label: Record<string, string> = { sampler: "Sampler", strength: "Strength" };return Object.entries(cleanAdvanced(a)).filter(([k]) => SAMPLING_OVERRIDES.includes(k)).map(([k, v]) => `${label[k]} ${v}`);@@ -132,7 +139,7 @@ export function persistentAdvanced(a: Advanced | undefined): Advanced {function cleanAdvanced(a: Advanced): Advanced {const out: Advanced = {};for (const [k, v] of Object.entries(a)) {- if (v !== null && v !== undefined && v !== "") (out as Record<string, unknown>)[k] = v;+ if (v !== null && v !== undefined && v !== "" && !REMOVED_ADVANCED.includes(k)) (out as Record<string, unknown>)[k] = v;}return out;}@@ -144,18 +151,17 @@ export function composerFromRecord(g: GenerationRecord, base: Composer): Composeconst c: Composer = {...base,prompt: g.prompt,- negative: g.negative_prompt ?? "",refs,mask: g.mask_input_id && refs[0] ? { inputId: g.mask_input_id, refKey: refs[0].key } : null,inpaintAction: req?.inpaint_action ?? "edit",outpaint: g.outpaint ? { ...g.outpaint, units: "pixels" } : null,// Upscales are started from the image toolbar, not the composer.mode: req?.mode && req.mode !== "upscale" ? req.mode : "auto",- quality: g.quality ?? base.quality,+ quality: normalizeQuality(g.quality, base.quality),resolution: req?.resolution ?? base.resolution,aspect: req?.aspect_ratio ?? "auto",seed: null,- advanced: req?.advanced ?? {},+ advanced: cleanAdvanced(req?.advanced ?? {}),};if (req?.width && req?.height) {c.customWidth = req.width;@@ -372,18 +378,18 @@ export function upscaleTargets(w: number, h: number, source?: Size | null): Upscreturn out;}-export function upscaleRequest(source: string, target: Size, method: UpscaleMethod, parentId?: string | null): GenerationRequest {+export function upscaleRequest(source: string, target: Size, parentId?: string | null): GenerationRequest {return {prompt: "",mode: "upscale",images: [source],- quality: "balanced",+ quality: "fast",resolution: "auto",preserve_dimensions: true,advanced: {},client: "ui",parent_id: parentId ?? null,- upscale: { method, width: target.width, height: target.height },+ upscale: { method: "quick", width: target.width, height: target.height },};}diff --git a/src/lib/types.ts b/src/lib/types.tsindex a333163..29cb5c4 100644--- a/src/lib/types.ts+++ b/src/lib/types.ts@@ -4,13 +4,15 @@ export type Mode = "auto" | "generate" | "edit" | "inpaint" | "outpaint" | "multexport type ResolvedMode = Exclude<Mode, "auto">;/** What an inpaint does in the painted area. */export type InpaintAction = "edit" | "remove" | "replace" | "add";-export type Quality = "fast" | "balanced" | "quality" | "ultra" | "turbo";+/** Presets of the Turbo model (8 steps, no CFG): ~1 MP, ~1.5K, native 2K. */+export type Quality = "fast" | "balanced" | "quality";export type ResolutionMode = "auto" | "source" | "1k" | "1.5k" | "2k" | "custom";export type OutputFormat = "png" | "jpeg" | "webp";export type Units = "pixels" | "percent";-/** Effort of a Detailed upscale ("off" is legacy and behaves like fast). */+/** Refine effort of older versions' two-pass records (gallery details only). */export type RefineMode = "off" | "fast" | "best";-export type UpscaleMethod = "quick" | "detailed";+/** The upscaler model only (older versions also had "detailed"). */+export type UpscaleMethod = "quick";export interface UpscaleSpec { method: UpscaleMethod; scale?: number | null; width?: number | null; height?: number | null }@@ -20,15 +22,11 @@ export interface Rect { x: number; y: number; width: number; height: number }export interface OutpaintSpec { left: number; right: number; top: number; bottom: number; units: Units }export interface Advanced {- steps?: number | null;- cfg?: number | null;sampler?: string | null;- scheduler?: string | null;strength?: number | null;batch_count?: number | null;output_format?: OutputFormat | null;vae_tiling?: boolean | null;- refine?: RefineMode | null;/** Keep a HEIC source's HDR gain map (Ultra HDR JPEG); null = on. */hdr?: boolean | null;}@@ -71,7 +69,6 @@ export interface Plan {steps: number;cfg: number;sampler: string;- scheduler: string | null;strength: number | null;batch_count: number;vae_tiling: boolean;@@ -81,7 +78,6 @@ export interface Plan {optimized_for_vram: boolean;/** Calibrated to this machine after its first image; 0 = not measured yet. */estimated_seconds: number;- cache_threshold: number | null;upscaler: string | null;upscale: { method: UpscaleMethod; source: Size } | null;}@@ -118,7 +114,8 @@ export interface GenerationRecord {steps: number;cfg: number;strength: number | null;- quality: Quality;+ /** May hold an older version's preset name ("turbo", "ultra"): see `normalizeQuality`. */+ quality: Quality | string;resolution: ResolutionMode;references: ReferenceRecord[];mask_input_id: string | null;@@ -178,8 +175,7 @@ export interface StatusResponse {gpu: { name: string; vendor: string; unified: boolean; memory_total_mib: number; memory_used_mib: number; memory_free_mib: number; driver_version: string } | null;active_job: JobView | null;queue: { queued: number; jobs: JobView[] };- upscaler?: { model: string; available: boolean; refine_mode: RefineMode };- turbo?: { available: boolean };+ upscaler?: { model: string; available: boolean };setup_complete: boolean;}@@ -222,7 +218,6 @@ export interface AppConfig {upscalersDir: string | null;upscalerModel: string;upscaleTileSize: number;- refineMode: RefineMode;extraServerArgs: string[];outputDir: string;keepServerRunning: boolean;