Skip to content

armgit / kokon

Public Imported from GitHub
0

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.

feat(models): texture-fix VAE removes the 2-px checkerboard (#21)

Gabriele Lozupone1b76a8b3da02
diff --git a/README.md b/README.md
index 09934b0..2c482a7 100644
--- a/README.md
+++ b/README.md
@@ -188,13 +188,16 @@ preset later from Settings → Models → **Set up models…**
| 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 and the
+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 with
+[madebyollin's texture fix](https://huggingface.co/madebyollin/texture-fix-vae-for-qwen-image-2.1) (it removes the faint
+2-pixel checkerboard of the original decoder; installs from 0.9.2 or earlier switch to it when you accept the update), the
Qwen3-VL vision projector and, on a PC, the Superscale-SP upscaler (67 MB). 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).
+[Qwen/Qwen3-VL-8B-Instruct-GGUF](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct-GGUF),
+[madebyollin/texture-fix-vae-for-qwen-image-2.1](https://huggingface.co/madebyollin/texture-fix-vae-for-qwen-image-2.1) and
+[Comfy-Org/Qwen-Image-2.1](https://huggingface.co/Comfy-Org/Qwen-Image-2.1) (the original VAE).
Files go to `%LOCALAPPDATA%\KokonData\sdcpp` (Mac: `~/Library/Application Support/KokonData/sdcpp`) by default. You can point the setup screen at an
existing stable-diffusion.cpp folder instead; files that are already there are kept.
diff --git a/crates/qls-core/src/catalog.rs b/crates/qls-core/src/catalog.rs
index ab582e6..c114b59 100644
--- a/crates/qls-core/src/catalog.rs
+++ b/crates/qls-core/src/catalog.rs
@@ -299,8 +299,29 @@ pub const TURBO_Q4_K: Download = Download {
engine_tag: None,
};
+/// The VAE of new installs (0.9.3): Qwen's VAE with the decoder fine-tuned by madebyollin
+/// (author of TAESD) to remove the 2-px checkerboard of the original (#21). Same tensors and
+/// shapes, Qwen Research License like the model. Same-seed A/B on 5 cases at 1536² (2026-10-16):
+/// checkerboard 10–48% → 1–4% (coherent 2-px amplitude, noise ≈ 2–3%), slightly more fine
+/// detail, colours within 1/255, same speed.
pub const VAE: Download = Download {
id: "vae",
+ label: "Qwen-Image 2.1 VAE (texture fix)",
+ kind: FileKind::Model,
+ url: "https://huggingface.co/madebyollin/texture-fix-vae-for-qwen-image-2.1/resolve/main/texture_fix_vae_for_qwen_image_2.1_bf16.safetensors",
+ fallback_urls: &[],
+ page: "https://huggingface.co/madebyollin/texture-fix-vae-for-qwen-image-2.1",
+ size: 675_509_688,
+ sha256: "36f56608b02077a50a08ea3dbcdb88351298ceba49948f41f9f87186378e6908",
+ dest: "models/qwen21/texture_fix_vae_for_qwen_image_2.1_bf16.safetensors",
+ provides: &[],
+ engine_tag: None,
+};
+
+/// Qwen's original VAE, installed up to 0.9.2. Kept while its owner has not chosen the texture
+/// fix ([`official_vae`]); deleted once they have ([`unused_original_vae`]).
+pub const VAE_ORIGINAL: Download = Download {
+ id: "vae_original",
label: "Qwen-Image 2.1 VAE",
kind: FileKind::Model,
url: "https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/vae/qwen_image_2.1_vae_bf16.safetensors",
@@ -313,6 +334,21 @@ pub const VAE: Download = Download {
engine_tag: None,
};
+/// The VAE the official files use in `sdcpp_dir`: the texture fix once it is there, else the
+/// original of an earlier install (its owner has not accepted the new one), else the texture
+/// fix to download. Updating is the user's choice, so nothing here downloads it uninvited.
+pub fn official_vae(sdcpp_dir: &Path) -> Download {
+ if !VAE.is_present(sdcpp_dir) && VAE_ORIGINAL.is_present(sdcpp_dir) { VAE_ORIGINAL } else { VAE }
+}
+
+/// The original VAE in the app's own folder once the texture fix replaced it: no profile
+/// uses it any more, so it can be deleted.
+pub fn unused_original_vae(cfg: &crate::config::AppConfig) -> Option<PathBuf> {
+ let old = VAE_ORIGINAL.path(&cfg.sdcpp_dir);
+ let used = cfg.profiles.iter().any(|p| p.vae == old);
+ (VAE.is_present(&cfg.sdcpp_dir) && !used && old.is_file()).then_some(old)
+}
+
/// Text encoder from Qwen's own GGUF repository (the one sd.cpp's docs point to).
pub const TEXT_ENCODER_Q4_K_M: Download = Download {
id: "text_encoder_q4_k_m",
@@ -517,15 +553,16 @@ pub fn recommended_preset(vram_mib: Option<u64>) -> &'static Preset {
}
}
-/// Everything a preset needs on `backend`, in download order (small, essential files first).
-/// Superscale-SP is the default upscaler on PCs only (on Metal it takes minutes per image).
-pub fn downloads_for(p: &Preset, backend: GpuBackend) -> Vec<Download> {
+/// Everything a preset needs on `backend` in `sdcpp_dir`, in download order (small, essential
+/// files first). Superscale-SP is the default upscaler on PCs only (on Metal it takes minutes
+/// per image).
+pub fn downloads_for(p: &Preset, backend: GpuBackend, sdcpp_dir: &Path) -> Vec<Download> {
let mut v = engine_downloads(backend);
v.push(UPSCALER);
if backend != GpuBackend::Metal {
v.push(SUPERSCALE);
}
- v.extend([VAE, VISION_PROJECTOR, p.text_encoder, p.diffusion]);
+ v.extend([official_vae(sdcpp_dir), VISION_PROJECTOR, p.text_encoder, p.diffusion]);
v
}
@@ -533,7 +570,7 @@ pub fn downloads_for(p: &Preset, backend: GpuBackend) -> Vec<Download> {
/// (a piece the user chose to download, or an official file deleted from their folder), each
/// saved where the profile expects it. Existing files are never replaced, whatever their name.
pub fn profile_model_downloads(profile: &crate::config::ModelProfile) -> Vec<Download> {
- let official = [TURBO_Q4_K, VAE, TEXT_ENCODER_Q4_K_M, TEXT_ENCODER_Q8_0, VISION_PROJECTOR];
+ let official = [TURBO_Q4_K, VAE, VAE_ORIGINAL, TEXT_ENCODER_Q4_K_M, TEXT_ENCODER_Q8_0, VISION_PROJECTOR];
profile
.files()
.into_iter()
@@ -589,7 +626,7 @@ mod tests {
#[test]
fn catalog_is_well_formed() {
- 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, SUPERSCALE, ULTRASHARP];
+ let all = [ENGINE_CUDA, CUDA_RUNTIME, ENGINE_VULKAN, ENGINE_METAL, TURBO_Q4_K, VAE, VAE_ORIGINAL, TEXT_ENCODER_Q4_K_M, TEXT_ENCODER_Q8_0, VISION_PROJECTOR, UPSCALER, SUPERSCALE, ULTRASHARP];
for d in all {
assert!(d.urls().all(|u| u.starts_with("https://")), "{}", d.id);
assert_eq!(d.sha256.len(), 64, "{}", d.id);
@@ -613,13 +650,13 @@ mod tests {
assert_eq!(upscaler_download(name).is_some(), *name != crate::config::LANCZOS, "{name}");
}
assert_eq!(upscaler_download(crate::config::UPSCALER_CHOICES[0].0).unwrap().id, "upscaler_superscale");
- let metal = downloads_for(&PRESETS[0], GpuBackend::Metal);
+ let metal = downloads_for(&PRESETS[0], GpuBackend::Metal, Path::new("new"));
assert!(metal.iter().all(|d| d.id != "upscaler_superscale"), "Macs default to Lanczos: no Superscale download");
for p in PRESETS {
- let cuda = downloads_for(p, GpuBackend::Cuda);
+ let cuda = downloads_for(p, GpuBackend::Cuda, Path::new("new"));
assert_eq!(cuda.len(), 8);
assert!(cuda.iter().any(|d| d.id == "upscaler") && cuda.iter().any(|d| d.id == "upscaler_superscale"), "MoSR (bundled) and the default model");
- let vk = downloads_for(p, GpuBackend::Vulkan);
+ let vk = downloads_for(p, GpuBackend::Vulkan, Path::new("new"));
assert_eq!(vk.len(), 7);
assert!(vk.iter().all(|d| d.id != "engine_cuda" && d.id != "cuda_runtime"));
}
@@ -710,6 +747,41 @@ mod tests {
assert_eq!(all.iter().map(|d| d.id).collect::<Vec<_>>(), ["engine_vulkan", "upscaler", "upscaler_superscale", "vision_projector"]);
}
+ #[test]
+ fn texture_fix_vae_replaces_the_original_only_once_downloaded() {
+ let dir = tempfile::tempdir().unwrap();
+ let d = dir.path();
+ std::fs::create_dir_all(join_rel(d, MODEL_SUBDIR)).unwrap();
+ let fill = |f: Download| std::fs::File::create(f.path(d)).unwrap().set_len(f.size).unwrap();
+ let mut cfg = crate::config::AppConfig { sdcpp_dir: d.to_path_buf(), ..Default::default() };
+ cfg.normalize();
+ // A new install gets the texture fix.
+ assert_eq!(official_vae(d).id, "vae");
+ assert_eq!(cfg.profile().vae, VAE.path(d));
+ // An earlier install keeps its original VAE until the user accepts the new one.
+ fill(VAE_ORIGINAL);
+ cfg.normalize();
+ assert_eq!(official_vae(d).id, "vae_original");
+ assert_eq!(cfg.profile().vae, VAE_ORIGINAL.path(d));
+ assert!(downloads_for(&PRESETS[1], GpuBackend::Cuda, d).iter().all(|x| x.id != "vae"), "never downloaded uninvited");
+ assert_eq!(unused_original_vae(&cfg), None, "in use");
+ // Once downloaded, the official files switch and the original can go.
+ fill(VAE);
+ cfg.normalize();
+ assert_eq!(cfg.profile().vae, VAE.path(d));
+ assert_eq!(unused_original_vae(&cfg), Some(VAE_ORIGINAL.path(d)));
+ // ...unless the user's own profile points to it.
+ cfg.set_user_files(crate::config::ModelProfile::user(d.join("m.gguf"), VAE_ORIGINAL.path(d), d.join("te.gguf"), None));
+ assert_eq!(unused_original_vae(&cfg), None);
+ assert!(!cfg.uses_improved_vae());
+ // Accepting it moves that profile to the app's copy; the user's file is never deleted
+ // (only the app's folder is cleaned, and only files no profile uses).
+ cfg.use_improved_vae();
+ assert!(cfg.uses_improved_vae());
+ assert_eq!(cfg.profile().vae, VAE.path(d));
+ assert_eq!(unused_original_vae(&cfg), Some(VAE_ORIGINAL.path(d)));
+ }
+
#[test]
fn presence_checks() {
let dir = tempfile::tempdir().unwrap();
diff --git a/crates/qls-core/src/config.rs b/crates/qls-core/src/config.rs
index d03a9e6..c428444 100644
--- a/crates/qls-core/src/config.rs
+++ b/crates/qls-core/src/config.rs
@@ -211,7 +211,7 @@ impl ModelProfile {
/// 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};
+ use crate::catalog::{official_vae, VISION_PROJECTOR};
let quant = preset.diffusion.dest.rsplit('-').next().unwrap_or("").trim_end_matches(".gguf");
Self {
id: OFFICIAL_PROFILE_ID.into(),
@@ -220,7 +220,7 @@ impl ModelProfile {
source: ProfileSource::Official,
scan_dir: None,
diffusion_model: preset.diffusion.path(sdcpp_dir),
- vae: VAE.path(sdcpp_dir),
+ vae: official_vae(sdcpp_dir).path(sdcpp_dir),
text_encoder: preset.text_encoder.path(sdcpp_dir),
vision_projector: Some(VISION_PROJECTOR.path(sdcpp_dir)),
backend_args: vec![],
@@ -592,6 +592,23 @@ impl AppConfig {
self.active_profile = USER_PROFILE_ID.into();
}
+ /// The active model uses the texture-fix VAE (#21).
+ pub fn uses_improved_vae(&self) -> bool {
+ self.profile().vae.file_name().is_some_and(|n| n.eq_ignore_ascii_case(crate::catalog::VAE.file_name()))
+ }
+
+ /// Makes the active model use the texture-fix VAE in the app's folder, once downloaded. The
+ /// official files switch by themselves (`catalog::official_vae`); the user's own profile
+ /// points to it instead of their VAE, which stays where it is.
+ pub fn use_improved_vae(&mut self) {
+ let vae = crate::catalog::VAE.path(&self.sdcpp_dir);
+ let active = self.active_profile.clone();
+ if let Some(p) = self.profiles.iter_mut().find(|p| p.id == active && !p.is_official()) {
+ p.vae = vae;
+ }
+ self.normalize();
+ }
+
/// Makes the official files the active model (they may still need downloading).
pub fn use_official(&mut self) {
self.normalize();
diff --git a/crates/qls-core/src/engine.rs b/crates/qls-core/src/engine.rs
index be95ebd..f6ab329 100644
--- a/crates/qls-core/src/engine.rs
+++ b/crates/qls-core/src/engine.rs
@@ -217,6 +217,16 @@ impl Engine {
}
}
+ /// Deletes the original VAE from the app's folder once the texture fix replaced it and no
+ /// profile uses it (after the update, and at start in case a busy server held it open).
+ pub fn remove_unused_original_vae(&self) {
+ let Some(old) = crate::catalog::unused_original_vae(&self.config()) else { return };
+ match std::fs::remove_file(&old) {
+ Ok(()) => tracing::info!("deleted the original VAE {} (replaced by the texture fix)", old.display()),
+ Err(e) => tracing::warn!("could not delete the original VAE {} yet: {e}", old.display()),
+ }
+ }
+
/// The installed engine is from another release than the catalog's (or the engine
/// manifest's): Setup offers the update. An engine without a release marker (built by hand,
/// an external server) only needs it when it cannot run the upscaler.
diff --git a/crates/qls-core/src/installer.rs b/crates/qls-core/src/installer.rs
index 0024382..70bb486 100644
--- a/crates/qls-core/src/installer.rs
+++ b/crates/qls-core/src/installer.rs
@@ -945,7 +945,7 @@ mod tests {
std::fs::write(&f, b"abc").unwrap();
assert_eq!(sha256_file(&f).unwrap(), "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad");
let p = crate::catalog::preset("16gb").unwrap();
- let all = crate::catalog::downloads_for(p, crate::config::GpuBackend::Cuda);
+ let all = crate::catalog::downloads_for(p, crate::config::GpuBackend::Cuda, dir.path());
let (dl, disk) = space_needed(dir.path(), &all);
assert_eq!(dl, all.iter().map(|d| d.size).sum::<u64>());
assert!(disk > dl, "zips need room to extract");
diff --git a/crates/qls-core/src/modelfile.rs b/crates/qls-core/src/modelfile.rs
index 7bbc1dc..ebc79d3 100644
--- a/crates/qls-core/src/modelfile.rs
+++ b/crates/qls-core/src/modelfile.rs
@@ -17,7 +17,7 @@ use std::path::{Path, PathBuf};
use serde::{Deserialize, Serialize};
-use crate::catalog::{Download, Preset, TEXT_ENCODER_Q4_K_M, TEXT_ENCODER_Q8_0, TURBO_Q4_K, VAE, VISION_PROJECTOR};
+use crate::catalog::{Download, Preset, TEXT_ENCODER_Q4_K_M, TEXT_ENCODER_Q8_0, TURBO_Q4_K, VAE, VAE_ORIGINAL, VISION_PROJECTOR};
use crate::config::ModelProfile;
use crate::error::AppError;
@@ -84,7 +84,7 @@ struct Tensor {
/// The catalog download a file with this name and size is (any folder).
pub fn official_download(path: &Path, size: u64) -> Option<Download> {
let name = path.file_name()?.to_string_lossy().to_ascii_lowercase();
- [TURBO_Q4_K, VAE, TEXT_ENCODER_Q4_K_M, TEXT_ENCODER_Q8_0, VISION_PROJECTOR]
+ [TURBO_Q4_K, VAE, VAE_ORIGINAL, TEXT_ENCODER_Q4_K_M, TEXT_ENCODER_Q8_0, VISION_PROJECTOR]
.into_iter()
.find(|d| d.size == size && d.dest.rsplit('/').next().is_some_and(|f| f.eq_ignore_ascii_case(&name)))
}
diff --git a/crates/qls-core/src/process.rs b/crates/qls-core/src/process.rs
index 5d67ba4..d500afb 100644
--- a/crates/qls-core/src/process.rs
+++ b/crates/qls-core/src/process.rs
@@ -730,7 +730,7 @@ mod tests {
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-turbo-Q4_K.gguf"))));
- assert!(s.contains(&format!("--vae {}", m("qwen_image_2.1_vae_bf16.safetensors"))));
+ assert!(s.contains(&format!("--vae {}", m("texture_fix_vae_for_qwen_image_2.1_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"))));
assert!(s.contains("--backend cuda0 --params-backend te=cpu"));
diff --git a/crates/qls-service/src/api.rs b/crates/qls-service/src/api.rs
index 6789654..a9f7446 100644
--- a/crates/qls-service/src/api.rs
+++ b/crates/qls-service/src/api.rs
@@ -70,6 +70,7 @@ pub fn router(state: Arc<AppState>) -> Router {
.route("/models/inspect", post(models_inspect))
.route("/models/user", post(models_set_user))
.route("/models/use", post(models_use))
+ .route("/models/vae", post(models_improve_vae))
.route("/upscalers", get(list_upscalers))
.route("/upscalers/{name}/download", post(download_upscaler))
.route("/config", get(get_config).put(put_config))
@@ -254,7 +255,7 @@ async fn setup_hardware(State(s): St, Query(q): Query<HardwareQ>) -> ApiResult<J
let presets: Vec<Value> = catalog::PRESETS
.iter()
.map(|p| {
- let files = catalog::downloads_for(p, backend);
+ let files = catalog::downloads_for(p, backend, &dir);
let (download, disk) = installer::space_needed(&dir, &files);
json!({
"id": p.id, "label": if unified { p.unified_label } else { p.label }, "summary": if unified { p.unified_summary } else { p.summary }, "verified": p.verified, "min_vram_mib": p.min_vram_mib,
@@ -334,7 +335,7 @@ async fn install_start(State(s): St, Json(b): Json<InstallBody>) -> ApiResult<Js
let u = cfg.user_profile().ok_or_else(|| AppError::invalid("Choose your model files first."))?;
catalog::downloads_for_profile(u, backend)
} else {
- catalog::downloads_for(preset, backend)
+ catalog::downloads_for(preset, backend, &cfg.sdcpp_dir)
};
// A running server keeps its DLLs open; the engine zip may need to replace them.
let st = s.engine.server.status();
@@ -1086,6 +1087,43 @@ async fn save_and_restart(s: &AppState, cfg: AppConfig) -> ApiResult<()> {
Ok(())
}
+/// Downloads the texture-fix VAE (#21) into the app's folder and makes the active model use
+/// it (progress in `/setup/install`). The server holds the old file open, so it restarts once
+/// idle; then the original VAE in the app's folder is deleted if no profile uses it. The user's
+/// own VAE is never deleted.
+async fn models_improve_vae(State(s): St) -> ApiResult<Json<Value>> {
+ let dir = s.engine.config().sdcpp_dir;
+ let engine = s.engine.clone();
+ let on_finish = Box::new(move |complete: bool| {
+ if !complete {
+ return;
+ }
+ let mut c = engine.config();
+ c.use_improved_vae();
+ let restart = match engine.set_config(c) {
+ Ok(r) => r,
+ Err(e) => return tracing::error!("could not switch to the new VAE: {}", e.message),
+ };
+ tracing::info!("switched to the texture-fix VAE");
+ tokio::spawn(async move {
+ if restart {
+ while engine.has_pending_work() {
+ tokio::time::sleep(Duration::from_secs(2)).await;
+ }
+ let st = engine.server.status();
+ if st.owned && st.state != qls_core::process::ServerState::Stopped {
+ engine.server.stop().await;
+ engine.emit_server();
+ }
+ }
+ let e = engine.clone();
+ let _ = tokio::task::spawn_blocking(move || e.remove_unused_original_vae()).await;
+ });
+ });
+ s.engine.installer.start(dir, "vae", vec![catalog::VAE], on_finish)?;
+ Ok(Json(serde_json::to_value(s.engine.installer.status()).unwrap()))
+}
+
fn role_of(label: &str) -> Option<Role> {
Role::ALL.into_iter().find(|r| r.label() == label)
}
@@ -1122,6 +1160,12 @@ async fn models_status(State(s): St) -> ApiResult<Json<Value>> {
"user_installed": cfg.user_profile().is_some_and(|u| u.files().iter().all(|(_, f, _)| f.is_file())),
"official_installed": official_installed,
"default_download_dir": catalog::join_rel(&cfg.sdcpp_dir, catalog::MODEL_SUBDIR),
+ // The texture-fix VAE (#21): in use, or what switching to it downloads.
+ "vae": {
+ "improved": cfg.uses_improved_vae(),
+ "download_bytes": if catalog::VAE.is_present(&cfg.sdcpp_dir) { 0 } else { catalog::VAE.size },
+ "page": catalog::VAE.page,
+ },
})
})
.await
diff --git a/crates/qls-service/src/main.rs b/crates/qls-service/src/main.rs
index 58f592b..19075e3 100644
--- a/crates/qls-service/src/main.rs
+++ b/crates/qls-service/src/main.rs
@@ -135,6 +135,8 @@ async fn main() {
// The upscaler ships with the app: put it where sd-server looks (no download needed).
let e = engine.clone();
let _ = tokio::task::spawn_blocking(move || e.place_bundled_upscaler()).await;
+ // The original VAE left behind when a busy server held it open during the update.
+ engine.remove_unused_original_vae();
let token = load_or_create_token(&dir);
let info = ServiceInfo { port, token: token.clone(), pid: std::process::id(), version: APP_VERSION.into() };
let _ = std::fs::write(service_info_path(), serde_json::to_string_pretty(&info).unwrap());
@@ -170,6 +172,7 @@ async fn main() {
if engine.server.stop().await {
tracing::info!("stopped sd-server on exit");
}
+ engine.remove_unused_original_vae();
} else {
tracing::info!("leaving sd-server running (keep_server_running)");
}
diff --git a/scripts/dev/test-vae-update.ps1 b/scripts/dev/test-vae-update.ps1
new file mode 100644
index 0000000..7333f37
--- /dev/null
+++ b/scripts/dev/test-vae-update.ps1
@@ -0,0 +1,142 @@
+# Manual test of the 0.9.3 VAE update (#21) in an isolated Kokon: its own config, data, ports and
+# stable-diffusion.cpp folder under .test-data\vae-update. The installed Kokon,
+# %APPDATA%\Kokon\config.json and the real model folders are never written to.
+#
+# The test folder holds hardlinks to the official files of your installed Kokon (no extra disk
+# space; when the update deletes the old VAE it deletes the link, never the original).
+#
+# powershell -ExecutionPolicy Bypass -File scripts\dev\test-vae-update.ps1 [-Action <action>] [options]
+#
+# Actions
+# setup (default) Build a 0.9.2 install and start Kokon on it (npm run tauri dev). What's new
+# opens with the "New image decoder" offer: Update now downloads 675 MB.
+# -Scenario official the official files, original VAE (most users)
+# -Scenario own the user's own files (#14) with their own VAE: accepting must
+# point the profile at Kokon's copy and keep their file
+# -Reset start again as a fresh 0.9.2 install (deletes the test folder)
+# Without -Reset a second run is a restart: the config the app saved is kept.
+# status What the test Kokon sees (GET /models) and which VAE files are on disk.
+# stop Stop the test service and its sd-server (they outlive the window).
+#
+# Close the installed Kokon first: both would load a model on the same GPU.
+param(
+ [ValidateSet('setup', 'status', 'stop')] [string]$Action = 'setup',
+ [ValidateSet('official', 'own')] [string]$Scenario = 'official',
+ [string]$From = (Join-Path $env:LOCALAPPDATA 'KokonData\sdcpp'),
+ [switch]$Reset
+)
+
+$ErrorActionPreference = 'Stop'
+$root = Resolve-Path "$PSScriptRoot\..\.."
+$test = Join-Path $root '.test-data\vae-update'
+$data = Join-Path $test 'data'
+$config = Join-Path $test 'config'
+$sdcpp = Join-Path $test 'sdcpp'
+$qwen = Join-Path $sdcpp 'models\qwen21'
+$own = Join-Path $test 'own-vae\qwen_image_2.1_vae_bf16.safetensors'
+$realConfig = Join-Path $env:APPDATA 'Kokon\config.json'
+
+function RealConfigHash {
+ if (Test-Path $realConfig) { (Get-FileHash $realConfig -Algorithm SHA256).Hash.Substring(0, 16) } else { 'none' }
+}
+
+function StopTestProcesses {
+ $mine = Get-Process kokon-service, sd-server -ErrorAction SilentlyContinue | Where-Object { $_.Path -and ($_.Path.StartsWith("$root\target", 'OrdinalIgnoreCase') -or $_.Path.StartsWith("$test", 'OrdinalIgnoreCase')) }
+ foreach ($p in $mine) {
+ Write-Host "Stopping $($p.Name) ($($p.Path))"
+ Stop-Process -Id $p.Id -Force
+ }
+ if (-not $mine) { Write-Host 'No test processes running.' }
+}
+
+switch ($Action) {
+ 'stop' {
+ StopTestProcesses
+ return
+ }
+ 'status' {
+ $info = Get-Content (Join-Path $data 'service.json') -Raw | ConvertFrom-Json
+ $h = @{ Authorization = "Bearer $($info.token)" }
+ $m = Invoke-RestMethod -Uri "http://127.0.0.1:$($info.port)/api/v1/models" -Headers $h
+ Write-Host "Active: $($m.active.display_name) ($($m.active.source))"
+ Write-Host "New VAE in use: $($m.vae.improved); download: $([math]::Round($m.vae.download_bytes / 1e6)) MB"
+ $vae = ($m.slots | Where-Object { $_.role -eq 'vae' }).path
+ Write-Host "VAE path: $vae"
+ foreach ($f in @((Join-Path $qwen 'qwen_image_2.1_vae_bf16.safetensors'), (Join-Path $qwen 'texture_fix_vae_for_qwen_image_2.1_bf16.safetensors'), $own)) {
+ Write-Host (" {0} {1}" -f $(if (Test-Path $f) { 'present' } else { 'absent ' }), $f)
+ }
+ Write-Host "Real config.json (must not change): $(RealConfigHash)"
+ return
+ }
+}
+
+# --- setup ---
+$off = Join-Path $From 'models\qwen21'
+$official = @{
+ diffusion = Join-Path $off 'qwen-image-2.1-turbo-Q4_K.gguf'
+ vae = Join-Path $off 'qwen_image_2.1_vae_bf16.safetensors'
+ te = Join-Path $off 'Qwen3VL-8B-Instruct-Q4_K_M.gguf'
+ mmproj = Join-Path $off 'mmproj-Qwen3VL-8B-Instruct-F16.gguf'
+}
+foreach ($f in $official.Values) { if (-not (Test-Path $f)) { throw "Not found: $f. Pass -From with the folder of your installed Kokon models." } }
+if ([IO.Path]::GetPathRoot($off) -ne [IO.Path]::GetPathRoot("$test")) { throw "Hardlinks need $test on the same drive as $off." }
+if (Get-Process sd-server -ErrorAction SilentlyContinue) { Write-Warning "sd-server is running: close Kokon first, or both load a model on the GPU." }
+
+StopTestProcesses
+if ($Reset -and (Test-Path $test)) {
+ # Only the test folder; the model files in it are hardlinks (the originals stay).
+ Remove-Item -Recurse -Force $test
+}
+New-Item -ItemType Directory -Force $data, $config, $qwen, (Join-Path $test 'output') | Out-Null
+
+# A 0.9.2 install: the official files with the original VAE (hardlinks).
+foreach ($f in $official.Values) {
+ $link = Join-Path $qwen (Split-Path $f -Leaf)
+ if (-not (Test-Path $link)) { New-Item -ItemType HardLink -Path $link -Target $f | Out-Null }
+}
+if ($Scenario -eq 'own' -and -not (Test-Path $own)) {
+ New-Item -ItemType Directory -Force (Split-Path $own) | Out-Null
+ New-Item -ItemType HardLink -Path $own -Target $official.vae | Out-Null
+}
+
+# The engine and upscalers of your installed Kokon.
+if (-not (Test-Path (Join-Path $sdcpp 'sd-server.exe'))) {
+ Get-ChildItem $From -File | Where-Object { $_.Extension -in '.exe', '.dll' -or $_.Name -eq 'kokon-engine.txt' } | Copy-Item -Destination $sdcpp
+ $up = Join-Path $From 'models\upscalers'
+ if (Test-Path $up) {
+ New-Item -ItemType Directory -Force (Join-Path $sdcpp 'models\upscalers') | Out-Null
+ Get-ChildItem $up -File | Copy-Item -Destination (Join-Path $sdcpp 'models\upscalers')
+ }
+ Write-Host "Copied the engine from $From"
+}
+
+$cfg = @{
+ schemaVersion = 9; setupComplete = $true; sdcppDir = "$sdcpp"; serverPort = 39192; servicePort = 39193
+ outputDir = (Join-Path $test 'output'); idleUnloadMinutes = 5; activeProfile = 'qwen-image-2.1'
+ # Updating from 0.9.2: the welcome was seen, the 0.9.2 notes too.
+ ui = @{ welcomeSeen = $true; tourSeen = $true; whatsNewSeen = '0.9.2' }
+}
+if ($Scenario -eq 'own') {
+ $cfg.activeProfile = 'qwen-image-2.1-user'
+ $cfg.profiles = @(@{
+ id = 'qwen-image-2.1-user'; displayName = 'Qwen-Image 2.1 (your files)'; model = 'qwen-image-2.1'; source = 'user'
+ diffusionModel = (Join-Path $qwen 'qwen-image-2.1-turbo-Q4_K.gguf'); vae = $own
+ textEncoder = (Join-Path $qwen 'Qwen3VL-8B-Instruct-Q4_K_M.gguf'); visionProjector = (Join-Path $qwen 'mmproj-Qwen3VL-8B-Instruct-F16.gguf')
+ })
+}
+# Written once: a second run (without -Reset) continues from what the app saved, like a restart.
+$cfgFile = Join-Path $config 'config.json'
+if (-not (Test-Path $cfgFile)) {
+ # UTF-8 without BOM (Set-Content -Encoding utf8 in PowerShell 5.1 writes one; Kokon accepts both).
+ [IO.File]::WriteAllText($cfgFile, ($cfg | ConvertTo-Json -Depth 5))
+} else {
+ Write-Host "Keeping the saved test config (use -Reset to start again as a 0.9.2 install)."
+}
+
+Write-Host "Test environment: $test ($Scenario)" -ForegroundColor Cyan
+Write-Host "Real config.json (must not change): $(RealConfigHash)"
+Write-Host "Starting Kokon on it (close the window to stop)..." -ForegroundColor Cyan
+$env:QLS_DATA_DIR = $data
+$env:QLS_CONFIG_DIR = $config
+Push-Location $root
+try { npm run tauri dev } finally { Pop-Location }
diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx
index 937241a..43fdf36 100644
--- a/src/components/Settings.tsx
+++ b/src/components/Settings.tsx
@@ -125,6 +125,30 @@ export function Settings() {
}
};
+ // Switching to the new VAE (#21): download, then the service swaps it and deletes the old one.
+ const [vaeProgress, setVaeProgress] = useState<number | null>(null);
+ const improveVae = async () => {
+ try {
+ let st = await api.improveVae();
+ setVaeProgress(0);
+ while (st.running) {
+ await new Promise((r) => window.setTimeout(r, 700));
+ st = await api.installStatus();
+ const total = st.items.reduce((a, i) => a + i.size, 0);
+ setVaeProgress(total ? st.items.reduce((a, i) => a + i.received, 0) / total : 0);
+ }
+ const failed = st.items.find((i) => i.state === "failed");
+ if (failed) toastError(new Error(`${failed.label}: ${failed.error}`));
+ else if (st.complete) toastInfo("The new decoder is in use");
+ api.models().then(setMs, () => {});
+ api.config().then(setCfg, () => {});
+ } catch (e) {
+ toastError(e);
+ } finally {
+ setVaeProgress(null);
+ }
+ };
+
const close = () => setState({ overlay: null });
useEffect(() => {
const onKey = (e: KeyboardEvent) => e.key === "Escape" && close();
@@ -342,6 +366,29 @@ export function Settings() {
<PathField label="Vision projector (mmproj)" value={profile.visionProjector ?? ""} onChange={(v) => setProfile({ visionProjector: v || null })} />
</>
)}
+ {ms && (
+ <div className="setting-card">
+ <div className="setting-card-text">
+ <strong>Image decoder (VAE)</strong>
+ <span className="muted">
+ {ms.vae.improved
+ ? "The new decoder: no fine grid pattern on skin, hair and smooth areas."
+ : "A new decoder removes the fine grid pattern on skin, hair and smooth areas, with the same speed and colours. Switching downloads it and deletes the old one from Kokon's folder" +
+ (profile.source === "official" ? "." : "; your own VAE file stays where it is.")}
+ </span>
+ {vaeProgress !== null && (
+ <div className="progress" style={{ marginTop: 6 }}>
+ <i style={{ width: `${vaeProgress * 100}%` }} />
+ </div>
+ )}
+ </div>
+ {!ms.vae.improved && (
+ <button className="btn primary" disabled={vaeProgress !== null || dirty} title={dirty ? "Save or discard your changes first" : undefined} onClick={improveVae}>
+ <Download size={15} /> {vaeProgress !== null ? `${Math.floor(vaeProgress * 100)}%` : `Switch${ms.vae.download_bytes ? ` · ${formatBytes(ms.vae.download_bytes)}` : ""}`}
+ </button>
+ )}
+ </div>
+ )}
<UpscalerControls
model={cfg.upscalerModel}
blend={cfg.upscaleBlend}
diff --git a/src/components/WhatsNew.tsx b/src/components/WhatsNew.tsx
index e96065f..5b1c846 100644
--- a/src/components/WhatsNew.tsx
+++ b/src/components/WhatsNew.tsx
@@ -1,41 +1,44 @@
-import { CircleAlert, Cpu, Lightbulb, SlidersHorizontal, Zap } from "lucide-react";
+import { CircleAlert, Cpu, FolderOpen, Layers, Palette, Sparkles, ZoomIn } from "lucide-react";
import { useEffect, useState } from "react";
import { api } from "../lib/api";
import { formatBytes, installProgress, installStep, installTimeLeft } from "../lib/logic";
-import { isMac } from "../lib/platform";
import { refreshStatus, setState, toastError, useStore } from "../lib/store";
-import type { GpuBackend, InstallItem, InstallStatus } from "../lib/types";
+import type { GpuBackend, InstallItem, InstallStatus, ModelsStatus } from "../lib/types";
import { KokonMark } from "./Welcome";
/** The release these notes describe. Shown once to people updating from an earlier version. */
-export const WHATS_NEW_VERSION = "0.9.2";
+export const WHATS_NEW_VERSION = "0.9.3";
const NEWS = [
- isMac
- ? {
- icon: Zap,
- title: "Larger edits",
- text: "Your photo is given to the model at 1 MP, which leaves more room for the result: edits render larger in about the same time.",
- }
- : {
- icon: Zap,
- title: "Native 2K edits, faster",
- text: "On graphics cards with 16 GB or more, 2K edits are drawn at full size instead of enlarged afterwards: sharper, and about a third faster (41 s instead of 66 s on an RTX 5070 Ti).",
- },
{
- icon: SlidersHorizontal,
- title: "Reference detail",
- text: "In the Advanced menu: how large your source images are given to the model. 1 MP (the default in every new chat) leaves more room for the result; Full keeps finer source detail.",
+ icon: Sparkles,
+ title: "Cleaner images",
+ text: "A new image decoder removes the fine grid pattern that showed on skin, hair and smooth areas. Same speed, same colours.",
+ },
+ {
+ icon: FolderOpen,
+ title: "Use the model files you have",
+ text: "Already downloaded Qwen-Image 2.1 for ComfyUI or another app? Point Kokon at those files instead of downloading them again.",
+ },
+ {
+ icon: ZoomIn,
+ title: "Zoom and pan",
+ text: "Zoom into images in full screen and in the inpaint editor. The painted area now shows on the image while it is being edited.",
},
{
icon: Cpu,
- title: "Official engine, kept up to date",
- text: "Kokon now runs the official stable-diffusion.cpp release, which includes our MoSR upscaler, and checks every few days for a newer engine tested with Kokon.",
+ title: "Pick your graphics card",
+ text: "On computers with more than one GPU, setup lets you choose which one runs the model and sizes the preset for it.",
+ },
+ {
+ icon: Palette,
+ title: "Light and dark",
+ text: "Settings → General → Appearance: System, Light or Dark. Press ? for the keyboard shortcuts.",
},
{
- icon: Lightbulb,
- title: "Prompt tips",
- text: "A hint under the prompt and a Prompt tips panel: describing the scene, not just the subject, keeps the action you asked for.",
+ icon: Layers,
+ title: "Coming in 0.9.4: LoRA",
+ text: "Add LoRAs to your edits, with a weight for each. A curated list of LoRAs tested with Kokon, one click to download, and your own files too.",
},
];
@@ -59,16 +62,27 @@ export function whatsNewDue(ui: Record<string, unknown>, engine: { release: stri
return ui.whatsNewSeen !== WHATS_NEW_VERSION || (!!engine?.update_needed && ui.engineUpdateSkipped !== engine.release);
}
-/** What's new in this release, plus the engine download when the release needs a newer
- * stable-diffusion.cpp (only the files that changed; models and settings stay as they are). */
+type Step = "engine" | "vae";
+
+/** What's new in this release, plus the downloads it offers: the engine when the release needs
+ * a newer stable-diffusion.cpp (only the files that changed), and the new VAE (#21), which
+ * replaces the old one only if the user accepts. */
export function WhatsNew() {
const engine = useStore((s) => s.status?.engine);
const needsEngine = !!engine?.update_needed;
const [missing, setMissing] = useState<InstallItem[] | null>(null);
const [target, setTarget] = useState<{ preset: string; backend: GpuBackend } | null>(null);
+ const [ms, setMs] = useState<ModelsStatus | null>(null);
+ // With both offered, each can be left out.
+ const [wantEngine, setWantEngine] = useState(true);
+ const [wantVae, setWantVae] = useState(true);
+ const [queue, setQueue] = useState<Step[]>([]);
const [inst, setInst] = useState<InstallStatus | null>(null);
+ const [finished, setFinished] = useState(false);
useEffect(() => {
+ api.models().then(setMs, () => {});
+ api.installStatus().then((i) => i.running && setInst(i), () => {});
if (!needsEngine) return;
api.hardware().then((h) => {
const preset = h.presets.find((p) => p.id === h.current) ?? h.presets.find((p) => p.id === h.recommended);
@@ -77,37 +91,69 @@ export function WhatsNew() {
const files = h.active_source === "user" ? h.user_files?.files ?? [] : preset?.files ?? [];
setMissing(files.filter((f) => f.state !== "present"));
}, toastError);
- api.installStatus().then((i) => i.running && setInst(i), () => {});
}, [needsEngine]);
+ const offerVae = !!ms && !ms.vae.improved;
+ const engineBytes = (missing ?? []).reduce((a, i) => a + Math.max(0, i.size - i.received), 0);
+ const vaeBytes = ms?.vae.download_bytes ?? 0;
+
+ const begin = async (step: Step) => {
+ try {
+ if (step === "engine") {
+ if (!target) return false;
+ setInst(await api.install(target.preset, target.backend, false));
+ } else {
+ setInst(await api.improveVae());
+ }
+ return true;
+ } catch (e) {
+ toastError(e);
+ return false;
+ }
+ };
+
+ // One download at a time: the next step starts when the previous one completed.
const running = inst?.running ?? false;
useEffect(() => {
if (!running) return;
- const t = window.setInterval(() => api.installStatus().then(setInst, () => {}), 500);
+ const t = window.setInterval(
+ () =>
+ api.installStatus().then((i) => {
+ setInst(i);
+ if (i.running || !i.complete) return;
+ const [next, ...rest] = queue;
+ setQueue(rest);
+ if (next) begin(next);
+ else {
+ setFinished(true);
+ api.models().then(setMs, () => {});
+ }
+ }, () => {}),
+ 500,
+ );
return () => window.clearInterval(t);
- }, [running]);
+ }, [running, queue]);
- const items = inst?.items ?? missing ?? [];
+ const items = inst?.items ?? [];
const failed = items.filter((i) => i.state === "failed");
- const done = !!inst && !inst.running && inst.complete;
- const size = (missing ?? []).reduce((a, i) => a + Math.max(0, i.size - i.received), 0);
const prog = installProgress(items);
- const showEngine = needsEngine || !!inst;
+ const steps: Step[] = [...(needsEngine && wantEngine ? ["engine" as const] : []), ...(offerVae && wantVae ? ["vae" as const] : [])];
+ const size = (steps.includes("engine") ? engineBytes : 0) + (steps.includes("vae") ? vaeBytes : 0);
+ const offering = (needsEngine || offerVae) && !finished;
// Macs default to Lanczos: their update has no Superscale-SP download.
const getsSuperscale = (missing ?? []).some((i) => i.id === "upscaler_superscale");
+ const both = needsEngine && offerVae;
const update = async () => {
- if (!target) return;
- try {
- setInst(await api.install(target.preset, target.backend, false));
- } catch (e) {
- toastError(e);
- }
+ const [first, ...rest] = steps;
+ if (!first) return;
+ setQueue(rest);
+ await begin(first);
};
const close = (postponed: boolean) => {
if (running) api.cancelInstall().catch(() => {});
setState({ overlay: null });
- markSeen(postponed && engine ? engine.release : null);
+ markSeen(postponed && engine && needsEngine ? engine.release : null);
refreshStatus();
api.startBackend().then(refreshStatus, () => refreshStatus());
};
@@ -126,13 +172,46 @@ export function WhatsNew() {
</div>
))}
</div>
- {showEngine && !done && (
- <p className="welcome-lead">
- A newer stable-diffusion.cpp is ready, the engine that runs the models on your graphics chip{getsSuperscale ? ", plus the Superscale-SP model" : ""}. Your images,
- models and settings stay as they are.
- </p>
+
+ {offering && !running && (
+ <div className="update-offers">
+ {offerVae && (
+ <div className="setup-note update-offer">
+ {both && <input type="checkbox" checked={wantVae} onChange={(e) => setWantVae(e.target.checked)} aria-label="Include the new decoder" />}
+ <div>
+ <strong>New image decoder{vaeBytes ? ` · ${formatBytes(vaeBytes)}` : ""}</strong>
+ <span>
+ For the cleaner images above, Kokon needs to replace the decoder it installed. The old file is deleted once the new one is in place.
+ {ms?.active.source === "user" && " Your own VAE file stays where it is: Kokon uses its own copy."} If you keep the current one, you can switch any time in
+ Settings → Models.
+ </span>
+ <details className="model-files">
+ <summary>What is it?</summary>
+ <span className="update-detail">
+ The decoder (VAE, variational autoencoder) turns the model's result into pixels. Qwen's original decoder leaves a faint 2-pixel checkerboard on fine
+ texture. This version, retrained by madebyollin (the author of TAESD), removes it: the image, its colours and the time stay the same. Same license as
+ the model.
+ </span>
+ </details>
+ </div>
+ </div>
+ )}
+ {needsEngine && (
+ <div className="setup-note update-offer">
+ {both && <input type="checkbox" checked={wantEngine} onChange={(e) => setWantEngine(e.target.checked)} aria-label="Include the engine update" />}
+ <div>
+ <strong>Engine update{engineBytes ? ` · ${formatBytes(engineBytes)}` : ""}</strong>
+ <span>
+ A newer stable-diffusion.cpp is ready, the engine that runs the models on your graphics chip{getsSuperscale ? ", plus the Superscale-SP model" : ""}.
+ Your images, models and settings stay as they are.
+ </span>
+ </div>
+ </div>
+ )}
+ </div>
)}
- {(running || (inst && !done && !failed.length)) && (
+
+ {(running || (inst && !finished && !failed.length && !inst.complete)) && (
<div className="setup-card setup-progress" style={{ width: "100%", textAlign: "left" }}>
<div className="setup-progress-head">
<span className="pct">{Math.floor(prog.frac * 100)}%</span>
@@ -150,28 +229,26 @@ export function WhatsNew() {
{failed.length > 0 && !running && (
<div className="setup-note" style={{ width: "100%", textAlign: "left" }}>
<CircleAlert size={14} /> {failed.map((f) => `${f.label}: ${f.error}`).join(" · ")}
- <div className="muted">Try again, or open Settings → Models → Set up models… to download it by hand.</div>
+ <div className="muted">Try again, or open Settings → Models to do it later.</div>
</div>
)}
- {!showEngine || done ? (
+ {!offering ? (
<button className="btn primary big" onClick={() => close(false)}>
- {done ? "Start creating" : "Got it"}
+ {finished ? "Start creating" : "Got it"}
</button>
) : (
- <>
+ <div className="welcome-actions">
<div style={{ display: "flex", gap: 10 }}>
- <button className="btn primary big" disabled={running || !target || missing === null} onClick={update}>
+ <button className="btn primary big" disabled={running || !steps.length || (steps.includes("engine") && (!target || missing === null))} onClick={update}>
{failed.length ? "Try again" : running ? "Updating…" : `Update now${size ? ` · ${formatBytes(size)}` : ""}`}
</button>
<button className="btn big" onClick={() => close(true)}>
- Later
+ {offerVae && !needsEngine ? "Keep the current one" : "Later"}
</button>
</div>
- <span className="muted welcome-foot">
- You can update later from Settings → Models → Set up models…
- </span>
- </>
+ <span className="muted welcome-foot">You can update later from Settings → Models.</span>
+ </div>
)}
</div>
</div>
diff --git a/src/lib/api.ts b/src/lib/api.ts
index a85eb3d..dcb3455 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -75,6 +75,8 @@ export const api = {
setUserModels: (b: { diffusion_model: ModelSlot; vae: ModelSlot; text_encoder: ModelSlot; vision_projector: ModelSlot | null; scan_dir: string | null }) =>
call<ModelsStatus>("/models/user", { method: "POST", body: json(b) }),
useModels: (profile: "official" | "user") => call<ModelsStatus>("/models/use", { method: "POST", body: json({ profile }) }),
+ /** Downloads the texture-fix VAE and switches the active model to it (progress in installStatus). */
+ improveVae: () => call<InstallStatus>("/models/vae", { method: "POST" }),
/** Runs the engine on another card (index in `hardware().gpus`); needs the engine installed. */
setGpu: (gpu: number) => call<{ saved: boolean }>("/setup/gpu", { method: "POST", body: json({ gpu }) }),
upscalers: () => call<{ selected: string; active: string | null; items: UpscalerItem[] }>("/upscalers"),
diff --git a/src/lib/types.ts b/src/lib/types.ts
index 319733f..19ba2ae 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -340,6 +340,8 @@ export interface ModelsStatus {
user_installed: boolean;
official_installed: boolean;
default_download_dir: string;
+ /** The texture-fix VAE (#21): in use, or what switching to it downloads. */
+ vae: { improved: boolean; download_bytes: number; page: string };
}
export interface HardwareReport {
diff --git a/src/styles.css b/src/styles.css
index 88adf16..53c0c5b 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -512,6 +512,18 @@ pre.diag { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font
.welcome-item span { color: var(--text-2); }
.welcome .btn.big { min-width: 200px; justify-content: center; }
.welcome-foot { font-size: 12px; }
+/* The update buttons stay in view while the notes scroll (the dialog's bottom padding is 26px). */
+.welcome-actions { position: sticky; bottom: -26px; width: calc(100% + 72px); margin: 0 -36px -26px; padding: 14px 36px 22px; background: var(--bg); border-top: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 10px; }
+@media (max-width: 560px) { .welcome-actions { width: calc(100% + 40px); margin: 0 -20px -20px; padding: 12px 20px 18px; bottom: -20px; } }
+.update-offers { display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left; }
+.update-offer { display: flex; gap: 10px; align-items: flex-start; }
+.update-offer > input { margin-top: 3px; flex: none; }
+.update-offer > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
+.update-offer strong { color: var(--text); font-size: 14px; }
+.update-offer .model-files .update-detail { font-size: 12px; color: var(--text-2); line-height: 1.45; margin-top: 4px; }
+/* Scrolls without a visible bar (wheel and touchpad still work). */
+.welcome { scrollbar-width: none; }
+.welcome::-webkit-scrollbar { display: none; }
@keyframes welcome-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (max-width: 560px) { .welcome-grid { grid-template-columns: 1fr; } .welcome { padding: 28px 20px 20px; } }