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(comfyui): K9 - Krea 2 checkpoints get UNET+CLIP+VAE instead of unknown/CheckpointLoaderSimple

purple620d97c8ec86
diff --git a/src/api/__tests__/comfyui-models.test.ts b/src/api/__tests__/comfyui-models.test.ts
index 7a5f2c82..79143a0f 100644
--- a/src/api/__tests__/comfyui-models.test.ts
+++ b/src/api/__tests__/comfyui-models.test.ts
@@ -88,6 +88,15 @@ describe('classifyModel', () => {
expect(classifyModel('ernie_image_turbo_bf16.safetensors')).toBe('ernie_image')
})
+ // K9 (GH #136, eloieloie): Krea 2 checkpoints fell through to 'unknown' and
+ // got CheckpointLoaderSimple with no CLIP wired in ("clip input is invalid:
+ // None"). Filenames from the reporter's own install (krea-2, krea2, KREA_2).
+ it('classifies Krea 2 models (K9, GH #136)', () => {
+ expect(classifyModel('krea-2-dev-fp8.safetensors')).toBe('krea2')
+ expect(classifyModel('krea2_dev_bf16.safetensors')).toBe('krea2')
+ expect(classifyModel('KREA_2_base.safetensors')).toBe('krea2')
+ })
+
it('returns unknown for unrecognized models', () => {
expect(classifyModel('totally_custom_model.safetensors')).toBe('unknown')
})
@@ -109,7 +118,7 @@ describe('classifyModel', () => {
describe('isVideoModelType', () => {
const videoTypes = ['wan', 'hunyuan', 'ltx', 'mochi', 'cosmos', 'cogvideo', 'svd', 'framepack', 'pyramidflow', 'allegro'] as const
- const imageTypes = ['flux', 'flux2', 'zimage', 'ernie_image', 'sdxl', 'sd15', 'unknown'] as const
+ const imageTypes = ['flux', 'flux2', 'krea2', 'zimage', 'ernie_image', 'sdxl', 'sd15', 'unknown'] as const
for (const t of videoTypes) {
it(`${t} is a video model type`, () => {
@@ -157,7 +166,12 @@ describe('MODEL_TYPE_DEFAULTS', () => {
// ─── COMPONENT_REGISTRY ───
describe('COMPONENT_REGISTRY', () => {
- const allTypes = ['sd15', 'sdxl', 'flux', 'flux2', 'zimage', 'ernie_image', 'wan', 'hunyuan', 'ltx', 'mochi', 'cosmos', 'cogvideo', 'svd', 'framepack', 'pyramidflow', 'allegro', 'unknown']
+ // K9/component-registry consolidation: krea2 and wan22 are included here —
+ // wan22 was the drift the two duplicate registries had already accumulated
+ // (present in discover.ts's copy, missing from comfyui.ts's) before they
+ // were merged into one file (component-registry.ts); a loop like this one
+ // would have caught it.
+ const allTypes = ['sd15', 'sdxl', 'flux', 'flux2', 'krea2', 'zimage', 'ernie_image', 'wan', 'wan22', 'hunyuan', 'ltx', 'mochi', 'cosmos', 'cogvideo', 'svd', 'framepack', 'pyramidflow', 'allegro', 'unknown']
for (const t of allTypes) {
it(`${t} has a registry entry`, () => {
diff --git a/src/api/__tests__/discover-registry.test.ts b/src/api/__tests__/discover-registry.test.ts
index 82827e96..d1127dfe 100644
--- a/src/api/__tests__/discover-registry.test.ts
+++ b/src/api/__tests__/discover-registry.test.ts
@@ -305,9 +305,9 @@ describe('discover — data validation', () => {
const spec = COMPONENT_REGISTRY[t]
if (spec.needsSeparateVAE && spec.vae) {
expect(spec.vae.downloadUrl).toMatch(/^https:\/\//)
- expect(typeof spec.vae.downloadName).toBe('string')
+ expect(typeof spec.vae.downloadFilename).toBe('string')
expect(typeof spec.vae.subfolder).toBe('string')
- expect(Array.isArray(spec.vae.patterns)).toBe(true)
+ expect(Array.isArray(spec.vae.matchPatterns)).toBe(true)
}
}
})
@@ -318,7 +318,7 @@ describe('discover — data validation', () => {
const spec = COMPONENT_REGISTRY[t]
if (spec.needsSeparateCLIP && spec.clip) {
expect(spec.clip.downloadUrl).toMatch(/^https:\/\//)
- expect(typeof spec.clip.downloadName).toBe('string')
+ expect(typeof spec.clip.downloadFilename).toBe('string')
}
}
})
diff --git a/src/api/__tests__/dynamic-workflow-strategy.test.ts b/src/api/__tests__/dynamic-workflow-strategy.test.ts
index 072570e0..c7372907 100644
--- a/src/api/__tests__/dynamic-workflow-strategy.test.ts
+++ b/src/api/__tests__/dynamic-workflow-strategy.test.ts
@@ -51,6 +51,20 @@ describe('dynamic-workflow — determineStrategy', () => {
const result = determineStrategy('zimage', false, makeNodes(), makeModels())
expect(result.strategy).toBe('unet_zimage')
})
+
+ // K9 (GH #136, eloieloie): Krea 2 checkpoints classified 'unknown' fell
+ // back to CheckpointLoaderSimple without a CLIP loader ("clip input is
+ // invalid: None"). krea2 now has its own branch, same shape as flux/flux2.
+ it('krea2 model -> unet_krea2 strategy', () => {
+ const result = determineStrategy('krea2', false, makeNodes(), makeModels())
+ expect(result.strategy).toBe('unet_krea2')
+ })
+
+ it('krea2 without VAELoader -> unavailable', () => {
+ const nodes = makeNodes({ loaders: ['UNETLoader', 'CLIPLoader'] })
+ const result = determineStrategy('krea2', false, nodes, makeModels())
+ expect(result.strategy).toBe('unavailable')
+ })
})
// ─── Checkpoint variants ───
@@ -194,6 +208,19 @@ describe('dynamic-workflow — determineStrategy', () => {
expect(result.strategy).toBe('unavailable')
})
+ // K9: an unrecognized architecture with UNET+CLIP+VAE but no checkpoint
+ // loader used to fall through to 'unet_flux' on the unstated assumption
+ // that any UNET-only file is a FLUX model — silently applying FLUX's CLIP
+ // type and VAE match patterns to a model that might not be FLUX at all.
+ // It must now say honestly that it would not guess, never fall back.
+ it('unrecognized architecture (UNET+CLIP+VAE, no checkpoint loader) -> unavailable, never a guessed unet_flux', () => {
+ const nodes = makeNodes({ loaders: ['UNETLoader', 'CLIPLoader', 'VAELoader'] })
+ const result = determineStrategy('unknown' as ModelType, false, nodes, makeModels())
+ expect(result.strategy).toBe('unavailable')
+ expect(result.strategy).not.toBe('unet_flux')
+ expect(result.reason.toLowerCase()).toContain('could not determine')
+ })
+
it('wan without VAELoader -> unavailable', () => {
const nodes = makeNodes({ loaders: ['UNETLoader', 'CLIPLoader'] })
const result = determineStrategy('wan', true, nodes, makeModels())
diff --git a/src/api/__tests__/model-pipeline.test.ts b/src/api/__tests__/model-pipeline.test.ts
index f7c89a81..e06ce67b 100644
--- a/src/api/__tests__/model-pipeline.test.ts
+++ b/src/api/__tests__/model-pipeline.test.ts
@@ -151,25 +151,25 @@ describe('COMPONENT_REGISTRY', () => {
})
it('FLUX 1 uses T5 encoder', () => {
- expect(COMPONENT_REGISTRY.flux.clip!.patterns).toContain('t5xxl')
+ expect(COMPONENT_REGISTRY.flux.clip!.matchPatterns).toContain('t5xxl')
})
it('FLUX 2 uses Qwen/Mistral encoder (NOT T5)', () => {
- const patterns = COMPONENT_REGISTRY.flux2.clip!.patterns
+ const patterns = COMPONENT_REGISTRY.flux2.clip!.matchPatterns
expect(patterns).toContain('qwen')
expect(patterns).not.toContain('t5xxl')
})
it('Wan uses UMT5 encoder', () => {
- expect(COMPONENT_REGISTRY.wan.clip!.patterns).toContain('umt5')
+ expect(COMPONENT_REGISTRY.wan.clip!.matchPatterns).toContain('umt5')
})
it('Hunyuan uses Qwen encoder', () => {
- expect(COMPONENT_REGISTRY.hunyuan.clip!.patterns).toContain('qwen')
+ expect(COMPONENT_REGISTRY.hunyuan.clip!.matchPatterns).toContain('qwen')
})
it('LTX uses Gemma encoder', () => {
- expect(COMPONENT_REGISTRY.ltx.clip!.patterns).toContain('gemma')
+ expect(COMPONENT_REGISTRY.ltx.clip!.matchPatterns).toContain('gemma')
})
it('every downloadUrl is HTTPS', () => {
@@ -203,10 +203,10 @@ describe('Encoder-Type consistency', () => {
const reg = COMPONENT_REGISTRY[type as ModelType]
if (!reg.clip) return
// At least one pattern should be in the expected list
- const hasMatch = reg.clip.patterns.some(p =>
+ const hasMatch = reg.clip.matchPatterns.some(p =>
expected.encoderPatterns.some(e => p.includes(e) || e.includes(p))
)
- expect(hasMatch, `${type}: registry patterns ${reg.clip.patterns} should overlap with ${expected.encoderPatterns}`).toBe(true)
+ expect(hasMatch, `${type}: registry patterns ${reg.clip.matchPatterns} should overlap with ${expected.encoderPatterns}`).toBe(true)
})
}
})
diff --git a/src/api/comfyui.ts b/src/api/comfyui.ts
index 31335363..752fe7a1 100644
--- a/src/api/comfyui.ts
+++ b/src/api/comfyui.ts
@@ -152,7 +152,7 @@ export function galleryTypeForFile(
// 2.5.8: ace / wans2v / wananimate / wanvace are the specialized local-lane
// architectures (music, talking character, motion control). They are neither
// image nor video picker material — each lane has its own model list.
-export type ModelType = 'flux' | 'flux2' | 'zimage' | 'ernie_image' | 'sdxl' | 'sd15' | 'wan' | 'wan22' | 'hunyuan' | 'ltx' | 'mochi' | 'cosmos' | 'cogvideo' | 'svd' | 'framepack' | 'pyramidflow' | 'allegro' | 'ace' | 'wans2v' | 'wananimate' | 'wanvace' | 'animatediff' | 'unknown'
+export type ModelType = 'flux' | 'flux2' | 'krea2' | 'zimage' | 'ernie_image' | 'sdxl' | 'sd15' | 'wan' | 'wan22' | 'hunyuan' | 'ltx' | 'mochi' | 'cosmos' | 'cogvideo' | 'svd' | 'framepack' | 'pyramidflow' | 'allegro' | 'ace' | 'wans2v' | 'wananimate' | 'wanvace' | 'animatediff' | 'unknown'
export type VideoBackend = 'wan' | 'animatediff' | 'none'
export interface ClassifiedModel {
@@ -265,6 +265,18 @@ export function classifyModel(name: string | null | undefined): ModelType {
if (lower.includes('flux-2') || lower.includes('flux2')) return 'flux2'
if (lower.includes('flux')) return 'flux'
+ // Krea 2 (K9, GH #136 atobo): CivitAI ships these as a single checkpoint
+ // file, but the base model is a decoupled UNETLoader + CLIPLoader(type=
+ // "krea2") + VAE pipeline, NOT a self-contained CheckpointLoaderSimple
+ // graph. Before this check the name fell through to 'unknown', which
+ // CLASSIFIED it as an ordinary checkpoint and loaded it with
+ // CheckpointLoaderSimple — the file has no embedded CLIP, so ComfyUI
+ // answered "clip input is invalid: None". Detect before the 'xl' suffix
+ // scan below: CivitAI filenames commonly end "...Krea2_fp8.safetensors",
+ // which would otherwise never reach it anyway, but keep the ordering
+ // explicit so a future tag never sneaks in ahead of it.
+ if (lower.includes('krea')) return 'krea2'
+
// Explicit architecture tags
if (lower.includes('sdxl') || lower.includes('sd_xl')) return 'sdxl'
if (lower.includes('sd15') || lower.includes('sd_1') || lower.includes('v1-5') || lower.includes('sd1.5')) return 'sd15'
@@ -284,7 +296,7 @@ export function classifyModel(name: string | null | undefined): ModelType {
}
export function isImageModelType(type: ModelType): boolean {
- return type === 'flux' || type === 'flux2' || type === 'zimage' || type === 'ernie_image' || type === 'sdxl' || type === 'sd15' || type === 'unknown'
+ return type === 'flux' || type === 'flux2' || type === 'krea2' || type === 'zimage' || type === 'ernie_image' || type === 'sdxl' || type === 'sd15' || type === 'unknown'
}
export function isVideoModelType(type: ModelType): boolean {
@@ -399,6 +411,8 @@ export const MODEL_TYPE_DEFAULTS: Record<string, ModelTypeDefaults> = {
sdxl: { steps: 25, cfg: 7.0, sampler: 'dpmpp_2m', scheduler: 'karras', width: 1024, height: 1024, frames: 1, fps: 1 },
flux: { steps: 20, cfg: 1.0, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024, frames: 1, fps: 1 },
flux2: { steps: 20, cfg: 1.0, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024, frames: 1, fps: 1 },
+ // Krea 2 (GH #136): author workflow runs euler @ CFG 1, 8 steps, 1024x1024.
+ krea2: { steps: 8, cfg: 1.0, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024, frames: 1, fps: 1 },
zimage: { steps: 12, cfg: 3.5, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024, frames: 1, fps: 1 },
unknown:{ steps: 25, cfg: 7.0, sampler: 'euler', scheduler: 'normal', width: 1024, height: 1024, frames: 1, fps: 1 },
// ── Video ──
@@ -435,90 +449,14 @@ export const MODEL_TYPE_DEFAULTS: Record<string, ModelTypeDefaults> = {
// ─── Component Requirements per model type ───
-export interface ComponentSpec {
- matchPatterns: string[]
- downloadFilename: string
- downloadUrl?: string
-}
-
-export interface ComponentRequirements {
- loader: 'UNETLoader' | 'CheckpointLoaderSimple' | 'ImageOnlyCheckpointLoader'
- needsSeparateVAE: boolean
- needsSeparateCLIP: boolean
- vae?: ComponentSpec
- clip?: ComponentSpec
- clipType?: string
-}
-
-export const COMPONENT_REGISTRY: Record<string, ComponentRequirements> = {
- sd15: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
- sdxl: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
- flux: {
- loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'flux',
- vae: { matchPatterns: ['ae', 'flux'], downloadFilename: 'ae.safetensors' },
- clip: { matchPatterns: ['t5'], downloadFilename: 't5xxl_fp8_e4m3fn.safetensors' },
- },
- flux2: {
- loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'flux2',
- vae: { matchPatterns: ['flux2', 'flux'], downloadFilename: 'flux2-vae.safetensors' },
- clip: { matchPatterns: ['qwen', 'mistral'], downloadFilename: 'qwen_3_4b_fp4_flux2.safetensors' },
- },
- zimage: {
- loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'qwen_image',
- vae: { matchPatterns: ['ae', 'flux'], downloadFilename: 'ae.safetensors' },
- clip: { matchPatterns: ['qwen_3_4b', 'qwen3'], downloadFilename: 'qwen_3_4b.safetensors' },
- },
- ernie_image: {
- loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'flux2',
- vae: { matchPatterns: ['flux2-vae', 'flux2', 'flux'], downloadFilename: 'flux2-vae.safetensors' },
- clip: { matchPatterns: ['ministral-3-3b', 'ministral', 'ernie-image-prompt-enhancer'], downloadFilename: 'ministral-3-3b.safetensors' },
- },
- wan: {
- loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'wan',
- vae: { matchPatterns: ['wan', 'hunyuan'], downloadFilename: 'wan_2.1_vae.safetensors' },
- clip: { matchPatterns: ['umt5', 'wan'], downloadFilename: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors' },
- },
- hunyuan: {
- loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'wan',
- vae: { matchPatterns: ['hunyuanvideo', 'hunyuan', 'wan'], downloadFilename: 'hunyuanvideo15_vae_fp16.safetensors' },
- clip: { matchPatterns: ['qwen', 'llava', 'umt5'], downloadFilename: 'qwen_2.5_vl_7b_fp8_scaled.safetensors' },
- },
- ltx: {
- loader: 'UNETLoader', needsSeparateVAE: false, needsSeparateCLIP: true, clipType: 'ltxv',
- clip: { matchPatterns: ['gemma'], downloadFilename: 'gemma_3_12B_it_fp8_scaled.safetensors' },
- },
- mochi: {
- loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'mochi',
- vae: { matchPatterns: ['mochi'], downloadFilename: 'mochi_vae.safetensors' },
- clip: { matchPatterns: ['t5'], downloadFilename: 't5xxl_fp16.safetensors' },
- },
- cosmos: {
- loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'cosmos',
- vae: { matchPatterns: ['cosmos'], downloadFilename: 'cosmos_cv8x8x8_1.0.safetensors' },
- clip: { matchPatterns: ['oldt5'], downloadFilename: 'oldt5_xxl_fp8_e4m3fn_scaled.safetensors' },
- },
- cogvideo: {
- loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'cogvideo',
- vae: { matchPatterns: ['cogvideox', 'cogvideo'], downloadFilename: 'cogvideox_vae_bf16.safetensors' },
- clip: { matchPatterns: ['t5'], downloadFilename: 't5xxl_fp16.safetensors' },
- },
- svd: {
- loader: 'ImageOnlyCheckpointLoader', needsSeparateVAE: false, needsSeparateCLIP: false,
- },
- framepack: {
- loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'wan',
- vae: { matchPatterns: ['hunyuan_video_vae', 'hunyuan'], downloadFilename: 'hunyuan_video_vae_bf16.safetensors' },
- clip: { matchPatterns: ['llava', 'qwen', 'umt5'], downloadFilename: 'llava_llama3_fp8_scaled.safetensors' },
- },
- pyramidflow: {
- loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: false, clipType: 'pyramidflow',
- vae: { matchPatterns: ['pyramid'], downloadFilename: 'pyramid_flow_vae_bf16.safetensors' },
- },
- allegro: {
- loader: 'UNETLoader', needsSeparateVAE: false, needsSeparateCLIP: false, clipType: 'allegro',
- },
- unknown: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
-}
+// K9 (GH #136): the registry used to be declared here AND, separately, in
+// discover.ts — two copies of the same per-model-type data that both had to
+// be remembered on every new architecture. Krea 2 only reached one of them.
+// Canonical data now lives in component-registry.ts (Audit W-T2 pattern —
+// same fix as pulling the bundle catalog into model-bundles.ts); both
+// comfyui.ts and discover.ts import it and neither has to import the other.
+export type { ComponentSpec, ComponentRequirements } from './component-registry'
+export { COMPONENT_REGISTRY } from './component-registry'
// ─── Connection & Info ───
@@ -1466,6 +1404,16 @@ export async function findMatchingVAE(modelType: ModelType): Promise<string> {
if (match) return match
throw new Error(`No FLUX 2 VAE found. Download "flux2-vae.safetensors" from the Model Manager.`)
}
+ if (modelType === 'krea2') {
+ // Krea 2's companion VAE is not standardized across CivitAI finetunes
+ // (GH #136 saw both qwen_image_vae and wan_2.1_vae). Try a Krea-named
+ // file first, then the two variants confirmed by the issue reporter.
+ const match = vaes.find(v => lower(v).includes('krea'))
+ || vaes.find(v => lower(v).includes('qwen_image'))
+ || vaes.find(v => /wan[._]?2[._]?1/.test(lower(v)))
+ if (match) return match
+ throw new Error(`No Krea 2 VAE found. Download "qwen_image_vae.safetensors" (or "wan_2.1_vae.safetensors", depending on the checkpoint) from the Model Manager.`)
+ }
if (modelType === 'hunyuan') {
// HunyuanVideo has its own VAE — prefer it, fall back to Wan VAE
const match = vaes.find(v => lower(v).includes('hunyuanvideo'))
@@ -1609,6 +1557,15 @@ export async function findMatchingCLIP(modelType: ModelType, activeModelName?: s
if (match) return match
throw new Error(`No ERNIE-Image text encoder found. Download "ernie-image-prompt-enhancer.safetensors" from the Model Manager.`)
}
+ if (modelType === 'krea2') {
+ // Krea 2 uses Qwen3-VL 4B, shipped under different quant-tier filenames
+ // by different finetune authors (GH #136: qwen3vl_4b_int8_convrot vs
+ // qwen3vl_4b_fp8_scaled) — match on the qwen3vl family, not one filename.
+ const match = clips.find(c => lower(c).includes('qwen3vl') || lower(c).includes('qwen3_vl'))
+ || clips.find(c => lower(c).includes('qwen') && lower(c).includes('vl'))
+ if (match) return match
+ throw new Error(`No Krea 2 text encoder found. Download "qwen3vl_4b_fp8_scaled.safetensors" from the Model Manager.`)
+ }
if (modelType === 'flux') {
const match = clips.find(c => lower(c).includes('t5') && !lower(c).includes('umt5'))
|| clips.find(c => lower(c).includes('clip_l'))
diff --git a/src/api/component-registry.ts b/src/api/component-registry.ts
new file mode 100644
index 00000000..2c7a1ef9
--- /dev/null
+++ b/src/api/component-registry.ts
@@ -0,0 +1,134 @@
+// ─── Component Registry: What each model type needs to work ───
+//
+// K9 (GH #136, atobo — Krea 2 classification): this table used to be typed
+// out TWICE, once in comfyui.ts (matchPatterns/downloadFilename/clipType,
+// read by findMatchingVAE/findMatchingCLIP and the workflow builders) and
+// once in discover.ts (patterns/downloadName/downloadUrl/subfolder, read by
+// the component-completion download path and the catalogAddresses live-URL
+// gate). Adding a new model type meant remembering to update both — Krea 2
+// only reached one of them, which is exactly the kind of gap that let #136
+// happen in the first place. Same shape as the Audit W-T2 fix that pulled
+// the bundle catalog out of comfyui.ts/discover.ts into model-bundles.ts:
+// shared data lives in its own file that both import, so there is exactly
+// one place to update and neither module has to reach into the other
+// (comfyui.ts ↔ discover.ts staying acyclic is deliberate — see the Audit
+// W-T2 comment at the top of comfyui.ts).
+
+/** One component (VAE or text encoder) a model type needs. */
+export interface ComponentSpec {
+ /** Substrings tried in order against the live ComfyUI enum. */
+ matchPatterns: string[]
+ /** Filename to write to disk when this component is fetched. */
+ downloadFilename: string
+ /** Direct download address, when one is known and verified reachable
+ * (checked by `hf-catalog-addresses.live.test.ts`). Absent means "the app
+ * cannot offer a one-click download for this component" — findMatchingVAE
+ * / findMatchingCLIP still tell the user which file to get and where the
+ * Model Manager looks for it, they just cannot fetch it automatically. */
+ downloadUrl?: string
+ /** ComfyUI\models subfolder this component's download lands in. */
+ subfolder?: string
+}
+
+export interface ComponentRequirements {
+ // SVD loads through ComfyUI's ImageOnlyCheckpointLoader.
+ loader: 'UNETLoader' | 'CheckpointLoaderSimple' | 'ImageOnlyCheckpointLoader'
+ needsSeparateVAE: boolean
+ needsSeparateCLIP: boolean
+ vae?: ComponentSpec
+ clip?: ComponentSpec
+ /** A second required text encoder (FLUX v1's clip_l alongside its T5). */
+ clipSecondary?: ComponentSpec
+ /** The CLIPLoader `type` widget value for this architecture, when the
+ * loader is CLIPLoader (single encoder). */
+ clipType?: string
+}
+
+export const COMPONENT_REGISTRY: Record<string, ComponentRequirements> = {
+ sd15: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
+ sdxl: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
+ flux: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'flux',
+ vae: { matchPatterns: ['ae', 'flux'], downloadFilename: 'ae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/vae/ae.safetensors', subfolder: 'vae' },
+ clip: { matchPatterns: ['t5xxl', 't5-xxl', 't5_xxl'], downloadFilename: 't5xxl_fp8_e4m3fn.safetensors', downloadUrl: 'https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors', subfolder: 'text_encoders' },
+ clipSecondary: { matchPatterns: ['clip_l'], downloadFilename: 'clip_l.safetensors', downloadUrl: 'https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors', subfolder: 'text_encoders' },
+ },
+ flux2: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'flux2',
+ vae: { matchPatterns: ['flux2', 'flux'], downloadFilename: 'flux2-vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-4b/resolve/main/split_files/vae/flux2-vae.safetensors', subfolder: 'vae' },
+ clip: { matchPatterns: ['qwen', 'mistral'], downloadFilename: 'qwen_3_4b_fp4_flux2.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-4b/resolve/main/split_files/text_encoders/qwen_3_4b_fp4_flux2.safetensors', subfolder: 'text_encoders' },
+ },
+ // Krea 2 (K9, GH #136): companion VAE/CLIP filenames are not standardized
+ // across CivitAI finetune authors (qwen_image_vae vs wan_2.1_vae;
+ // qwen3vl_4b_int8_convrot vs qwen3vl_4b_fp8_scaled — see the issue). No
+ // verified direct-download address exists yet, so downloadUrl stays unset
+ // rather than guessing one: findMatchingVAE/findMatchingCLIP still name
+ // the exact file to fetch manually via the Model Manager.
+ krea2: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'krea2',
+ vae: { matchPatterns: ['krea', 'qwen_image', 'wan'], downloadFilename: 'qwen_image_vae.safetensors', subfolder: 'vae' },
+ clip: { matchPatterns: ['qwen3vl', 'qwen3_vl'], downloadFilename: 'qwen3vl_4b_fp8_scaled.safetensors', subfolder: 'text_encoders' },
+ },
+ zimage: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'qwen_image',
+ vae: { matchPatterns: ['ae', 'flux'], downloadFilename: 'ae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/vae/ae.safetensors', subfolder: 'vae' },
+ clip: { matchPatterns: ['qwen_3_4b', 'qwen3'], downloadFilename: 'qwen_3_4b.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/text_encoders/qwen_3_4b.safetensors', subfolder: 'text_encoders' },
+ },
+ ernie_image: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'flux2',
+ vae: { matchPatterns: ['flux2-vae', 'flux2', 'flux'], downloadFilename: 'flux2-vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/ERNIE-Image/resolve/main/vae/flux2-vae.safetensors', subfolder: 'vae' },
+ clip: { matchPatterns: ['ministral-3-3b', 'ministral', 'ernie-image-prompt-enhancer'], downloadFilename: 'ministral-3-3b.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/ERNIE-Image/resolve/main/text_encoders/ministral-3-3b.safetensors', subfolder: 'text_encoders' },
+ },
+ wan: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'wan',
+ vae: { matchPatterns: ['wan', 'hunyuan'], downloadFilename: 'wan_2.1_vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/vae/wan_2.1_vae.safetensors', subfolder: 'vae' },
+ clip: { matchPatterns: ['umt5', 'wan'], downloadFilename: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors', subfolder: 'text_encoders' },
+ },
+ wan22: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'wan',
+ // Wan 2.2 5B uses its OWN VAE (higher compression than 2.1). Prefer the 2.2 file;
+ // 'wan' fallback covers a 2.1 VAE only as a last resort. CLIP is the shared UMT5.
+ vae: { matchPatterns: ['wan2.2', 'wan2_2'], downloadFilename: 'wan2.2_vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/vae/wan2.2_vae.safetensors', subfolder: 'vae' },
+ clip: { matchPatterns: ['umt5', 'wan'], downloadFilename: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors', subfolder: 'text_encoders' },
+ },
+ hunyuan: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'wan',
+ vae: { matchPatterns: ['hunyuanvideo', 'hunyuan', 'wan'], downloadFilename: 'hunyuanvideo15_vae_fp16.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_1.5_repackaged/resolve/main/split_files/vae/hunyuanvideo15_vae_fp16.safetensors', subfolder: 'vae' },
+ clip: { matchPatterns: ['qwen', 'llava', 'umt5'], downloadFilename: 'qwen_2.5_vl_7b_fp8_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_1.5_repackaged/resolve/main/split_files/text_encoders/qwen_2.5_vl_7b_fp8_scaled.safetensors', subfolder: 'text_encoders' },
+ },
+ ltx: {
+ loader: 'UNETLoader', needsSeparateVAE: false, needsSeparateCLIP: true, clipType: 'ltxv',
+ clip: { matchPatterns: ['gemma'], downloadFilename: 'gemma_3_12B_it_fp8_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/ltx-2/resolve/main/split_files/text_encoders/gemma_3_12B_it_fp8_scaled.safetensors', subfolder: 'text_encoders' },
+ },
+ mochi: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'mochi',
+ vae: { matchPatterns: ['mochi'], downloadFilename: 'mochi_vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/mochi_preview_repackaged/resolve/main/split_files/vae/mochi_vae.safetensors', subfolder: 'vae' },
+ clip: { matchPatterns: ['t5'], downloadFilename: 't5xxl_fp16.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/mochi_preview_repackaged/resolve/main/split_files/text_encoders/t5xxl_fp16.safetensors', subfolder: 'text_encoders' },
+ },
+ cosmos: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'cosmos',
+ vae: { matchPatterns: ['cosmos'], downloadFilename: 'cosmos_cv8x8x8_1.0.safetensors', downloadUrl: 'https://huggingface.co/comfyanonymous/cosmos_1.0_text_encoder_and_VAE_ComfyUI/resolve/main/vae/cosmos_cv8x8x8_1.0.safetensors', subfolder: 'vae' },
+ clip: { matchPatterns: ['oldt5'], downloadFilename: 'oldt5_xxl_fp8_e4m3fn_scaled.safetensors', downloadUrl: 'https://huggingface.co/comfyanonymous/cosmos_1.0_text_encoder_and_VAE_ComfyUI/resolve/main/text_encoders/oldt5_xxl_fp8_e4m3fn_scaled.safetensors', subfolder: 'text_encoders' },
+ },
+ cogvideo: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'cogvideo',
+ vae: { matchPatterns: ['cogvideox', 'cogvideo'], downloadFilename: 'cogvideox_vae_bf16.safetensors', downloadUrl: 'https://huggingface.co/Kijai/CogVideoX-comfy/resolve/main/cogvideox_vae_bf16.safetensors', subfolder: 'vae' },
+ clip: { matchPatterns: ['t5'], downloadFilename: 't5xxl_fp16.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/mochi_preview_repackaged/resolve/main/split_files/text_encoders/t5xxl_fp16.safetensors', subfolder: 'text_encoders' },
+ },
+ svd: {
+ loader: 'ImageOnlyCheckpointLoader', needsSeparateVAE: false, needsSeparateCLIP: false,
+ },
+ framepack: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: true, clipType: 'wan',
+ vae: { matchPatterns: ['hunyuan_video_vae', 'hunyuan'], downloadFilename: 'hunyuan_video_vae_bf16.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_repackaged/resolve/main/split_files/vae/hunyuan_video_vae_bf16.safetensors', subfolder: 'vae' },
+ clip: { matchPatterns: ['llava', 'qwen', 'umt5'], downloadFilename: 'llava_llama3_fp8_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_repackaged/resolve/main/split_files/text_encoders/llava_llama3_fp8_scaled.safetensors', subfolder: 'text_encoders' },
+ },
+ pyramidflow: {
+ loader: 'UNETLoader', needsSeparateVAE: true, needsSeparateCLIP: false, clipType: 'pyramidflow',
+ vae: { matchPatterns: ['pyramid'], downloadFilename: 'pyramid_flow_vae_bf16.safetensors', downloadUrl: 'https://huggingface.co/Kijai/pyramid-flow-comfy/resolve/main/pyramid_flow_vae_bf16.safetensors', subfolder: 'vae' },
+ },
+ allegro: {
+ loader: 'UNETLoader', needsSeparateVAE: false, needsSeparateCLIP: false, clipType: 'allegro',
+ },
+ unknown: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
+}
diff --git a/src/api/discover.ts b/src/api/discover.ts
index 14dd9747..6ef0959e 100644
--- a/src/api/discover.ts
+++ b/src/api/discover.ts
@@ -1,5 +1,6 @@
import { backendCall, fetchExternal } from "./backend"
import { readComfyFolderLists, filterPartialFiles, refreshComfyModels } from "./comfyui"
+import { COMPONENT_REGISTRY, type ComponentSpec, type ComponentRequirements } from './component-registry'
import { clearNodeCache } from "./comfyui-nodes"
import { restartComfyForNewNodes } from "./comfy-restart"
import type { ProviderId } from "./providers/types"
@@ -788,113 +789,16 @@ export async function installBundleComplete(bundle: ModelBundle): Promise<void>
}
// ─── Component Registry: What each model type needs to work ───
-
-
-export interface ComponentSpec {
- patterns: string[]
- downloadName: string
- downloadUrl: string
- subfolder: string
-}
-
-export interface ComponentRequirements {
- // SVD loads through ComfyUI's ImageOnlyCheckpointLoader — the registry
- // below has always said so, only this union (a stale copy of the one in
- // comfyui.ts, which lists all three) had not caught up.
- loader: 'UNETLoader' | 'CheckpointLoaderSimple' | 'ImageOnlyCheckpointLoader'
- vae?: ComponentSpec
- clip?: ComponentSpec
- clipSecondary?: ComponentSpec
- needsSeparateVAE: boolean
- needsSeparateCLIP: boolean
-}
-
-export const COMPONENT_REGISTRY: Record<string, ComponentRequirements> = {
- sd15: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
- sdxl: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
- flux: {
- loader: 'UNETLoader',
- vae: { patterns: ['ae', 'flux'], downloadName: 'ae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/vae/ae.safetensors', subfolder: 'vae' },
- clip: { patterns: ['t5xxl', 't5-xxl', 't5_xxl'], downloadName: 't5xxl_fp8_e4m3fn.safetensors', downloadUrl: 'https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors', subfolder: 'text_encoders' },
- clipSecondary: { patterns: ['clip_l'], downloadName: 'clip_l.safetensors', downloadUrl: 'https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true, needsSeparateCLIP: true,
- },
- flux2: {
- loader: 'UNETLoader',
- vae: { patterns: ['flux2', 'flux'], downloadName: 'flux2-vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-4b/resolve/main/split_files/vae/flux2-vae.safetensors', subfolder: 'vae' },
- clip: { patterns: ['qwen', 'mistral'], downloadName: 'qwen_3_4b_fp4_flux2.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-4b/resolve/main/split_files/text_encoders/qwen_3_4b_fp4_flux2.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true, needsSeparateCLIP: true,
- },
- zimage: {
- loader: 'UNETLoader',
- vae: { patterns: ['ae', 'flux'], downloadName: 'ae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/vae/ae.safetensors', subfolder: 'vae' },
- clip: { patterns: ['qwen_3_4b', 'qwen3'], downloadName: 'qwen_3_4b.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/text_encoders/qwen_3_4b.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true, needsSeparateCLIP: true,
- },
- ernie_image: {
- loader: 'UNETLoader',
- vae: { patterns: ['flux2-vae', 'flux2', 'flux'], downloadName: 'flux2-vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/ERNIE-Image/resolve/main/vae/flux2-vae.safetensors', subfolder: 'vae' },
- clip: { patterns: ['ministral-3-3b', 'ministral', 'ernie-image-prompt-enhancer'], downloadName: 'ministral-3-3b.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/ERNIE-Image/resolve/main/text_encoders/ministral-3-3b.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true, needsSeparateCLIP: true,
- },
- wan: {
- loader: 'UNETLoader',
- vae: { patterns: ['wan'], downloadName: 'wan_2.1_vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/vae/wan_2.1_vae.safetensors', subfolder: 'vae' },
- clip: { patterns: ['umt5', 'wan'], downloadName: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true, needsSeparateCLIP: true,
- },
- wan22: {
- loader: 'UNETLoader',
- // Wan 2.2 5B uses its OWN VAE (higher compression than 2.1). Prefer the 2.2 file;
- // 'wan' fallback covers a 2.1 VAE only as a last resort. CLIP is the shared UMT5.
- vae: { patterns: ['wan2.2', 'wan2_2'], downloadName: 'wan2.2_vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/vae/wan2.2_vae.safetensors', subfolder: 'vae' },
- clip: { patterns: ['umt5', 'wan'], downloadName: 'umt5_xxl_fp8_e4m3fn_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true, needsSeparateCLIP: true,
- },
- hunyuan: {
- loader: 'UNETLoader',
- vae: { patterns: ['hunyuanvideo', 'hunyuan'], downloadName: 'hunyuanvideo15_vae_fp16.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_1.5_repackaged/resolve/main/split_files/vae/hunyuanvideo15_vae_fp16.safetensors', subfolder: 'vae' },
- clip: { patterns: ['qwen', 'llava'], downloadName: 'qwen_2.5_vl_7b_fp8_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_1.5_repackaged/resolve/main/split_files/text_encoders/qwen_2.5_vl_7b_fp8_scaled.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true, needsSeparateCLIP: true,
- },
- ltx: {
- loader: 'UNETLoader',
- clip: { patterns: ['gemma'], downloadName: 'gemma_3_12B_it_fp8_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/ltx-2/resolve/main/split_files/text_encoders/gemma_3_12B_it_fp8_scaled.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: false, needsSeparateCLIP: true,
- },
- mochi: {
- loader: 'UNETLoader',
- vae: { patterns: ['mochi'], downloadName: 'mochi_vae.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/mochi_preview_repackaged/resolve/main/split_files/vae/mochi_vae.safetensors', subfolder: 'vae' },
- clip: { patterns: ['t5'], downloadName: 't5xxl_fp16.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/mochi_preview_repackaged/resolve/main/split_files/text_encoders/t5xxl_fp16.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true, needsSeparateCLIP: true,
- },
- cosmos: {
- loader: 'UNETLoader',
- vae: { patterns: ['cosmos'], downloadName: 'cosmos_cv8x8x8_1.0.safetensors', downloadUrl: 'https://huggingface.co/comfyanonymous/cosmos_1.0_text_encoder_and_VAE_ComfyUI/resolve/main/vae/cosmos_cv8x8x8_1.0.safetensors', subfolder: 'vae' },
- clip: { patterns: ['oldt5'], downloadName: 'oldt5_xxl_fp8_e4m3fn_scaled.safetensors', downloadUrl: 'https://huggingface.co/comfyanonymous/cosmos_1.0_text_encoder_and_VAE_ComfyUI/resolve/main/text_encoders/oldt5_xxl_fp8_e4m3fn_scaled.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true, needsSeparateCLIP: true,
- },
- cogvideo: {
- loader: 'UNETLoader',
- vae: { patterns: ['cogvideox', 'cogvideo'], downloadName: 'cogvideox_vae_bf16.safetensors', downloadUrl: 'https://huggingface.co/Kijai/CogVideoX-comfy/resolve/main/cogvideox_vae_bf16.safetensors', subfolder: 'vae' },
- clip: { patterns: ['t5'], downloadName: 't5xxl_fp16.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/mochi_preview_repackaged/resolve/main/split_files/text_encoders/t5xxl_fp16.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true, needsSeparateCLIP: true,
- },
- svd: { loader: 'ImageOnlyCheckpointLoader', needsSeparateVAE: false, needsSeparateCLIP: false },
- framepack: {
- loader: 'UNETLoader',
- vae: { patterns: ['hunyuan_video_vae', 'hunyuan'], downloadName: 'hunyuan_video_vae_bf16.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_repackaged/resolve/main/split_files/vae/hunyuan_video_vae_bf16.safetensors', subfolder: 'vae' },
- clip: { patterns: ['llava', 'qwen'], downloadName: 'llava_llama3_fp8_scaled.safetensors', downloadUrl: 'https://huggingface.co/Comfy-Org/HunyuanVideo_repackaged/resolve/main/split_files/text_encoders/llava_llama3_fp8_scaled.safetensors', subfolder: 'text_encoders' },
- needsSeparateVAE: true, needsSeparateCLIP: true,
- },
- pyramidflow: {
- loader: 'UNETLoader',
- vae: { patterns: ['pyramid'], downloadName: 'pyramid_flow_vae_bf16.safetensors', downloadUrl: 'https://huggingface.co/Kijai/pyramid-flow-comfy/resolve/main/pyramid_flow_vae_bf16.safetensors', subfolder: 'vae' },
- needsSeparateVAE: true, needsSeparateCLIP: false,
- },
- allegro: { loader: 'UNETLoader', needsSeparateVAE: false, needsSeparateCLIP: false },
- unknown: { loader: 'CheckpointLoaderSimple', needsSeparateVAE: false, needsSeparateCLIP: false },
-}
+//
+// K9 (GH #136): this table used to be declared here a second time, with a
+// different field naming (patterns/downloadName vs comfyui.ts's
+// matchPatterns/downloadFilename) but the same per-model-type content — a
+// copy that both had to be remembered on every new architecture. Canonical
+// data now lives in component-registry.ts; re-exported here so existing
+// imports of `COMPONENT_REGISTRY` / `ComponentSpec` / `ComponentRequirements`
+// from './discover' keep working unchanged.
+export type { ComponentSpec, ComponentRequirements }
+export { COMPONENT_REGISTRY }
// ─── Text Models (HuggingFace GGUF · unified source for all providers) ───
diff --git a/src/api/dynamic-workflow.ts b/src/api/dynamic-workflow.ts
index 542f5d3d..73fb6634 100644
--- a/src/api/dynamic-workflow.ts
+++ b/src/api/dynamic-workflow.ts
@@ -58,6 +58,7 @@ import { promptFilenamePrefix, videoDecodeNode } from './comfyui-graph'
export type WorkflowStrategy =
| 'unet_flux' // FLUX 1: UNETLoader + CLIPLoader + VAELoader + EmptySD3LatentImage
| 'unet_flux2' // FLUX 2: UNETLoader + CLIPLoader + VAELoader + EmptyFlux2LatentImage
+ | 'unet_krea2' // Krea 2: UNETLoader + CLIPLoader(type="krea2") + VAELoader + EmptyLatentImage (GH #136)
| 'unet_zimage' // Z-Image: UNETLoader + CLIPLoader(qwen_image) + VAELoader + EmptySD3LatentImage
| 'unet_ernie_image' // ERNIE-Image: UNETLoader + CLIPLoader(flux2) + VAELoader + EmptyFlux2LatentImage + ConditioningZeroOut
| 'unet_video' // Wan/Hunyuan: UNETLoader + CLIPLoader + VAELoader + EmptyHunyuanLatentVideo
@@ -132,6 +133,14 @@ export function determineStrategy(
return { strategy: 'unavailable', reason: 'FLUX requires UNETLoader + CLIPLoader + VAELoader nodes' }
}
+ // Krea 2 (K9, GH #136) → UNET + CLIPLoader(type="krea2") + VAE + EmptyLatentImage
+ if (modelType === 'krea2') {
+ if (hasUNET && hasCLIPLoader && hasVAELoader) {
+ return { strategy: 'unet_krea2', reason: 'Krea 2 model → UNETLoader + CLIPLoader(krea2)' }
+ }
+ return { strategy: 'unavailable', reason: 'Krea 2 requires UNETLoader + CLIPLoader + VAELoader nodes' }
+ }
+
// LTX Video → UNET + LTXVLatentVideo (no separate VAE needed)
if (modelType === 'ltx') {
if (hasUNET && hasCLIPLoader) {
@@ -265,9 +274,21 @@ export function determineStrategy(
return { strategy: 'checkpoint', reason: 'Checkpoint-based pipeline' }
}
- // Last resort: try UNET if available
+ // K9: this used to fall back to 'unet_flux' whenever CheckpointLoaderSimple
+ // was missing (rare — it is a core node, present on virtually every real
+ // install), on the unstated assumption that any UNET-only file must be a
+ // FLUX model. For a genuinely unrecognized architecture that is a silent
+ // guess: it picks FLUX's CLIP type and VAE match patterns for a model that
+ // may not be FLUX at all, which either fails confusingly or "succeeds"
+ // with a wrong text encoder. classifyModel returning 'unknown' means LU
+ // could not name this model's architecture — say so honestly instead of
+ // routing it through a guessed pipeline. A real architecture (Krea 2,
+ // FLUX 2, Z-Image, ...) has its own branch above and never reaches here.
if (hasUNET && hasCLIPLoader && hasVAELoader) {
- return { strategy: 'unet_flux', reason: 'Fallback to UNETLoader (no checkpoint loader)' }
+ return {
+ strategy: 'unavailable',
+ reason: `LU could not determine this model's architecture, so it will not guess a ComfyUI pipeline for it. If this is a known model family, please report it so LU can recognize it.`,
+ }
}
return { strategy: 'unavailable', reason: 'No compatible loader nodes found in ComfyUI' }
@@ -473,7 +494,7 @@ export async function buildDynamicWorkflow(
vaeOutputSlot = 2
samplerModelId = modelNodeId
- } else if (strategy === 'unet_flux' || strategy === 'unet_flux2' || strategy === 'unet_zimage' || strategy === 'unet_ernie_image' || strategy === 'unet_video' || strategy === 'unet_ltx'
+ } else if (strategy === 'unet_flux' || strategy === 'unet_flux2' || strategy === 'unet_krea2' || strategy === 'unet_zimage' || strategy === 'unet_ernie_image' || strategy === 'unet_video' || strategy === 'unet_ltx'
|| strategy === 'unet_mochi' || strategy === 'unet_cosmos') {
// Separate loaders
const unetId = String(n++)
@@ -482,6 +503,7 @@ export async function buildDynamicWorkflow(
const clipType = type === 'zimage' ? 'qwen_image'
: type === 'ernie_image' ? 'flux2'
: type === 'flux2' ? 'flux2'
+ : type === 'krea2' ? 'krea2'
: type === 'flux' ? 'flux'
: type === 'ltx' ? 'ltxv'
: (type === 'wan' || type === 'hunyuan') ? 'wan'
diff --git a/src/components/create/experimental/badges.ts b/src/components/create/experimental/badges.ts
index eb54efea..4b524833 100644
--- a/src/components/create/experimental/badges.ts
+++ b/src/components/create/experimental/badges.ts
@@ -23,6 +23,11 @@ import type { ModelType } from '../../../api/comfyui'
export const TYPE_BADGE: Record<ModelType, { label: string; color: string }> = {
flux: { label: 'FLUX', color: 'bg-purple-500/15 text-purple-300' },
flux2: { label: 'FLUX 2', color: 'bg-purple-500/15 text-purple-300' },
+ // K9 (GH #136): every bright tone above is taken by a different family, and
+ // amber/yellow are the two the comment above rules out (they read as a
+ // warning, not a badge — see the cogvideo history). zinc is the one
+ // neutral family still free (slate/stone already carry ernie_image/cogvideo).
+ krea2: { label: 'Krea 2', color: 'bg-zinc-500/15 text-zinc-300' },
zimage: { label: 'Z-Image', color: 'bg-rose-500/15 text-rose-300' },
ernie_image: { label: 'Ernie', color: 'bg-slate-500/15 text-slate-300' },
sdxl: { label: 'SDXL', color: 'bg-blue-500/15 text-blue-300' },
diff --git a/src/stores/createStore.ts b/src/stores/createStore.ts
index 4e393298..a3e7f33f 100644
--- a/src/stores/createStore.ts
+++ b/src/stores/createStore.ts
@@ -116,6 +116,9 @@ export const MODEL_TYPE_DEFAULTS: Record<ModelType, {
sdxl: { steps: 25, cfgScale: 7.0, sampler: 'dpmpp_2m', scheduler: 'karras', width: 1024, height: 1024 },
flux: { steps: 20, cfgScale: 1.0, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024 },
flux2: { steps: 20, cfgScale: 1.0, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024 },
+ // K9 (GH #136): mirrors comfyui.ts's MODEL_TYPE_DEFAULTS.krea2 (author
+ // workflow: euler, CFG 1, 8 steps, 1024x1024).
+ krea2: { steps: 8, cfgScale: 1.0, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024 },
zimage: { steps: 12, cfgScale: 3.5, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024 },
ernie_image: { steps: 20, cfgScale: 4.0, sampler: 'euler', scheduler: 'simple', width: 1024, height: 1024 },
wan: { steps: 25, cfgScale: 5.0, sampler: 'euler', scheduler: 'normal', width: 848, height: 480, frames: 49, fps: 16 },