Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

Enable I2I/I2V/LoRA/VAE end-to-end: in-app asset catalog + MCP image input

purpleb16a785cede3
diff --git a/src-tauri/src/commands/remote.rs b/src-tauri/src/commands/remote.rs
index ae31ff5b..1b6300f2 100644
--- a/src-tauri/src/commands/remote.rs
+++ b/src-tauri/src/commands/remote.rs
@@ -1461,10 +1461,12 @@ button{-webkit-appearance:none;appearance:none}
parameters:[]},
{name:'screenshot', description:'Capture the primary display as a base64 PNG. Zero arguments. USE for visual verification when the user asks "what\'s on my screen" or "look at X". Returns a short summary string (size + filename); the actual image is forwarded to the model via message content. NEVER call in a tight loop — screenshots are expensive and privacy-sensitive.',
parameters:[]},
- {name:'image_generate', description:'Generate an image from a text prompt via the local ComfyUI pipeline. Blocks up to 5 minutes. USE for "draw me", "make an image of", "generate a picture". NOT for photo editing — this is text-to-image only; no inpainting via this tool. First installed image model is auto-selected (or pass `model`). EXPECT A PAUSE: on a single-GPU machine LU may briefly unload the chat model from VRAM to fit the image model, then reload it after — typically a 30-90s swap (longer on a cold ComfyUI start). This avoids out-of-memory errors; your conversation is fully preserved across the swap. Rate-limit yourself to 1 call per turn — ComfyUI serializes generations internally so parallel calls will queue, not speed up.',
+ {name:'image_generate', description:'Generate an image from a text prompt via the local ComfyUI pipeline. Blocks up to 5 minutes. USE for "draw me", "make an image of", "generate a picture". Pass `inputImage` (a filename from an earlier image_generate result) for image-to-image — restyle / edit an existing image at the given `denoise` strength; omit it for text-to-image. First installed image model is auto-selected (or pass `model`). EXPECT A PAUSE: on a single-GPU machine LU may briefly unload the chat model from VRAM to fit the image model, then reload it after — typically a 30-90s swap (longer on a cold ComfyUI start). This avoids out-of-memory errors; your conversation is fully preserved across the swap. Rate-limit yourself to 1 call per turn — ComfyUI serializes generations internally so parallel calls will queue, not speed up.',
parameters:[{name:'prompt',type:'string',description:'Positive text description of the desired image',required:true},
{name:'negativePrompt',type:'string',description:'Things to avoid (blurry, deformed, etc.)',required:false},
- {name:'model',type:'string',description:'Optional image model filename to use. Omit to auto-select the first installed image model.',required:false}]},
+ {name:'model',type:'string',description:'Optional image model filename to use. Omit to auto-select the first installed image model.',required:false},
+ {name:'inputImage',type:'string',description:'Optional. Filename of a previously generated image (from an earlier image_generate result) to use as the base for image-to-image. Omit for text-to-image.',required:false},
+ {name:'denoise',type:'number',description:'Image-to-image strength 0.05–1.0 (default 0.6). Lower keeps more of the input image, higher follows the prompt more. Only used together with inputImage.',required:false}]},
{name:'get_current_time', description:'Return the user\'s current local date, time, and timezone. Zero arguments. USE FIRST for any \'what day / time / date is it\' question — do NOT web_search or shell_execute `date`. The Rust backend probes the OS timezone on every call, so this is always authoritative.',
parameters:[]}
];
diff --git a/src/api/discover.ts b/src/api/discover.ts
index d57a6fe5..97e431e8 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -1002,6 +1002,44 @@ export function getImageBundles(): ModelBundle[] {
},
],
},
+ {
+ name: 'SDXL VAE (fp16-fix) — add-on',
+ description: 'Standard SDXL VAE (madebyollin fp16-fix). Optional VAE override for any SDXL checkpoint; fixes washed-out / desaturated output on some models. After download, pick it under Advanced → VAE.',
+ tags: ['SDXL', 'VAE', 'Add-on'],
+ verified: true,
+ totalSizeGB: 0.33,
+ vramRequired: 'any',
+ workflow: 'sdxl',
+ url: 'https://huggingface.co/madebyollin/sdxl-vae-fp16-fix',
+ files: [
+ {
+ name: 'SDXL VAE fp16-fix',
+ description: 'Drop-in SDXL VAE → models/vae.',
+ pulls: '', tags: ['VAE', '335 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/madebyollin/sdxl-vae-fp16-fix/resolve/main/sdxl_vae.safetensors',
+ filename: 'sdxl_vae.safetensors', subfolder: 'vae', sizeGB: 0.33,
+ },
+ ],
+ },
+ {
+ name: 'Pixel Art XL — SDXL LoRA',
+ description: 'nerijs Pixel Art XL — turns any SDXL model into crisp pixel art. A clearly-visible style LoRA. After download, pick it under Advanced → LoRA and raise the strength.',
+ tags: ['SDXL', 'LoRA', 'Style'],
+ verified: true,
+ totalSizeGB: 0.17,
+ vramRequired: 'any',
+ workflow: 'sdxl',
+ url: 'https://huggingface.co/nerijs/pixel-art-xl',
+ files: [
+ {
+ name: 'Pixel Art XL LoRA',
+ description: 'SDXL pixel-art style LoRA → models/loras.',
+ pulls: '', tags: ['LoRA', '170 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/nerijs/pixel-art-xl/resolve/main/pixel-art-xl.safetensors',
+ filename: 'pixel-art-xl.safetensors', subfolder: 'loras', sizeGB: 0.17,
+ },
+ ],
+ },
]
}
diff --git a/src/api/mcp/builtin-tools.ts b/src/api/mcp/builtin-tools.ts
index c96fbe1c..6ab0ca09 100644
--- a/src/api/mcp/builtin-tools.ts
+++ b/src/api/mcp/builtin-tools.ts
@@ -471,7 +471,7 @@ const BUILTIN_TOOLS: MCPToolDefinition[] = [
description:
'Generate an image from a text prompt via the local ComfyUI pipeline. Blocks up to 5 minutes. '
+ 'USE for "draw me", "make an image of", "generate a picture". '
- + 'NOT for photo editing — this is text-to-image only; no inpainting via this tool. '
+ + 'Pass `inputImage` (a filename from an earlier image_generate result) for image-to-image — restyle / edit an existing image at the given `denoise` strength; omit it for text-to-image. '
+ 'First installed image model is auto-selected (or pass `model`). '
+ 'EXPECT A PAUSE: on a single-GPU machine LU may briefly unload the chat model from VRAM to fit the image model, then reload it after — typically a 30-90s swap (longer on a cold ComfyUI start). This avoids out-of-memory errors; your conversation is fully preserved across the swap. '
+ 'Rate-limit yourself to 1 call per turn — ComfyUI serializes generations internally so parallel calls will queue, not speed up.',
@@ -481,6 +481,8 @@ const BUILTIN_TOOLS: MCPToolDefinition[] = [
prompt: { type: 'string', description: 'Positive text description of the desired image' },
negativePrompt: { type: 'string', description: 'Things to avoid (blurry, deformed, etc.)' },
model: { type: 'string', description: 'Optional image model filename to use. Omit to auto-select the first installed image model.' },
+ inputImage: { type: 'string', description: 'Optional. Filename of a previously generated image (from an earlier image_generate result) to use as the base for image-to-image. Omit for text-to-image.' },
+ denoise: { type: 'number', description: 'Image-to-image strength 0.05–1.0 (default 0.6). Lower keeps more of the input image, higher follows the prompt more. Only used together with inputImage.' },
},
required: ['prompt'],
},
@@ -492,7 +494,7 @@ const BUILTIN_TOOLS: MCPToolDefinition[] = [
description:
'Generate a short video clip from a text prompt via the local ComfyUI pipeline (Wan / Hunyuan / AnimateDiff backend, auto-detected). Blocks up to 10 minutes. '
+ 'USE for "make a video of", "animate", "generate a clip". '
- + 'Text-to-video only — no image input via this tool. First installed video model is auto-selected (or pass `model`). '
+ + 'Pass `inputImage` (a filename from an earlier image_generate result) to animate a still image — image-to-video, which auto-selects an installed I2V model such as SVD; omit it for text-to-video. First installed video model is auto-selected (or pass `model`). '
+ 'Write ONE clear prompt and call this ONCE per turn — video generation is slow and ComfyUI queues parallel calls rather than speeding up. '
+ 'EXPECT A PAUSE: LU will briefly unload the chat model from VRAM to fit the (large) video model, then reload it after — typically a 30-90s swap, longer on a cold ComfyUI start. This prevents out-of-memory errors; your conversation is preserved across the swap.',
inputSchema: {
@@ -503,6 +505,7 @@ const BUILTIN_TOOLS: MCPToolDefinition[] = [
model: { type: 'string', description: 'Optional video model filename to use. Omit to auto-select the first installed video model.' },
frames: { type: 'number', description: 'Number of frames to generate (clamped per model defaults; e.g. ~81 for Wan). Omit for the model default.' },
fps: { type: 'number', description: 'Frames per second of the output clip (e.g. 16). Omit for the model default.' },
+ inputImage: { type: 'string', description: 'Optional. Filename of a previously generated image to animate (image-to-video). Requires an installed I2V model such as SVD. Omit for text-to-video.' },
},
required: ['prompt'],
},
diff --git a/src/api/vram-handoff.ts b/src/api/vram-handoff.ts
index ebb7d6f4..f5b44a60 100644
--- a/src/api/vram-handoff.ts
+++ b/src/api/vram-handoff.ts
@@ -58,6 +58,8 @@ import {
extractComfyOutputFiles,
getImageUrl,
classifyModel,
+ isI2VModel,
+ uploadImage,
buildTxt2VidWorkflow,
snapToVideoGrid,
MODEL_TYPE_DEFAULTS,
@@ -345,6 +347,10 @@ export interface VramHandoffArgs {
prompt?: string
negativePrompt?: string
model?: string
+ // Image-to-image / image-to-video: a filename from a prior generate result.
+ inputImage?: string
+ // Image-to-image denoise strength (0.05–1.0).
+ denoise?: number
// Video-only
frames?: number
fps?: number
@@ -389,12 +395,25 @@ async function runHandoff(kind: 'image' | 'video', args: VramHandoffArgs): Promi
targetModel = typeof args.model === 'string' && args.model ? args.model : models[0].name
} else {
const [models, backend] = await Promise.all([getVideoModels(), detectVideoBackend()])
- if (models.length === 0 || backend === 'none') {
- emitHandoff('error', { kind, detail: 'no video model installed' })
- return 'Error: No video model installed in ComfyUI (need a Wan/Hunyuan model or AnimateDiff nodes). Download one from the Create tab and try again.'
+ const wantI2V = typeof args.inputImage === 'string' && !!args.inputImage
+ if (wantI2V) {
+ // Image-to-video needs an I2V-capable model (SVD / FramePack). Those use
+ // built-in ComfyUI nodes, so a 'none' text-to-video backend is fine here.
+ const i2vModels = models.filter((m) => isI2VModel(m.name))
+ if (i2vModels.length === 0) {
+ emitHandoff('error', { kind, detail: 'no i2v model installed' })
+ return 'Error: Image-to-video needs an I2V model such as SVD. Install one from Models → Discover (e.g. "SVD-XT 1.1 — Image to Video"), then try again.'
+ }
+ targetModel = typeof args.model === 'string' && args.model ? args.model : i2vModels[0].name
+ videoBackend = backend
+ } else {
+ if (models.length === 0 || backend === 'none') {
+ emitHandoff('error', { kind, detail: 'no video model installed' })
+ return 'Error: No video model installed in ComfyUI (need a Wan/Hunyuan model or AnimateDiff nodes). Download one from the Create tab and try again.'
+ }
+ targetModel = typeof args.model === 'string' && args.model ? args.model : models[0].name
+ videoBackend = backend
}
- targetModel = typeof args.model === 'string' && args.model ? args.model : models[0].name
- videoBackend = backend
}
} catch (e) {
// ComfyUI unreachable while listing models — we have not unloaded anything,
@@ -514,6 +533,14 @@ async function runHandoff(kind: 'image' | 'video', args: VramHandoffArgs): Promi
async function generateImage(prompt: string, model: string, args: VramHandoffArgs): Promise<string> {
const { buildDynamicWorkflow } = await import('./dynamic-workflow')
try {
+ // Image-to-image: resolve the referenced output image into ComfyUI's input
+ // folder, then let buildDynamicWorkflow wire LoadImage → VAEEncode + denoise.
+ let inputImage: string | undefined
+ let denoise: number | undefined
+ if (typeof args.inputImage === 'string' && args.inputImage) {
+ inputImage = await resolveInputImage(args.inputImage)
+ denoise = clampFloat(args.denoise, 0.6, 0.05, 1.0)
+ }
const workflow = await buildDynamicWorkflow(
{
prompt,
@@ -527,6 +554,7 @@ async function generateImage(prompt: string, model: string, args: VramHandoffArg
height: 1024,
seed: -1,
batchSize: 1,
+ ...(inputImage ? { inputImage, denoise } : {}),
},
classifyModel(model),
)
@@ -547,6 +575,40 @@ async function generateVideo(
): Promise<string> {
try {
const type = classifyModel(model)
+
+ // ── Image-to-video (SVD / FramePack) ───────────────────────────
+ // Resolve the still into ComfyUI's input folder and route through the
+ // dynamic builder's I2V strategy. Conservative size + low frame count keep
+ // it inside 12 GB; SVD bundles its own CLIP-vision + VAE in the checkpoint.
+ if (typeof args.inputImage === 'string' && args.inputImage && isI2VModel(model)) {
+ const { buildDynamicWorkflow } = await import('./dynamic-workflow')
+ const inputImage = await resolveInputImage(args.inputImage)
+ const frames = clampInt(args.frames, 14, 1, 25)
+ const fps = clampInt(args.fps, 8, 1, 30)
+ const workflow = await buildDynamicWorkflow(
+ {
+ prompt,
+ negativePrompt: typeof args.negativePrompt === 'string' ? args.negativePrompt : '',
+ model,
+ sampler: 'euler',
+ scheduler: 'normal',
+ steps: 20,
+ cfgScale: 3,
+ width: 768,
+ height: 448,
+ seed: -1,
+ batchSize: 1,
+ frames,
+ fps,
+ inputImage,
+ },
+ type,
+ )
+ const promptId = await submitWorkflow(workflow)
+ return await pollAndExtract(promptId, prompt, label('video'), getVideoTimeoutMs())
+ }
+
+ // ── Text-to-video ──────────────────────────────────────────────
const defaults = MODEL_TYPE_DEFAULTS[type] ?? MODEL_TYPE_DEFAULTS.wan
const snapped = snapToVideoGrid(defaults.width, defaults.height)
const frames = clampInt(args.frames, defaults.frames, 1, 256)
@@ -624,6 +686,36 @@ function clampInt(v: unknown, fallback: number, min: number, max: number): numbe
return Math.max(min, Math.min(max, Math.round(n)))
}
+function clampFloat(v: unknown, fallback: number, min: number, max: number): number {
+ const n = typeof v === 'number' ? v : Number(v)
+ if (!Number.isFinite(n)) return fallback
+ return Math.max(min, Math.min(max, n))
+}
+
+/**
+ * Turn an `inputImage` argument (a prior generate result's filename, or a /view
+ * URL) into a filename inside ComfyUI's *input* folder, ready for LoadImage.
+ * Generated images live in ComfyUI's *output* folder, but LoadImage reads from
+ * *input* — so we fetch the referenced image and re-upload it via /upload/image.
+ */
+async function resolveInputImage(ref: string): Promise<string> {
+ let url: string
+ let name: string
+ if (/^https?:\/\//i.test(ref)) {
+ url = ref
+ const m = ref.match(/[?&]filename=([^&]+)/)
+ name = m ? decodeURIComponent(m[1]) : 'lu_input.png'
+ } else {
+ name = ref.replace(/^.*[\\/]/, '')
+ url = getImageUrl(name, '', 'output')
+ }
+ const resp = await fetch(url)
+ if (!resp.ok) throw new Error(`could not read input image "${ref}" (HTTP ${resp.status})`)
+ const blob = await resp.blob()
+ const file = new File([blob], name, { type: blob.type || 'image/png' })
+ return await uploadImage(file)
+}
+
function getImageTimeoutMs(): number {
// ~5 min default per spec; respect the user's imageGenTimeoutMinutes if set.
try {