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.

fix(create): downloads save the picked render, gallery strip saves on Windows

purpled1b1a01325ed
diff --git a/CHANGELOG.md b/CHANGELOG.md
index faf40838..9dfeffa4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -55,6 +55,11 @@ cloud catalogue. It also fixes the bugs reported on GitHub and Discord since
bin, because LM Studio offers no way to delete a model from outside, and
Details showed nothing. Details now says to delete it in LM Studio under
My Models, and does the same for other local servers.
+- **A downloaded render is the render you picked.** After a gallery delete,
+ ComfyUI could give the next render with the same prompt the freed file name,
+ and downloading the older entry then saved the newer picture. Every run now
+ writes its own file names. Download in the gallery strip also did nothing on
+ Windows; it now opens the same Save dialog as the result view.
- **The Code agent runs calls a cloud model writes in unusual shapes.** A call
named "function" with a to-do list came back "Unknown tool: function", and
calls written into the answer as `!function_call:{"call": ...}` were never
diff --git a/e2e/gallery-download-saves-the-file.spec.ts b/e2e/gallery-download-saves-the-file.spec.ts
new file mode 100644
index 00000000..09c6f39c
--- /dev/null
+++ b/e2e/gallery-download-saves-the-file.spec.ts
@@ -0,0 +1,57 @@
+import { test, expect } from '@playwright/test'
+import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
+import { seedOnboardingDone } from './support/cloud-mock'
+
+/**
+ * Discord 2026-10-01 (theitalianstallion92, Windows): "the download from
+ * library doesnt actually work". The gallery strip's Download built a blob and
+ * clicked an <a download>, which WebView2 does not save. It now takes the same
+ * path as the result view: the bytes from ComfyUI into the native Save dialog.
+ */
+
+const FILE = 'red_apple_on_a_plate_k3f9q2_00001_.png'
+
+test('Download in the gallery strip opens the native Save dialog with the render', async ({ page }) => {
+ await page.addInitScript(tauriMockInit, { assistantReply: DEFAULT_ASSISTANT_REPLY, modelName: DEFAULT_MODEL_NAME, platform: 'windows' })
+ await seedOnboardingDone(page)
+ await page.addInitScript(([file]) => {
+ localStorage.setItem('create-store', JSON.stringify({
+ state: {
+ backend: 'local',
+ gallery: [{
+ id: 'g1', type: 'image', filename: file, subfolder: '', prompt: 'a red apple on a plate', negativePrompt: '',
+ model: 'juggernautXL.safetensors', modelType: 'sdxl', seed: 7, steps: 20, cfgScale: 7, sampler: 'euler',
+ scheduler: 'simple', width: 512, height: 512, batchSize: 1, createdAt: Date.now(),
+ }],
+ },
+ version: 2,
+ }))
+ const w = window as unknown as { __SAVES__: unknown[]; __TAURI_INTERNALS__: { invoke: (c: string, a: Record<string, unknown>) => Promise<unknown> } }
+ w.__SAVES__ = []
+ const bridge = w.__TAURI_INTERNALS__
+ const invoke = bridge.invoke
+ bridge.invoke = (command, args) => {
+ if (command === 'save_binary_file_dialog') {
+ w.__SAVES__.push({ defaultName: args.defaultName, size: (args.bytes as number[]).length })
+ return Promise.resolve('C:\\Users\\me\\Downloads\\' + String(args.defaultName))
+ }
+ const url = String(args?.url ?? '')
+ if (command === 'proxy_localhost_stream' && url.includes('/view?')) return Promise.resolve([137, 80, 78, 71, 1, 2, 3])
+ if (command === 'proxy_localhost' && url.includes('/system_stats')) return Promise.resolve(JSON.stringify({ devices: [] }))
+ return invoke(command, args)
+ }
+ }, [FILE] as const)
+
+ // A running ComfyUI serves the thumbnail; without it the tile reads unavailable.
+ const png = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==', 'base64')
+ await page.route('**/view?**', (route) => route.fulfill({ status: 200, contentType: 'image/png', body: png }))
+ await page.goto('/')
+ await page.getByRole('button', { name: /^Create$/ }).click()
+ await page.getByRole('button', { name: 'Open the gallery' }).click()
+ const tile = page.locator('aside').filter({ hasText: 'Gallery' }).locator('.group').first()
+ await tile.hover()
+ await tile.getByTitle('Download').click()
+
+ await expect.poll(() => page.evaluate(() => (window as unknown as { __SAVES__: unknown[] }).__SAVES__))
+ .toEqual([{ defaultName: FILE, size: 7 }])
+})
diff --git a/src/api/__tests__/every-run-writes-its-own-file-names.test.ts b/src/api/__tests__/every-run-writes-its-own-file-names.test.ts
new file mode 100644
index 00000000..7f433d9d
--- /dev/null
+++ b/src/api/__tests__/every-run-writes-its-own-file-names.test.ts
@@ -0,0 +1,58 @@
+/**
+ * Discord 2026-10-01 (theitalianstallion92): downloads "mutated" into copies
+ * of other renders. ComfyUI numbers a file one past the highest it still finds
+ * for the prefix, and a gallery delete frees that number, so the next run with
+ * the same prompt took the same name and a download of the older entry got the
+ * newer picture. Each submitted run now carries its own tag in every prefix.
+ *
+ * Run: npx vitest run src/api/__tests__/every-run-writes-its-own-file-names.test.ts
+ */
+import { describe, it, expect, vi } from 'vitest'
+
+vi.mock('../backend', async (importOriginal) => {
+ const actual = await importOriginal<typeof import('../backend')>()
+ return { ...actual, localFetch: vi.fn(), comfyuiUrl: (p: string) => `http://test${p}` }
+})
+
+import { tagOutputPrefixes, newRunTag } from '../comfyui-graph'
+import { submitWorkflow } from '../comfyui'
+import { localFetch } from '../backend'
+import type { ComfyApiGraph } from '../../types/comfy-graph'
+
+const graph: ComfyApiGraph = {
+ '1': { class_type: 'CheckpointLoaderSimple', inputs: { ckpt_name: 'juggernautXL.safetensors' } },
+ '9': { class_type: 'SaveImage', inputs: { images: ['8', 0], filename_prefix: 'red_apple_on_a_plate' } },
+ '10': { class_type: 'VHS_VideoCombine', inputs: { images: ['8', 0], filename_prefix: 'red_apple__vid' } },
+}
+
+describe('the run tag', () => {
+ it('goes on every output prefix and nowhere else', () => {
+ const tagged = tagOutputPrefixes(graph, 'k3f9q2')
+ expect(tagged['9']?.inputs?.filename_prefix).toBe('red_apple_on_a_plate_k3f9q2')
+ expect(tagged['10']?.inputs?.filename_prefix).toBe('red_apple__vid_k3f9q2')
+ expect(tagged['1']).toBe(graph['1'])
+ // The caller's graph stays as built.
+ expect(graph['9']?.inputs?.filename_prefix).toBe('red_apple_on_a_plate')
+ })
+
+ it('is six letters or digits, and two runs differ', () => {
+ const a = newRunTag()
+ expect(a).toMatch(/^[a-z0-9]{6}$/)
+ expect(new Set(Array.from({ length: 50 }, newRunTag)).size).toBe(50)
+ })
+})
+
+describe('submitting', () => {
+ it('the same graph twice gives two different file names', async () => {
+ const bodies: string[] = []
+ vi.mocked(localFetch).mockImplementation(async (_url, opts) => {
+ bodies.push(String(opts?.body))
+ return new Response(JSON.stringify({ prompt_id: 'p' }), { status: 200 })
+ })
+ await submitWorkflow(graph)
+ await submitWorkflow(graph)
+ const prefixes = bodies.map((b) => JSON.parse(b).prompt['9'].inputs.filename_prefix as string)
+ expect(prefixes[0]).toMatch(/^red_apple_on_a_plate_[a-z0-9]{6}$/)
+ expect(prefixes[0]).not.toBe(prefixes[1])
+ })
+})
diff --git a/src/api/comfyui-graph.ts b/src/api/comfyui-graph.ts
index e8e7d938..b1c34f5e 100644
--- a/src/api/comfyui-graph.ts
+++ b/src/api/comfyui-graph.ts
@@ -17,7 +17,7 @@
* Namen, damit kein Aufrufer und kein Test seinen Importpfad ändern muss.
*/
-import type { ComfyApiNode, ComfyLinkRef } from '../types/comfy-graph'
+import type { ComfyApiGraph, ComfyApiNode, ComfyLinkRef } from '../types/comfy-graph'
// ─── Output filename slug (David 2026-06-11) ───
//
@@ -47,6 +47,32 @@ export function promptFilenamePrefix(prompt: string | undefined, isVideo: boolea
return isVideo ? `${slug}__vid` : slug
}
+/**
+ * Discord 2026-10-01 (theitalianstallion92): downloaded renders "mutated" into
+ * copies of other renders. ComfyUI numbers a file one past the highest it
+ * still finds for the same prefix, and since 3.0.3 a gallery delete moves the
+ * file to the Recycle Bin, so the next run with the same prompt took the freed
+ * name. A download asks ComfyUI by name, so the older gallery entry handed out
+ * the newer picture. A short tag per run gives every run its own prefix, and a
+ * name can never point at two pictures again.
+ */
+export function tagOutputPrefixes(graph: ComfyApiGraph, tag: string): ComfyApiGraph {
+ const out: ComfyApiGraph = {}
+ for (const [id, node] of Object.entries(graph)) {
+ const prefix = node.inputs?.filename_prefix
+ out[id] = typeof prefix === 'string' && prefix
+ ? { ...node, inputs: { ...node.inputs, filename_prefix: `${prefix}_${tag}` } }
+ : node
+ }
+ return out
+}
+
+/** Six letters and digits, new for every run. */
+export function newRunTag(): string {
+ const bytes = crypto.getRandomValues(new Uint8Array(6))
+ return Array.from(bytes, (b) => 'abcdefghijklmnopqrstuvwxyz0123456789'[b % 36]).join('')
+}
+
/** Decode node for video latents: tiled whenever the install has the node.
* A full-frame WanVAE decode next to a resident 14B UNet left 312 MB of VRAM
* on a 12 GB card; CUDA paged through the Windows driver instead of throwing,
diff --git a/src/api/comfyui.ts b/src/api/comfyui.ts
index 2f6992ec..73d8ef55 100644
--- a/src/api/comfyui.ts
+++ b/src/api/comfyui.ts
@@ -8,7 +8,7 @@ import { resolveRunSeed } from '../lib/run-seed'
// dynamischer Import, der nur den Zyklus comfyui ↔ dynamic-workflow
// verdeckt hat. Beide sind reine Graph-Bausteine und wohnen jetzt in
// comfyui-graph.ts, das nichts importiert.
-import { videoDecodeNode, promptFilenamePrefix } from './comfyui-graph'
+import { videoDecodeNode, promptFilenamePrefix, tagOutputPrefixes, newRunTag } from './comfyui-graph'
import type { ComfyApiGraph, ComfyApiNode, ComfyHistoryEntry } from '../types/comfy-graph'
import type { ComfyModelSource } from '../types/models'
import { isRecord, asString, asRecordArray } from '../types/json-guards'
@@ -1925,7 +1925,8 @@ async function findAnimateDiffModel(): Promise<string> {
// ─── Workflow Submission ───
export async function submitWorkflow(workflow: ComfyApiGraph, clientId?: string): Promise<string> {
- const payload: Record<string, unknown> = { prompt: workflow }
+ // Every run its own output names (comfyui-graph tagOutputPrefixes).
+ const payload: Record<string, unknown> = { prompt: tagOutputPrefixes(workflow, newRunTag()) }
if (clientId) payload.client_id = clientId
// Use localFetch (Rust proxy in Tauri, direct fetch in dev). The previous
// direct-only fetch broke for any ComfyUI not started by LU itself —
diff --git a/src/components/create/experimental/CreatePanel.tsx b/src/components/create/experimental/CreatePanel.tsx
index 55a1e4a5..ee8d05ee 100644
--- a/src/components/create/experimental/CreatePanel.tsx
+++ b/src/components/create/experimental/CreatePanel.tsx
@@ -1,9 +1,9 @@
import { motion, AnimatePresence } from 'framer-motion'
import { Images, Play, PanelRightClose, Trash2, Download, MonitorOff, AudioLines } from 'lucide-react'
-import { downloadMediaUrl } from '../../../lib/download-media'
import { useCreateStore, type GalleryItem } from '../../../stores/createStore'
import { galleryLabel } from '../../../lib/render/gallery-label'
-import { GALLERY_DRAG_TYPE, galleryItemUrl } from './galleryUrl'
+import { GALLERY_DRAG_TYPE } from './galleryUrl'
+import { downloadGalleryItem } from './galleryDownload'
import { useComfyMedia } from './useComfyMedia'
import { cn } from '../ui/cn'
@@ -136,7 +136,7 @@ export function CreatePanel({ open, onOpenChange, activeId, onSelect }: Props) {
<Trash2 size={12} />
</button>
<button
- onClick={() => { void downloadMediaUrl(galleryItemUrl(g), g.filename || undefined) }}
+ onClick={() => { void downloadGalleryItem(g) }}
className="absolute bottom-1 right-1 w-6 h-6 rounded-md bg-black/55 hover:bg-black/70 text-gray-100 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center shadow-sm"
title="Download"
>
diff --git a/src/components/create/experimental/OutputView.tsx b/src/components/create/experimental/OutputView.tsx
index 1f8edcaf..90b5a7d2 100644
--- a/src/components/create/experimental/OutputView.tsx
+++ b/src/components/create/experimental/OutputView.tsx
@@ -3,11 +3,10 @@ import { motion } from 'framer-motion'
import { Cpu, Sparkles, ImageDown, Maximize2, Download, Wand2, MonitorOff, AudioLines, Film, Trash2 } from 'lucide-react'
import { coldLoadHint } from '../../../lib/cold-load-notice'
import { useCreateStore, type GalleryItem, type ProgressPhase } from '../../../stores/createStore'
-import { backendCall, downloadComfyFile, isTauri } from '../../../api/backend'
import { isMlxImageHost } from '../../../api/mlx-image'
-import { refreshResultUrl } from '../../../api/cloud/jobs'
import { ICON_LG, ICON_STROKE_MARK } from '../../ui/icon-size'
import { markGalleryItemAvailable } from './galleryUrl'
+import { downloadGalleryItem } from './galleryDownload'
import { galleryLabel } from '../../../lib/render/gallery-label'
import { useComfyMedia } from './useComfyMedia'
import { cn } from '../ui/cn'
@@ -124,103 +123,6 @@ interface ResultProps {
onAnimate?: () => void
}
-function extFor(contentType: string, kind: 'image' | 'video' | 'audio'): string {
- if (contentType.includes('png')) return 'png'
- if (contentType.includes('jpeg') || contentType.includes('jpg')) return 'jpg'
- if (contentType.includes('webp')) return 'webp'
- if (contentType.includes('mp4')) return 'mp4'
- if (contentType.includes('webm')) return 'webm'
- if (contentType.includes('mpeg') || contentType.includes('mp3')) return 'mp3'
- if (contentType.includes('wav')) return 'wav'
- if (contentType.includes('ogg')) return 'ogg'
- return kind === 'video' ? 'mp4' : kind === 'audio' ? 'mp3' : 'png'
-}
-
-// Save a gallery item. Local ComfyUI outputs (non-empty filename) go through
-// downloadComfyFile's proxy + native dialog. Cloud items have filename '' —
-// fetch their bytes directly (re-signed first: the stored URL expires ~1 h
-// after the last read); dataUrl items decode in place. Tauri gets the native
-// Save-As dialog (WebView2 blob-anchors are unreliable); failures surface via
-// setError instead of a silent no-op.
-/** Hand bytes to the user. Tauri gets the native Save-As dialog (WebView2
- * blob-anchors are unreliable); the browser build gets an anchor click. */
-async function saveBytes(bytes: Uint8Array, name: string, ext: string): Promise<void> {
- if (!isTauri()) {
- const blobUrl = URL.createObjectURL(new Blob([bytes as BlobPart]))
- const a = document.createElement('a')
- a.href = blobUrl
- a.download = name
- document.body.appendChild(a)
- a.click()
- document.body.removeChild(a)
- URL.revokeObjectURL(blobUrl)
- return
- }
- const { invoke } = await import('@tauri-apps/api/core')
- // Returns the chosen path, or null if the user cancelled — nothing to do then.
- await invoke('save_binary_file_dialog', {
- bytes: Array.from(bytes),
- defaultName: name,
- extension: ext,
- extLabel: ext.toUpperCase(),
- })
-}
-
-async function downloadGalleryItem(item: GalleryItem): Promise<void> {
- // A local MLX render (Mac) carries BOTH a filename and a real file on disk.
- // The filename is ours, not a ComfyUI output name — routing on its mere
- // presence sent every Mac render into the ComfyUI proxy below, which cannot
- // answer here, and downloadComfyFile swallows the failure. Disk first.
- if (item.localPath) {
- try {
- const b64 = await backendCall<string>('read_media_file', { path: item.localPath })
- const binary = atob(b64)
- const bytes = new Uint8Array(binary.length)
- for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i)
- const ext = item.localPath.toLowerCase().endsWith('.mp4') ? 'mp4' : 'png'
- await saveBytes(bytes, `lu-${item.id}.${ext}`, ext)
- } catch (err) {
- useCreateStore
- .getState()
- .setError(`Download failed: ${err instanceof Error ? err.message : String(err)}`)
- }
- return
- }
- if (item.filename && item.unavailable) {
- // The item's media already failed to load — the ComfyUI fetch would only
- // fail again (and downloadComfyFile swallows its errors). Be honest.
- // Only reachable for a ComfyUI-backed item. On a Mac that can only be a
- // pre-2.6.0 leftover whose file was never written — there is no engine to
- // start there, so "start it" would be the last piece of advice a Mac user
- // could still be given about software they never had.
- useCreateStore.getState().setError(
- isMlxImageHost()
- ? 'This render is not on disk any more, so there is nothing to save.'
- : 'Download needs the local engine. Start it and try again.',
- )
- return
- }
- try {
- if (item.filename) {
- await downloadComfyFile(item.filename, item.subfolder)
- return
- }
- let url = item.dataUrl ?? item.remoteUrl
- if (!item.dataUrl && item.jobId) {
- url = (await refreshResultUrl(item.jobId)) ?? url
- }
- if (!url) throw new Error('no source available for this item')
- const res = await fetch(url)
- if (!res.ok) throw new Error(`fetch failed (${res.status})`)
- const ext = extFor(res.headers.get('content-type') ?? '', item.type)
- const bytes = new Uint8Array(await res.arrayBuffer())
- await saveBytes(bytes, `lu-${item.id}.${ext}`, ext)
- } catch (err) {
- useCreateStore
- .getState()
- .setError(`Download failed: ${err instanceof Error ? err.message : String(err)}`)
- }
-}
// The stored width/height are the generation *request* dims (the sliders).
// Utility ops (upscale/removebg/eraser) and edit ignore those — their real
diff --git a/src/components/create/experimental/galleryDownload.ts b/src/components/create/experimental/galleryDownload.ts
new file mode 100644
index 00000000..fc324f25
--- /dev/null
+++ b/src/components/create/experimental/galleryDownload.ts
@@ -0,0 +1,106 @@
+// Saving a gallery item, one path for every surface that offers Download
+// (the result view and the gallery strip). The strip had its own copy built on
+// fetch plus an <a download> blob, which WebView2 does not save, so it did
+// nothing on Windows (Discord 2026-10-01, theitalianstallion92).
+import { useCreateStore, type GalleryItem } from '../../../stores/createStore'
+import { backendCall, downloadComfyFile, isTauri } from '../../../api/backend'
+import { isMlxImageHost } from '../../../api/mlx-image'
+import { refreshResultUrl } from '../../../api/cloud/jobs'
+
+function extFor(contentType: string, kind: 'image' | 'video' | 'audio'): string {
+ if (contentType.includes('png')) return 'png'
+ if (contentType.includes('jpeg') || contentType.includes('jpg')) return 'jpg'
+ if (contentType.includes('webp')) return 'webp'
+ if (contentType.includes('mp4')) return 'mp4'
+ if (contentType.includes('webm')) return 'webm'
+ if (contentType.includes('mpeg') || contentType.includes('mp3')) return 'mp3'
+ if (contentType.includes('wav')) return 'wav'
+ if (contentType.includes('ogg')) return 'ogg'
+ return kind === 'video' ? 'mp4' : kind === 'audio' ? 'mp3' : 'png'
+}
+
+// Save a gallery item. Local ComfyUI outputs (non-empty filename) go through
+// downloadComfyFile's proxy + native dialog. Cloud items have filename '' —
+// fetch their bytes directly (re-signed first: the stored URL expires ~1 h
+// after the last read); dataUrl items decode in place. Tauri gets the native
+// Save-As dialog (WebView2 blob-anchors are unreliable); failures surface via
+// setError instead of a silent no-op.
+/** Hand bytes to the user. Tauri gets the native Save-As dialog (WebView2
+ * blob-anchors are unreliable); the browser build gets an anchor click. */
+async function saveBytes(bytes: Uint8Array, name: string, ext: string): Promise<void> {
+ if (!isTauri()) {
+ const blobUrl = URL.createObjectURL(new Blob([bytes as BlobPart]))
+ const a = document.createElement('a')
+ a.href = blobUrl
+ a.download = name
+ document.body.appendChild(a)
+ a.click()
+ document.body.removeChild(a)
+ URL.revokeObjectURL(blobUrl)
+ return
+ }
+ const { invoke } = await import('@tauri-apps/api/core')
+ // Returns the chosen path, or null if the user cancelled — nothing to do then.
+ await invoke('save_binary_file_dialog', {
+ bytes: Array.from(bytes),
+ defaultName: name,
+ extension: ext,
+ extLabel: ext.toUpperCase(),
+ })
+}
+
+export async function downloadGalleryItem(item: GalleryItem): Promise<void> {
+ // A local MLX render (Mac) carries BOTH a filename and a real file on disk.
+ // The filename is ours, not a ComfyUI output name — routing on its mere
+ // presence sent every Mac render into the ComfyUI proxy below, which cannot
+ // answer here, and downloadComfyFile swallows the failure. Disk first.
+ if (item.localPath) {
+ try {
+ const b64 = await backendCall<string>('read_media_file', { path: item.localPath })
+ const binary = atob(b64)
+ const bytes = new Uint8Array(binary.length)
+ for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i)
+ const ext = item.localPath.toLowerCase().endsWith('.mp4') ? 'mp4' : 'png'
+ await saveBytes(bytes, `lu-${item.id}.${ext}`, ext)
+ } catch (err) {
+ useCreateStore
+ .getState()
+ .setError(`Download failed: ${err instanceof Error ? err.message : String(err)}`)
+ }
+ return
+ }
+ if (item.filename && item.unavailable) {
+ // The item's media already failed to load — the ComfyUI fetch would only
+ // fail again (and downloadComfyFile swallows its errors). Be honest.
+ // Only reachable for a ComfyUI-backed item. On a Mac that can only be a
+ // pre-2.6.0 leftover whose file was never written — there is no engine to
+ // start there, so "start it" would be the last piece of advice a Mac user
+ // could still be given about software they never had.
+ useCreateStore.getState().setError(
+ isMlxImageHost()
+ ? 'This render is not on disk any more, so there is nothing to save.'
+ : 'Download needs the local engine. Start it and try again.',
+ )
+ return
+ }
+ try {
+ if (item.filename) {
+ await downloadComfyFile(item.filename, item.subfolder)
+ return
+ }
+ let url = item.dataUrl ?? item.remoteUrl
+ if (!item.dataUrl && item.jobId) {
+ url = (await refreshResultUrl(item.jobId)) ?? url
+ }
+ if (!url) throw new Error('no source available for this item')
+ const res = await fetch(url)
+ if (!res.ok) throw new Error(`fetch failed (${res.status})`)
+ const ext = extFor(res.headers.get('content-type') ?? '', item.type)
+ const bytes = new Uint8Array(await res.arrayBuffer())
+ await saveBytes(bytes, `lu-${item.id}.${ext}`, ext)
+ } catch (err) {
+ useCreateStore
+ .getState()
+ .setError(`Download failed: ${err instanceof Error ? err.message : String(err)}`)
+ }
+}
diff --git a/src/lib/download-media.ts b/src/lib/download-media.ts
deleted file mode 100644
index 0b908284..00000000
--- a/src/lib/download-media.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-// Save a displayed image/video to disk regardless of where it lives — ported
-// from the web companion so the Create gallery downloads identically. A plain
-// `<a download>` only works for same-origin/data URLs; cloud renders (signed
-// Supabase URLs) are fetched into a Blob first. Last resort (fetch blocked):
-// hand the URL to the system browser so the user can save manually.
-
-import { openExternal } from '../api/backend'
-
-export function mediaFilenameFromUrl(url: string, fallback = 'lu-render'): string {
- try {
- const path = new URL(url, typeof location !== 'undefined' ? location.origin : 'http://localhost').pathname
- const last = decodeURIComponent(path.split('/').pop() || '')
- if (last && /\.[a-z0-9]{2,5}$/i.test(last)) return last
- } catch { /* fall through */ }
- return fallback
-}
-
-function clickAnchor(href: string, filename: string): void {
- const a = document.createElement('a')
- a.href = href
- a.download = filename
- document.body.appendChild(a)
- a.click()
- document.body.removeChild(a)
-}
-
-export async function downloadMediaUrl(url: string, filename?: string): Promise<void> {
- const name = filename && filename.length > 0 ? filename : mediaFilenameFromUrl(url)
- if (url.startsWith('data:') || url.startsWith('blob:')) {
- clickAnchor(url, name)
- return
- }
- try {
- const res = await fetch(url)
- if (!res.ok) throw new Error(`download failed: ${res.status}`)
- const blob = await res.blob()
- const obj = URL.createObjectURL(blob)
- const finalName = filename && filename.length > 0
- ? filename
- : (res.url && res.url !== url ? mediaFilenameFromUrl(res.url, name) : name)
- clickAnchor(obj, finalName)
- setTimeout(() => URL.revokeObjectURL(obj), 30_000)
- } catch {
- void openExternal(url)
- }
-}
diff --git a/src/lib/release-notes.ts b/src/lib/release-notes.ts
index d1af0c7a..b315e616 100644
--- a/src/lib/release-notes.ts
+++ b/src/lib/release-notes.ts
@@ -156,7 +156,7 @@ export const RELEASE_NOTES: ReleaseNote[] = [
},
{
title: 'Fixes from GitHub and Discord.',
- detail: 'A group chat answers with every LU Engine model in it, also when the models sit in your Model Storage folder. Ollama models download without one already installed. A GGUF from the CivitAI search lands where ComfyUI reads it. A fresh ComfyUI install on Windows gets its own Python environment, which fixes "hipdnn_backend.dll Bad Image" on AMD cards. The window no longer disappears on Linux. A character trained on your own machine takes up to 100 photos, and Details on an LM Studio model says where to delete it. A newer image or video model with a missing encoder or VAE names that file and offers the download, instead of ending in "Value not in list". A LoRA deleted from the loras folder leaves the stack, a run only sends LoRAs ComfyUI lists, and Clear turns the stack off. The Code agent runs tool calls a cloud model writes into its answer or sends under the name "function", instead of stopping on them.',
+ detail: 'A group chat answers with every LU Engine model in it, also when the models sit in your Model Storage folder. Ollama models download without one already installed. A GGUF from the CivitAI search lands where ComfyUI reads it. A fresh ComfyUI install on Windows gets its own Python environment, which fixes "hipdnn_backend.dll Bad Image" on AMD cards. The window no longer disappears on Linux. A character trained on your own machine takes up to 100 photos, and Details on an LM Studio model says where to delete it. A newer image or video model with a missing encoder or VAE names that file and offers the download, instead of ending in "Value not in list". A LoRA deleted from the loras folder leaves the stack, a run only sends LoRAs ComfyUI lists, and Clear turns the stack off. The Code agent runs tool calls a cloud model writes into its answer or sends under the name "function", instead of stopping on them. A downloaded render is always the one you picked, and Download in the gallery strip opens the Save dialog on Windows.',
},
{
title: 'Writing a long file no longer ends the run.',