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(mac): stop asking ComfyUI about files the app owns

purple8d3c3403737a
diff --git a/src/components/create/experimental/OutputView.tsx b/src/components/create/experimental/OutputView.tsx
index 37becb5d..c4e3b7a3 100644
--- a/src/components/create/experimental/OutputView.tsx
+++ b/src/components/create/experimental/OutputView.tsx
@@ -2,6 +2,7 @@ import { motion } from 'framer-motion'
import { Cpu, Sparkles, ImageDown, Maximize2, Download, Wand2, MonitorOff, AudioLines } from 'lucide-react'
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 { markGalleryItemAvailable } from './galleryUrl'
import { useComfyMedia } from './useComfyMedia'
@@ -128,7 +129,15 @@ async function downloadGalleryItem(item: GalleryItem): Promise<void> {
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.
- useCreateStore.getState().setError('Download needs the local engine. Start it and try again.')
+ // 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 {
diff --git a/src/components/create/experimental/__tests__/galleryUrl.test.ts b/src/components/create/experimental/__tests__/galleryUrl.test.ts
index 04116d5f..632e3497 100644
--- a/src/components/create/experimental/__tests__/galleryUrl.test.ts
+++ b/src/components/create/experimental/__tests__/galleryUrl.test.ts
@@ -32,7 +32,7 @@ vi.mock('../../../../api/backend', async (importOriginal) => ({
backendCall: vi.fn(),
}))
-import { fetchGalleryItemBlob, recoverGalleryUrl } from '../galleryUrl'
+import { fetchGalleryItemBlob, recoverGalleryUrl, proxiedComfyBlobUrl } from '../galleryUrl'
import { refreshResultUrl, resolveResultUrl } from '../../../../api/cloud/jobs'
import { backendCall } from '../../../../api/backend'
import { useCreateStore, type GalleryItem } from '../../../../stores/createStore'
@@ -180,6 +180,14 @@ describe('recoverGalleryUrl — local MLX renders on disk', () => {
expect(vi.mocked(backendCall).mock.calls.length).toBe(1)
})
+ it('never asks ComfyUI about a file we own on disk', async () => {
+ // Without this guard the recovery took a pointless round trip to port 8188
+ // first — and on a Mac that happens to run ComfyUI for something else, it
+ // asked the wrong server about a file it never made.
+ const item = { ...baseItem, id: 'disk-noproxy', localPath: '/tmp/mlx-3.png' }
+ expect(await proxiedComfyBlobUrl(item)).toBeNull()
+ })
+
it('still marks a ComfyUI item unavailable — no localPath, nothing to re-read', async () => {
const item = { ...baseItem, id: 'comfy-dead' }
useCreateStore.setState({ gallery: [item] })
diff --git a/src/components/create/experimental/galleryUrl.ts b/src/components/create/experimental/galleryUrl.ts
index 7289a280..7acf15b8 100644
--- a/src/components/create/experimental/galleryUrl.ts
+++ b/src/components/create/experimental/galleryUrl.ts
@@ -119,7 +119,11 @@ function guessMime(filename: string): string {
* use whenever ComfyUI allows the origin.
*/
export async function proxiedComfyBlobUrl(item: GalleryItem): Promise<string | null> {
- if (!isTauri() || item.jobId || item.remoteUrl || item.dataUrl) return null
+ // `localPath` marks an item whose bytes we own on disk (the MLX lanes). It is
+ // not a ComfyUI output, so asking ComfyUI for its filename can only waste a
+ // round trip — and on a Mac that happens to run ComfyUI for something else,
+ // ask the wrong server about a file it never made.
+ if (!isTauri() || item.jobId || item.remoteUrl || item.dataUrl || item.localPath) return null
try {
const bytes = await fetchLocalhostBytes(getImageUrl(item.filename, item.subfolder))
return URL.createObjectURL(new Blob([bytes], { type: guessMime(item.filename) }))