v1.1.0: Refine button fix, model selection consistency, terminal log panel#134
v1.1.0: Refine button fix, model selection consistency, terminal log panel#134Mooshieblob1 merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the application to v1.1.0, introducing a "Refine" feature that performs a single-pass upscale/refinement by skipping the main sampling stage. It also fixes a bug where split-model settings persisted after switching checkpoints and resolves an issue where preview URLs were incorrectly passed to ComfyUI. Feedback focuses on optimizing image data handling by using Uint8Array instead of standard number arrays to improve performance and reduce memory overhead during Tauri IPC transfers.
| params.mode = "img2img"; | ||
|
|
||
| try { | ||
| let bytes: number[]; |
There was a problem hiding this comment.
Declaring bytes as number[] and later converting the Uint8Array to a standard array is inefficient for image data. In Tauri, passing a Uint8Array to an invoke command allows for much faster binary transfer via the IPC bridge, avoiding the overhead of JSON-serializing a large array of integers. This is especially important for high-resolution images to prevent performance bottlenecks or memory issues.
let bytes: Uint8Array;
| const resp = await fetch(sourceUrl); | ||
| if (!resp.ok) throw new Error(`fetch failed: ${resp.status}`); | ||
| const buf = await resp.arrayBuffer(); | ||
| bytes = Array.from(new Uint8Array(buf)); |
There was a problem hiding this comment.
Avoid using Array.from on the Uint8Array. Keeping the data as a Uint8Array is significantly more memory-efficient and allows Tauri to handle the data as a binary buffer during the invoke call to uploadImageBytes. This prevents the browser from having to serialize a massive array of numbers into a JSON string, which can be extremely slow for large images.
bytes = new Uint8Array(buf);
There was a problem hiding this comment.
Pull request overview
This PR bumps the app to v1.1.0 and adds a SwarmUI-style “Refine” flow that re-processes the latest output through the upscale chain (via a new refine_only workflow mode), plus a fix to keep split-model selection state consistent when switching checkpoints, and localized refine-failure messaging.
Changes:
- Add
refine_onlygeneration param and backend img2img template support to skip the main img2img sampler and feed the loaded image directly into the upscale chain. - Update Preview “Refine” button flow to upload image bytes to ComfyUI before queuing, and add localized
preview.refine_failedstrings across locales. - Clear split-model fields when selecting a regular checkpoint from the checkpoint gallery; bump versions + update changelog/release notes.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/types/index.ts | Adds optional refine_only param to the frontend generation payload type. |
| src/lib/components/progress/PreviewImage.svelte | Refine button now uploads bytes before queueing and forces refine_only; shows localized error toast on failure. |
| src/lib/components/generation/CheckpointGallery.svelte | Clears split-model fields when selecting a checkpoint and reapplies presets. |
| src-tauri/src/comfyui/types.rs | Adds refine_only to backend GenerationParams with a default. |
| src-tauri/src/templates/img2img.rs | Implements refine-only early return to skip the main img2img sampler path. |
| src/lib/locales/en.ts | Adds preview.refine_failed translation. |
| src/lib/locales/de.ts | Adds preview.refine_failed translation. |
| src/lib/locales/es.ts | Adds preview.refine_failed translation. |
| src/lib/locales/fr.ts | Adds preview.refine_failed translation. |
| src/lib/locales/it.ts | Adds preview.refine_failed translation. |
| src/lib/locales/ja.ts | Adds preview.refine_failed translation. |
| src/lib/locales/ko.ts | Adds preview.refine_failed translation. |
| src/lib/locales/pt.ts | Adds preview.refine_failed translation. |
| src/lib/locales/ru.ts | Adds preview.refine_failed translation. |
| src/lib/locales/zh.ts | Adds preview.refine_failed translation. |
| src/lib/locales/zh-tw.ts | Adds preview.refine_failed translation. |
| package.json | Bumps version to 1.1.0. |
| src-tauri/Cargo.toml | Bumps backend crate version to 1.1.0. |
| src-tauri/Cargo.lock | Updates lockfile to reflect version bump. |
| src-tauri/tauri.conf.json | Bumps Tauri app version to 1.1.0. |
| RELEASE_NOTES.md | Adds v1.1.0 release notes. |
| CHANGELOG.md | Adds v1.1.0 changelog section. |
| if (savedImage?.gallery_filename) { | ||
| bytes = await loadGalleryImage(savedImage.gallery_filename); | ||
| uploadFilename = savedImage.filename || `refine_${Date.now()}.png`; | ||
| } else { | ||
| const sourceUrl = previewSrc ?? progress.lastOutputImage; | ||
| if (!sourceUrl) { | ||
| gallery.showToast(locale.t("preview.not_available"), "info"); | ||
| return; | ||
| } | ||
| const resp = await fetch(sourceUrl); | ||
| if (!resp.ok) throw new Error(`fetch failed: ${resp.status}`); | ||
| const buf = await resp.arrayBuffer(); | ||
| bytes = Array.from(new Uint8Array(buf)); | ||
| uploadFilename = savedImage?.filename || `refine_${Date.now()}.png`; | ||
| } | ||
|
|
||
| const upload = await uploadImageBytes(bytes, uploadFilename); | ||
|
|
| } catch (e) { | ||
| console.error("Upscale failed:", e); | ||
| console.error("Refine failed:", e); | ||
| gallery.showToast(`${locale.t("preview.refine_failed")}: ${e}`, "error"); |
| // leave `useSplitModel = true` and the workflow would still load the | ||
| // old diffusion_model / clip_model / vae instead of `filename`. | ||
| generation.useSplitModel = false; | ||
| generation.diffusionModel = null; | ||
| generation.clipModel = null; | ||
| generation.clipType = null; |
What's New in v1.1.0
Refine Button (SwarmUI-style)
refine_onlymode skips the main img2img KSampler/VAE round-trip; only the upscale chain (VAEEncodeTiled → optional TiledDiffusion / SoftGuidance → KSampler atupscale_denoise→ VAEDecodeTiled) runs.LoadImageinput, causing avalue_not_in_listvalidation error ("a model or VAE may not be configured correctly"). It now fetches bytes from the displayed preview and uploads to ComfyUI'sinput/folder before queuing.Model Selection Consistency Fix
useSplitModel,diffusionModel,clipModel, andclipType. Previously those fields stayed set, so the workflow loaded the old split model files while the UI showed the new checkpoint name.Terminal Log Panel (Developer Mode)
get_log_buffer+log:lineevents, with copy-to-clipboard. Gated behind developer mode (10 taps on version number).i18n
preview.refine_failedkey across all 11 supported locales. Error toast on Refine failure is now localized.