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(models): eine eigene Datei verschwindet nicht mehr hinter einem Katalogpreis

purplead31e0c5ab8d
diff --git a/src/api/__tests__/installed-partial-main-model.test.ts b/src/api/__tests__/installed-partial-main-model.test.ts
new file mode 100644
index 00000000..1bb3640b
--- /dev/null
+++ b/src/api/__tests__/installed-partial-main-model.test.ts
@@ -0,0 +1,151 @@
+/**
+ * M1 of the R67 re-measure on the real 2.6.7 Windows build (2026-08-30,
+ * ergebnis-r67-nachmessung.md).
+ *
+ * Two byte-identical files lay in the SAME folder,
+ * C:\Users\ddrob\ComfyUI\models\diffusion_models, 13.631.488 bytes each:
+ *
+ * flux1-dev-fp8.safetensors -> in no list, no counter, no size, no
+ * delete button. Invisible in the app.
+ * flux1-dev-fp8-r67.safetensors -> listed fine, "13.0 MB"
+ *
+ * Renaming the one file was enough to make it appear, so it was the NAME. Our
+ * catalogue ships FLUX.1 [dev] FP8 under that exact filename at 16.1 GB, the
+ * size probe called the user's 13 MB file partial, and getImageModels dropped
+ * it. The inventory read getImageModels, so the whole app went blind to a file
+ * lying on the disk.
+ *
+ * The rule the R5 round already applied to the addon folders, now one folder
+ * further in: a catalogue size is a claim about the file WE ship, never about
+ * the file the user has. The inventory answers "what is on my disk" and must
+ * show it, with its size and its delete button. The pickers answer "what can I
+ * render with" and keep the filter, and the catalogue card keeps saying
+ * honestly that the package is not fully downloaded.
+ *
+ * Run: npx vitest run src/api/__tests__/installed-partial-main-model.test.ts
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+
+const localFetch = vi.fn()
+const backendCall = vi.fn()
+vi.mock('../backend', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('../backend')>()),
+ localFetch: (...a: unknown[]) => localFetch(...a),
+ backendCall: (...a: unknown[]) => backendCall(...a),
+ isTauri: () => false,
+ comfyuiUrl: (path: string) => `http://127.0.0.1:8188${path}`,
+}))
+
+import {
+ getImageModels, getVideoModels,
+ getInstalledImageModels, getInstalledVideoModels,
+ subfolderForSource,
+} from '../comfyui'
+
+const okJson = (body: unknown) => ({ ok: true, status: 200, json: async () => body })
+
+// The pair from the box, spelled the way the box spells it. The first name is
+// in our catalogue at 16.1 GB, the second is in no catalogue at all.
+const CATALOG_NAME = 'flux1-dev-fp8.safetensors'
+const RENAMED = 'flux1-dev-fp8-r67.safetensors'
+const DUMMY_BYTES = 13_631_488
+// A catalogue name in the video lane, 14 GB there.
+const VIDEO_CATALOG_NAME = 'wan2.1_t2v_14B_fp8.safetensors'
+
+function routeUnets(unets: string[]) {
+ localFetch.mockImplementation(async (url: string) => {
+ if (url.includes('UNETLoader') && !url.includes('UnetLoaderGGUF')) {
+ return okJson({ UNETLoader: { input: { required: { unet_name: [unets] } } } })
+ }
+ return okJson({})
+ })
+}
+
+/** The box's disk: every listed file exists, and every one of them is far
+ * smaller than the catalogue entry of the same name. */
+function probeSaysPartial() {
+ backendCall.mockImplementation(async (_cmd: string, args: { files: Array<{ filename: string; expectedBytes?: number }> }) =>
+ args.files.map((f) => ({
+ filename: f.filename,
+ exists: true,
+ actualBytes: DUMMY_BYTES,
+ complete: !f.expectedBytes || f.expectedBytes <= DUMMY_BYTES,
+ })),
+ )
+}
+
+beforeEach(() => {
+ localFetch.mockReset()
+ backendCall.mockReset()
+ probeSaysPartial()
+})
+
+describe('THE FIX: the inventory shows a file the catalogue would call partial', () => {
+ it('both halves of the box pair are in the Image inventory', async () => {
+ routeUnets([CATALOG_NAME, RENAMED])
+ const names = (await getInstalledImageModels()).map((m) => m.name)
+ expect(names).toContain(CATALOG_NAME)
+ expect(names).toContain(RENAMED)
+ })
+
+ it('the file carries its folder, so its size can be read and it can be deleted', async () => {
+ routeUnets([CATALOG_NAME])
+ const entry = (await getInstalledImageModels()).find((m) => m.name === CATALOG_NAME)
+ expect(entry?.source).toBe('diffusion_model')
+ expect(subfolderForSource('diffusion_model')).toBe('diffusion_models')
+ })
+
+ it('the video lane has the same rule', async () => {
+ routeUnets([VIDEO_CATALOG_NAME])
+ const names = (await getInstalledVideoModels()).map((m) => m.name)
+ expect(names).toContain(VIDEO_CATALOG_NAME)
+ })
+
+ it('a name nobody ships was never the problem and still is not', async () => {
+ routeUnets([RENAMED])
+ const names = (await getInstalledImageModels()).map((m) => m.name)
+ expect(names).toEqual([RENAMED])
+ })
+})
+
+describe('NEGATIVE CONTROL: the pickers still hide what they cannot render with', () => {
+ it('the bug backwards: the Create image picker drops the confirmed-partial file and keeps the copy', async () => {
+ // Same fixture as THE FIX above. If this list ever contained CATALOG_NAME,
+ // the switch would be gone and the picker would offer a broken graph; if
+ // the inventory list ever loses it again, the test above goes red. The two
+ // together are what pins the fix.
+ routeUnets([CATALOG_NAME, RENAMED])
+ const picker = (await getImageModels()).map((m) => m.name)
+ expect(picker).not.toContain(CATALOG_NAME)
+ expect(picker).toContain(RENAMED)
+ })
+
+ it('the video picker drops its confirmed-partial file too', async () => {
+ routeUnets([VIDEO_CATALOG_NAME])
+ expect(await getVideoModels()).toEqual([])
+ })
+
+ it('a complete download is in both, so the switch is about size and nothing else', async () => {
+ backendCall.mockImplementation(async (_cmd: string, args: { files: Array<{ filename: string }> }) =>
+ args.files.map((f) => ({ filename: f.filename, exists: true, actualBytes: 17_286_263_603, complete: true })),
+ )
+ routeUnets([CATALOG_NAME])
+ expect((await getImageModels()).map((m) => m.name)).toEqual([CATALOG_NAME])
+ expect((await getInstalledImageModels()).map((m) => m.name)).toEqual([CATALOG_NAME])
+ })
+
+ it('a file the probe cannot locate stays in the picker (konata 2026-06-07)', async () => {
+ // exists false means the size checker looked in the wrong ComfyUI root, not
+ // that the file is short. ComfyUI enumerated it, so ComfyUI can load it.
+ backendCall.mockImplementation(async (_cmd: string, args: { files: Array<{ filename: string }> }) =>
+ args.files.map((f) => ({ filename: f.filename, exists: false, actualBytes: 0, complete: false })),
+ )
+ routeUnets([CATALOG_NAME])
+ expect((await getImageModels()).map((m) => m.name)).toEqual([CATALOG_NAME])
+ })
+
+ it('an empty ComfyUI still yields an empty inventory, not a phantom', async () => {
+ routeUnets([])
+ expect(await getInstalledImageModels()).toEqual([])
+ })
+})
diff --git a/src/api/comfyui.ts b/src/api/comfyui.ts
index 01b66f07..ad891b2b 100644
--- a/src/api/comfyui.ts
+++ b/src/api/comfyui.ts
@@ -808,7 +808,36 @@ export async function filterPartialFiles(filenames: string[]): Promise<Set<strin
// ─── Classified Model Lists ───
-export async function getImageModels(): Promise<ClassifiedModel[]> {
+/**
+ * The main-model folders (checkpoints\, diffusion_models\, and the GGUF unets
+ * beside them), classified and narrowed to one lane.
+ *
+ * `hidePartialDownloads` is the entire difference between the two kinds of
+ * caller, and it is the R7 re-measure (2026-08-30) written down as a switch:
+ *
+ * - A PICKER asks "what can I render with", so a file that is confirmed too
+ * small for the catalogue entry of the same name is worth hiding: picking it
+ * would only hand the user a broken graph.
+ * - The INVENTORY asks "what is lying on my disk", and for that question a
+ * catalogue size is meaningless. It is a claim about the file WE ship, never
+ * about the file the user has.
+ *
+ * On the box a 13 MB `diffusion_models\flux1-dev-fp8.safetensors` was invisible
+ * in the whole app while a byte-identical copy named
+ * `flux1-dev-fp8-r67.safetensors` in the SAME folder listed fine: the catalogue
+ * ships FLUX.1 [dev] FP8 under the first name at 16.1 GB, so the size probe
+ * called the file partial and getImageModels dropped it, and the inventory read
+ * getImageModels. The user had a file on the disk he could neither see, nor
+ * measure, nor delete. Same shape as the R5 re-measure that took the filter out
+ * of the addon lanes, one folder further in.
+ *
+ * The catalogue card keeps its own verdict (discover.ts filters there) and goes
+ * on saying honestly that the package is not fully downloaded.
+ */
+async function mainModelLane(
+ keep: (type: ModelType) => boolean,
+ hidePartialDownloads: boolean,
+): Promise<ClassifiedModel[]> {
// GGUF quants are listed by ComfyUI-GGUF's own loader, NOT by UNETLoader
// (which only enumerates .safetensors/.sft). Leaving them out meant a user
// could install a GGUF bundle straight from our own Model Manager and then be
@@ -820,11 +849,13 @@ export async function getImageModels(): Promise<ClassifiedModel[]> {
getGgufUnetModels(),
])
const unets = [...new Set([...diffModels, ...ggufModels])]
- const complete = await filterPartialFiles([...checkpoints, ...unets])
+ const complete = hidePartialDownloads
+ ? await filterPartialFiles([...checkpoints, ...unets])
+ : null
const result: ClassifiedModel[] = []
for (const name of checkpoints) {
- if (!complete.has(name)) continue
+ if (complete && !complete.has(name)) continue
const type = classifyModel(name)
// One predicate for both loops. isImageModelType lets 'unknown' through, so
// a checkpoint the classifier cannot name is still offered, while the video
@@ -832,18 +863,18 @@ export async function getImageModels(): Promise<ClassifiedModel[]> {
// stay in their own pickers. The old branch renamed anything unmatched to
// sdxl instead of skipping it, which put an ACE-Step music checkpoint at
// the top of the image picker on a real box.
- if (!isImageModelType(type)) continue
+ if (!keep(type)) continue
result.push({ name, type, source: 'checkpoint' })
}
for (const name of unets) {
- if (!complete.has(name)) continue
+ if (complete && !complete.has(name)) continue
const type = classifyModel(name)
// isImageModelType already lets 'unknown' through, so a UNET the classifier
// cannot name is still offered. The lane-specific architectures (ACE audio,
// Wan S2V/Animate/VACE) are excluded by that same predicate and stay in
// their own pickers.
- if (isImageModelType(type)) {
+ if (keep(type)) {
result.push({ name, type, source: 'diffusion_model' })
}
}
@@ -851,37 +882,29 @@ export async function getImageModels(): Promise<ClassifiedModel[]> {
return result
}
-export async function getVideoModels(): Promise<ClassifiedModel[]> {
- // Same GGUF gap as getImageModels: our own catalogue ships Wan video models
- // as GGUF quants, and UNETLoader does not list those, so downloading one from
- // the Model Manager left the video tool insisting nothing was installed.
- const [checkpoints, diffModels, ggufModels] = await Promise.all([
- getCheckpoints(),
- getDiffusionModels(),
- getGgufUnetModels(),
- ])
- const unets = [...new Set([...diffModels, ...ggufModels])]
- const complete = await filterPartialFiles([...checkpoints, ...unets])
- const result: ClassifiedModel[] = []
+/** The Create image picker and model-pick: main models that are usable. */
+export async function getImageModels(): Promise<ClassifiedModel[]> {
+ return mainModelLane(isImageModelType, true)
+}
- // Video checkpoints (e.g. SVD)
- for (const name of checkpoints) {
- if (!complete.has(name)) continue
- const type = classifyModel(name)
- if (isVideoModelType(type)) {
- result.push({ name, type, source: 'checkpoint' })
- }
- }
+/** The Create video picker and detectVideoBackend: same deal one lane over.
+ * Our own catalogue ships Wan video models as GGUF quants, and UNETLoader does
+ * not list those, so downloading one from the Model Manager used to leave the
+ * video tool insisting nothing was installed. */
+export async function getVideoModels(): Promise<ClassifiedModel[]> {
+ return mainModelLane(isVideoModelType, true)
+}
- for (const name of unets) {
- if (!complete.has(name)) continue
- const type = classifyModel(name)
- if (isVideoModelType(type)) {
- result.push({ name, type, source: 'diffusion_model' })
- }
- }
+/** The main image folders for the INVENTORY surfaces: everything on the disk,
+ * no catalogue-size verdict. See mainModelLane for why the switch exists. */
+export async function getInstalledMainImageModels(): Promise<ClassifiedModel[]> {
+ return mainModelLane(isImageModelType, false)
+}
- return result
+/** The main video folders for the INVENTORY surfaces. Video twin of
+ * getInstalledMainImageModels. */
+export async function getInstalledMainVideoModels(): Promise<ClassifiedModel[]> {
+ return mainModelLane(isVideoModelType, false)
}
/** The AnimateDiff motion modules, as classified models. (getMotionModels,
@@ -943,12 +966,12 @@ async function inventoryLane(
* for a main model and getVideoModels still answers exactly what it did. */
export async function getInstalledVideoModels(): Promise<ClassifiedModel[]> {
const [videoModels, motionModels] = await Promise.all([
- inventoryLane('video', getVideoModels),
+ inventoryLane('video', getInstalledMainVideoModels),
inventoryLane('animatediff', getAnimateDiffMotionModels),
])
const out: ClassifiedModel[] = [...videoModels, ...motionModels]
if (motionModels.length > 0) {
- const imageModels = await inventoryLane('image', getImageModels)
+ const imageModels = await inventoryLane('image', getInstalledMainImageModels)
for (const m of imageModels) {
if (m.source !== 'checkpoint') continue
if (out.some((x) => x.name === m.name)) continue
@@ -1097,7 +1120,7 @@ export const INSTALLED_ADDON_SUBFOLDERS: string[] =
* main model, and this function is the only place that says otherwise. */
export async function getInstalledImageModels(): Promise<ClassifiedModel[]> {
const [imageModels, ...addons] = await Promise.all([
- inventoryLane('image', getImageModels),
+ inventoryLane('image', getInstalledMainImageModels),
...INSTALLED_ADDON_LANES.map((lane) => inventoryLane(lane.source, lane.read)),
])
const out: ClassifiedModel[] = []