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.

feat(create): Qwen-Image 2.1 with the text encoder without refusals

purple599d80ee3674
diff --git a/e2e/qwen-text-encoder.spec.ts b/e2e/qwen-text-encoder.spec.ts
new file mode 100644
index 00000000..7611f5c3
--- /dev/null
+++ b/e2e/qwen-text-encoder.spec.ts
@@ -0,0 +1,88 @@
+import { test, expect, type Page } from '@playwright/test'
+import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
+import { seedOnboardingDone } from './support/cloud-mock'
+
+/**
+ * Qwen-Image 2.1 with both editions of its text encoder installed, the
+ * official one and the one without refusals: the Expert settings have one row
+ * to pick which one reads the prompt. A rebuilt ComfyUI answers through
+ * proxy_localhost with a local Qwen-Image 2.1 and, per test, the files in its
+ * text encoder folder. Nothing is rendered.
+ */
+
+const QWEN = 'qwen_image_2.1_int8_convrot.safetensors'
+const OFFICIAL = 'qwen3vl_8b_int8_convrot.safetensors'
+const FREE = 'qwen3vl_8b_int8_convrot_heretic.safetensors'
+
+async function bootWithFakeComfy(page: Page, textEncoders: string[]) {
+ await page.addInitScript(tauriMockInit, { assistantReply: DEFAULT_ASSISTANT_REPLY, modelName: DEFAULT_MODEL_NAME, platform: 'windows' as const })
+ await seedOnboardingDone(page)
+ await page.addInitScript(([model, encoders]) => {
+ const w = window as unknown as { __TAURI_INTERNALS__: { invoke: (c: string, a: { url?: string }) => Promise<unknown> } }
+ if (!localStorage.getItem('create-store')) {
+ localStorage.setItem('create-store', JSON.stringify({ state: { backend: 'local', imageModel: model }, version: 2 }))
+ }
+ const bridge = w.__TAURI_INTERNALS__
+ const invoke = bridge.invoke
+ const combo = (v: string[]) => [v]
+ const nodes: Record<string, unknown> = {
+ UNETLoader: { input: { required: { unet_name: combo([model as string]) } } },
+ CLIPLoader: { input: { required: { clip_name: combo(encoders as string[]) } } },
+ VAELoader: { input: { required: { vae_name: combo(['qwen_image_2.1_vae_bf16.safetensors']) } } },
+ KSampler: { input: { required: { sampler_name: combo(['euler']), scheduler: combo(['simple']) } } },
+ }
+ bridge.invoke = (command, args) => {
+ if (command === 'sniff_model_files') return Promise.resolve([])
+ if (command !== 'proxy_localhost' || !args?.url?.includes(':8188')) return invoke(command, args)
+ const url = args.url
+ if (url.includes('/system_stats')) return Promise.resolve(JSON.stringify({ devices: [{ name: 'RTX 4090', type: 'cuda', vram_total: 24 * 1024 ** 3 }] }))
+ const one = /\/object_info\/([^/?]+)/.exec(url)
+ if (one) return Promise.resolve(JSON.stringify(one[1] in nodes ? { [one[1]]: nodes[one[1]] } : {}))
+ if (url.includes('/object_info')) return Promise.resolve(JSON.stringify(nodes))
+ return Promise.resolve('{}')
+ }
+ }, [QWEN, textEncoders] as const)
+}
+
+async function openExpert(page: Page, intent: string) {
+ await page.goto('/')
+ await page.getByRole('button', { name: /^Create$/ }).click()
+ await page.getByRole('radio', { name: intent, exact: true }).click()
+ await page.getByRole('button', { name: 'Advanced settings' }).click()
+ await page.getByRole('button', { name: 'Expert', exact: true }).click()
+}
+
+const row = (page: Page) => page.getByRole('button', { name: 'Text encoder', exact: true })
+const saved = (page: Page) => page.evaluate(() => JSON.parse(localStorage.getItem('create-store') || '{}').state?.qwenTextEncoder)
+
+test('with both text encoders installed, Expert offers which one reads the prompt and remembers the pick', async ({ page }) => {
+ await bootWithFakeComfy(page, [OFFICIAL, FREE])
+ await openExpert(page, 'Image')
+ await expect(row(page)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page)).toHaveCount(1)
+ await expect(row(page)).toHaveText('Qwen3-VL 8B')
+
+ await row(page).click()
+ await expect(page.getByRole('option')).toHaveText(['Qwen3-VL 8B', 'Qwen3-VL 8B, no refusals'])
+ await page.getByRole('option', { name: 'Qwen3-VL 8B, no refusals' }).click()
+ await expect(row(page)).toHaveText('Qwen3-VL 8B, no refusals')
+ await expect.poll(() => saved(page)).toBe('unfiltered')
+
+ // Nothing of it sits in or above the prompt field: with the drawer closed
+ // the page shows no such row.
+ await page.keyboard.press('Escape')
+ await expect(row(page)).toHaveCount(0)
+ await expect(page.getByText('Text encoder', { exact: true })).toHaveCount(0)
+
+ // The pick is still there after a restart, and Edit shows the same row.
+ await page.reload()
+ await openExpert(page, 'Edit / Image to Image')
+ await expect(row(page)).toHaveText('Qwen3-VL 8B, no refusals', { timeout: 15_000 })
+})
+
+test('with one text encoder installed there is nothing to choose and no row', async ({ page }) => {
+ await bootWithFakeComfy(page, [FREE])
+ await openExpert(page, 'Image')
+ await expect(page.getByText('Sampler', { exact: true })).toBeVisible({ timeout: 15_000 })
+ await expect(row(page)).toHaveCount(0)
+})
diff --git a/src/api/__tests__/qwen-image-21-no-refusals-installed.test.ts b/src/api/__tests__/qwen-image-21-no-refusals-installed.test.ts
new file mode 100644
index 00000000..4ef3445c
--- /dev/null
+++ b/src/api/__tests__/qwen-image-21-no-refusals-installed.test.ts
@@ -0,0 +1,66 @@
+/**
+ * The two Qwen-Image 2.1 bundles share the image model and the VAE and differ
+ * in the text encoder. So the card of one must not read Installed on the
+ * files of the other: the encoder is what makes each bundle what it is.
+ *
+ * Run: npx vitest run src/api/__tests__/qwen-image-21-no-refusals-installed.test.ts
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+
+const onDisk = vi.hoisted(() => ({ files: new Map<string, number>() }))
+
+vi.mock('../backend', () => ({
+ backendCall: async (cmd: string, args: { files: { filename: string }[] }) => {
+ if (cmd !== 'check_model_sizes') return {}
+ return args.files.map((f) => {
+ const bytes = onDisk.files.get(f.filename)
+ return { filename: f.filename, exists: bytes != null, actualBytes: bytes ?? 0, complete: bytes != null }
+ })
+ },
+ fetchExternal: vi.fn(),
+}))
+vi.mock('../comfyui', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('../comfyui')>()),
+ readComfyFolderLists: async () => {
+ const names = [...onDisk.files.keys()]
+ return {
+ diffusion_models: names.filter((n) => n.startsWith('qwen_image_2.1_int8')),
+ vae: names.filter((n) => n.includes('vae')),
+ text_encoders: names.filter((n) => n.startsWith('qwen3vl')),
+ }
+ },
+ filterPartialFiles: async (names: string[]) => new Set(names),
+ refreshComfyModels: vi.fn(async () => true),
+}))
+
+const { checkBundlesInstalled, getImageBundles } = await import('../discover')
+
+const MODEL = ['qwen_image_2.1_int8_convrot.safetensors', 7_256_783_064] as const
+const VAE = ['qwen_image_2.1_vae_bf16.safetensors', 675_509_688] as const
+const OFFICIAL = ['qwen3vl_8b_int8_convrot.safetensors', 9_350_798_360] as const
+const FREE = ['qwen3vl_8b_int8_convrot_heretic.safetensors', 9_350_828_392] as const
+
+const OFFICIAL_BUNDLE = 'Qwen-Image 2.1 (Generate and Edit)'
+const FREE_BUNDLE = 'Qwen-Image 2.1 (No Refusals)'
+const bundles = getImageBundles().filter((b) => b.name === OFFICIAL_BUNDLE || b.name === FREE_BUNDLE)
+
+const have = (...files: (readonly [string, number])[]) => { onDisk.files = new Map(files) }
+
+beforeEach(() => { onDisk.files = new Map() })
+
+describe('Installed, for the two Qwen-Image 2.1 bundles', () => {
+ it('only the official files: the official card reads Installed, the other one does not', async () => {
+ have(MODEL, VAE, OFFICIAL)
+ expect(await checkBundlesInstalled(bundles)).toEqual({ [OFFICIAL_BUNDLE]: true, [FREE_BUNDLE]: false })
+ })
+
+ it('the edition without refusals alone: its card reads Installed, the official one does not', async () => {
+ have(MODEL, VAE, FREE)
+ expect(await checkBundlesInstalled(bundles)).toEqual({ [OFFICIAL_BUNDLE]: false, [FREE_BUNDLE]: true })
+ })
+
+ it('both encoders next to the shared files: both read Installed', async () => {
+ have(MODEL, VAE, OFFICIAL, FREE)
+ expect(await checkBundlesInstalled(bundles)).toEqual({ [OFFICIAL_BUNDLE]: true, [FREE_BUNDLE]: true })
+ })
+})
diff --git a/src/api/__tests__/qwen-image-21-no-refusals.test.ts b/src/api/__tests__/qwen-image-21-no-refusals.test.ts
new file mode 100644
index 00000000..b8a67c0f
--- /dev/null
+++ b/src/api/__tests__/qwen-image-21-no-refusals.test.ts
@@ -0,0 +1,371 @@
+/**
+ * Qwen-Image 2.1 with the text encoder without refusals.
+ *
+ * The edition is one file: pottokao's Heretic build of the Qwen3-VL 8B text
+ * encoder, in the INT8 ConvRot layout of the official one. The image model and
+ * the VAE stay the official files. So everything Qwen-Image 2.1 does has to
+ * come out the same with this encoder in the loader, and the user says which
+ * of two installed encoders reads the prompt.
+ *
+ * Read off Hugging Face on 2026-10-03 (tree API, lfs.oid, model card):
+ * - pottokao/Qwen-Image-2.1-Text-Encoder-Heretic-int8-convrot, Apache 2.0,
+ * qwen3vl_8b_int8_convrot_heretic.safetensors, 9350828392 bytes
+ * - Comfy-Org/Qwen-Image-2.1 for the three official files
+ *
+ * The graphs are built for real against a mocked /object_info, as in
+ * qwen-image-21-workflow.test.ts.
+ *
+ * Run: npx vitest run src/api/__tests__/qwen-image-21-no-refusals.test.ts
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+
+vi.mock('../comfyui-nodes', async (importOriginal) => {
+ const actual = await importOriginal<typeof import('../comfyui-nodes')>()
+ return { ...actual, getAllNodeInfo: vi.fn() }
+})
+vi.mock('../backend', async (importOriginal) => {
+ const actual = await importOriginal<typeof import('../backend')>()
+ return { ...actual, localFetch: vi.fn(), comfyuiUrl: (p: string) => `http://test${p}` }
+})
+
+import { buildDynamicWorkflow, WorkflowUnavailableError } from '../dynamic-workflow'
+import { getAllNodeInfo } from '../comfyui-nodes'
+import { classifyModel, findMatchingCLIP, findMatchingVAE, COMPONENT_REGISTRY } from '../comfyui'
+import { getImageBundles } from '../discover'
+import { localFetch } from '../backend'
+import { nodeOf } from './graph-test-support'
+import {
+ pickQwenEncoder, qwenEncoderFile, qwenEncoderOptions, QWEN_ENCODER_CHOICES, QWEN_ENCODER_HELP,
+} from '../../lib/render/qwen-text-encoder'
+import { isQwenEnhancerFile, improveWriters, pickQwenEnhancer } from '../../lib/render/qwen-enhancer'
+import { extraReferenceSlots } from '../../lib/edit-references'
+import { supportsTransparent } from '../../lib/transparent-image'
+import { localTier } from '../../lib/render/local-model-tier'
+
+const MODEL = 'qwen_image_2.1_int8_convrot.safetensors'
+const OFFICIAL = 'qwen3vl_8b_int8_convrot.safetensors'
+const FREE = 'qwen3vl_8b_int8_convrot_heretic.safetensors'
+const VAE_FILE = 'qwen_image_2.1_vae_bf16.safetensors'
+const KREA_ENCODER = 'qwen3vl_4b_fp8_scaled.safetensors'
+const T2I = 'qwen3.5_9b_qwen_image_2.1_pe_t2i.int8_convrot.safetensors'
+const T2I_FREE = 'qwen3.5_9b_qwen_image_2.1_pe_t2i_heretic.int8_convrot.safetensors'
+const I2I_FREE = 'qwen3.5_9b_qwen_image_2.1_pe_i2i_heretic.int8_convrot.safetensors'
+
+const nodes = (withEncodeNode = true) => ({
+ UNETLoader: { input: { required: { unet_name: [[MODEL]] } } },
+ CLIPLoader: { input: { required: { clip_name: [[OFFICIAL, FREE]] } } },
+ VAELoader: { input: { required: { vae_name: [[VAE_FILE]] } } },
+ ...(withEncodeNode
+ ? { TextEncodeQwenImage21: { input: { required: { clip: ['CLIP'], prompt: ['STRING'], negative_prompt: ['STRING'], resolution: ['INT'] }, optional: { vae: ['VAE'], 'images.image_1': ['IMAGE'] } } } }
+ : {}),
+ EmptyLatentImage: { input: { required: {} } },
+ KSampler: { input: { required: {} } },
+ CLIPTextEncode: { input: { required: {} } },
+ VAEDecode: { input: { required: {} } },
+ LoadImage: { input: { required: {} } },
+ SaveImage: { input: { required: {} } },
+})
+
+const baseParams = {
+ model: MODEL,
+ prompt: 'a red apple on a white plate', negativePrompt: '',
+ sampler: 'euler', scheduler: 'simple',
+ steps: 25, cfgScale: 1, width: 1024, height: 1024, seed: 42, batchSize: 1,
+}
+
+/** What ComfyUI lists in models/text_encoders and models/vae. */
+function serve(clips: string[], vaes: string[] = [VAE_FILE]) {
+ vi.mocked(localFetch).mockResolvedValue({
+ ok: true,
+ json: async () => ({
+ CLIPLoader: { input: { required: { clip_name: [clips] } } },
+ VAELoader: { input: { required: { vae_name: [vaes] } } },
+ }),
+ } as never)
+}
+
+beforeEach(() => { vi.mocked(getAllNodeInfo).mockResolvedValue(nodes() as never) })
+
+// ── Which file is which ─────────────────────────────────────────────────
+
+describe('the two editions of the Qwen-Image 2.1 text encoder', () => {
+ it('the official file and the Heretic file are told apart by name', () => {
+ expect(qwenEncoderFile(OFFICIAL)).toEqual({ file: OFFICIAL, variant: 'official' })
+ expect(qwenEncoderFile(FREE)).toEqual({ file: FREE, variant: 'unfiltered' })
+ // Other published spellings of the same edition.
+ expect(qwenEncoderFile('qwen3vl_8b_heretic_int8_convrot.safetensors')?.variant).toBe('unfiltered')
+ expect(qwenEncoderFile('qwen3vl_8b_nvfp4_heretic.safetensors')?.variant).toBe('unfiltered')
+ expect(qwenEncoderFile('Qwen3-VL-8B-Instruct-abliterated.safetensors')?.variant).toBe('unfiltered')
+ expect(qwenEncoderFile('qwen3vl_8b_bf16.safetensors')?.variant).toBe('official')
+ })
+
+ it('a subfolder is kept in the name the loader gets', () => {
+ expect(qwenEncoderFile(`qwen\\${FREE}`)).toEqual({ file: `qwen\\${FREE}`, variant: 'unfiltered' })
+ })
+
+ it('the 4B and 32B siblings, the VAE and the prompt enhancers are not this encoder', () => {
+ for (const name of [KREA_ENCODER, 'qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors', VAE_FILE, MODEL, T2I, T2I_FREE, 'qwen_3_4b.safetensors']) {
+ expect(qwenEncoderFile(name), name).toBeNull()
+ }
+ })
+
+ it('the encoder is no prompt enhancer and no image model', () => {
+ expect(isQwenEnhancerFile(FREE)).toBe(false)
+ expect(classifyModel(FREE)).not.toBe('qwenimage')
+ expect(classifyModel(FREE)).not.toBe('qwenimage1')
+ // The image model of the edition is the official file, so it is Qwen-Image 2.1.
+ expect(classifyModel(MODEL)).toBe('qwenimage')
+ })
+})
+
+describe('which encoder a run takes', () => {
+ it('one installed: that one, whatever the setting says', () => {
+ for (const choice of QWEN_ENCODER_CHOICES) {
+ expect(pickQwenEncoder([FREE], choice)?.file).toBe(FREE)
+ expect(pickQwenEncoder([OFFICIAL], choice)?.file).toBe(OFFICIAL)
+ }
+ })
+
+ it('both installed: the official one by default, the picked one when picked', () => {
+ expect(pickQwenEncoder([FREE, OFFICIAL])?.file).toBe(OFFICIAL)
+ expect(pickQwenEncoder([FREE, OFFICIAL], 'auto')?.file).toBe(OFFICIAL)
+ expect(pickQwenEncoder([FREE, OFFICIAL], 'unfiltered')?.file).toBe(FREE)
+ expect(pickQwenEncoder([FREE, OFFICIAL], 'official')?.file).toBe(OFFICIAL)
+ })
+
+ it('none installed: nothing', () => {
+ expect(pickQwenEncoder([KREA_ENCODER, T2I])).toBeNull()
+ })
+
+ it('the setting offers a choice only when both are installed', () => {
+ expect(qwenEncoderOptions([OFFICIAL])).toEqual([])
+ expect(qwenEncoderOptions([FREE])).toEqual([])
+ expect(qwenEncoderOptions([FREE, OFFICIAL, KREA_ENCODER, T2I])).toEqual([
+ { id: 'official', label: 'Qwen3-VL 8B' },
+ { id: 'unfiltered', label: 'Qwen3-VL 8B, no refusals' },
+ ])
+ })
+
+ it('the help says what the edition is and what it is not, without a dash', () => {
+ expect(QWEN_ENCODER_HELP).toContain('refusal direction removed')
+ expect(QWEN_ENCODER_HELP).toContain('The image model is the same.')
+ expect(QWEN_ENCODER_HELP).not.toMatch(/[\u2013\u2014]/)
+ })
+})
+
+// ── The resolver ComfyUI graphs are built from ──────────────────────────
+
+describe('findMatchingCLIP for Qwen-Image 2.1', () => {
+ it('only the edition without refusals installed: it is the encoder', async () => {
+ serve([FREE])
+ expect(await findMatchingCLIP('qwenimage', MODEL)).toBe(FREE)
+ })
+
+ it('both installed: official by default, the picked edition when picked', async () => {
+ serve([FREE, OFFICIAL])
+ expect(await findMatchingCLIP('qwenimage', MODEL)).toBe(OFFICIAL)
+ expect(await findMatchingCLIP('qwenimage', MODEL, 'unfiltered')).toBe(FREE)
+ expect(await findMatchingCLIP('qwenimage', MODEL, 'official')).toBe(OFFICIAL)
+ })
+
+ it('a pick whose file is gone falls back to the one that is there', async () => {
+ serve([OFFICIAL])
+ expect(await findMatchingCLIP('qwenimage', MODEL, 'unfiltered')).toBe(OFFICIAL)
+ })
+
+ it('a prompt enhancer without refusals is never taken for the encoder', async () => {
+ serve([T2I_FREE, I2I_FREE, FREE])
+ expect(await findMatchingCLIP('qwenimage', MODEL, 'unfiltered')).toBe(FREE)
+ })
+
+ it('Krea 2 does not load the 8B edition into its 4B slot', async () => {
+ serve([FREE, KREA_ENCODER])
+ expect(await findMatchingCLIP('krea2', 'krea-2-dev-fp8.safetensors')).toBe(KREA_ENCODER)
+ serve([FREE])
+ await expect(findMatchingCLIP('krea2', 'krea-2-dev-fp8.safetensors')).rejects.toThrow(/Krea 2 text encoder/)
+ })
+
+ it('the VAE is the official one either way', async () => {
+ serve([FREE])
+ expect(await findMatchingVAE('qwenimage')).toBe(VAE_FILE)
+ })
+})
+
+// ── Every graph of the family, with the other encoder in the loader ─────
+
+/** The same run built twice: with the official encoder, and with the edition
+ * without refusals. Nothing but the loader's file name may differ. */
+async function bothGraphs(params: Record<string, unknown>) {
+ serve([OFFICIAL])
+ const official = await buildDynamicWorkflow({ ...baseParams, ...params } as never)
+ serve([FREE])
+ const free = await buildDynamicWorkflow({ ...baseParams, ...params } as never)
+ return { official, free }
+}
+
+function withEncoder(graph: Awaited<ReturnType<typeof buildDynamicWorkflow>>, file: string) {
+ const copy = JSON.parse(JSON.stringify(graph)) as typeof graph
+ nodeOf(copy, 'CLIPLoader')![1].inputs.clip_name = file
+ return copy
+}
+
+describe('buildDynamicWorkflow with the encoder without refusals', () => {
+ const cases: [string, Record<string, unknown>][] = [
+ ['Image: generate from a prompt', {}],
+ ['Edit without a mask: one source image', { prompt: 'put a blue hat on the person', inputImage: 'source.png', denoise: 0.7 }],
+ ['Edit with three more reference images', { inputImage: 'scene.png', denoise: 0.7, referenceImages: ['a.png', 'b.png', 'c.png'] }],
+ ['Transparent background', { transparent: true }],
+ ['Batch size 4', { batchSize: 4 }],
+ ]
+
+ it.each(cases)('%s: the same graph, only the encoder file differs', async (_name, params) => {
+ const { official, free } = await bothGraphs(params)
+ const clip = nodeOf(free, 'CLIPLoader')![1]
+ expect(clip.inputs.clip_name).toBe(FREE)
+ expect(clip.inputs.type).toBe('qwen_image')
+ expect(nodeOf(free, 'UNETLoader')![1].inputs.unet_name).toBe(MODEL)
+ expect(nodeOf(free, 'VAELoader')![1].inputs.vae_name).toBe(VAE_FILE)
+ expect(nodeOf(free, 'TextEncodeQwenImage21')).toBeDefined()
+ expect(withEncoder(free, OFFICIAL)).toEqual(official)
+ })
+
+ it('the edit graph carries the source and all three references', async () => {
+ const { free } = await bothGraphs({ inputImage: 'scene.png', denoise: 0.7, referenceImages: ['a.png', 'b.png', 'c.png', 'd.png'] })
+ const enc = nodeOf(free, 'TextEncodeQwenImage21')![1]
+ expect(enc.inputs['images.image_1']).toBeDefined()
+ expect(enc.inputs['images.image_4']).toBeDefined()
+ expect(enc.inputs['images.image_5']).toBeUndefined()
+ })
+
+ it('both installed: the run loads the edition the user picked', async () => {
+ serve([OFFICIAL, FREE])
+ const picked = await buildDynamicWorkflow({ ...baseParams, qwenTextEncoder: 'unfiltered' } as never)
+ expect(nodeOf(picked, 'CLIPLoader')![1].inputs.clip_name).toBe(FREE)
+ const standard = await buildDynamicWorkflow({ ...baseParams } as never)
+ expect(nodeOf(standard, 'CLIPLoader')![1].inputs.clip_name).toBe(OFFICIAL)
+ // An edit takes the same pick.
+ const edit = await buildDynamicWorkflow({ ...baseParams, inputImage: 'source.png', denoise: 0.7, qwenTextEncoder: 'unfiltered' } as never)
+ expect(nodeOf(edit, 'CLIPLoader')![1].inputs.clip_name).toBe(FREE)
+ })
+
+ it('a painted mask is refused with this encoder too', async () => {
+ serve([FREE])
+ await expect(buildDynamicWorkflow({ ...baseParams, inputImage: 'source.png', maskImage: 'mask.png', denoise: 0.7 } as never))
+ .rejects.toBeInstanceOf(WorkflowUnavailableError)
+ })
+
+ it('a ComfyUI older than 0.37.0 gets the update sentence, not a graph', async () => {
+ vi.mocked(getAllNodeInfo).mockResolvedValue(nodes(false) as never)
+ serve([FREE])
+ await expect(buildDynamicWorkflow({ ...baseParams } as never))
+ .rejects.toThrow('Qwen-Image 2.1 needs ComfyUI 0.37.0 or newer. Update ComfyUI in Settings.')
+ })
+
+ it('no encoder at all: the message names a file and carries its download', async () => {
+ serve([KREA_ENCODER])
+ const err = await buildDynamicWorkflow({ ...baseParams, qwenTextEncoder: 'unfiltered' } as never).catch((e: unknown) => e)
+ expect(err).toBeInstanceOf(WorkflowUnavailableError)
+ const missing = (err as WorkflowUnavailableError).missing ?? []
+ expect(missing.map((m) => m.downloadFilename)).toEqual([OFFICIAL])
+ expect(missing[0].downloadUrl).toBe(COMPONENT_REGISTRY.qwenimage!.clip!.downloadUrl)
+ })
+
+ it('the registry counts the edition without refusals as the family encoder', () => {
+ const patterns = COMPONENT_REGISTRY.qwenimage!.clip!.matchPatterns
+ expect(patterns.some((p) => FREE.toLowerCase().includes(p))).toBe(true)
+ })
+})
+
+// ── What hangs on the family, not on the encoder ────────────────────────
+
+describe('what the family can do does not depend on the encoder', () => {
+ it('reference slots, transparent background and the tier come from the image model', () => {
+ const type = classifyModel(MODEL)
+ expect(extraReferenceSlots(type, MODEL)).toBe(3)
+ expect(supportsTransparent(type)).toBe(true)
+ expect(localTier({ name: MODEL, type })).toBe('best')
+ })
+
+ it('the prompt enhancers are found and picked the same with this encoder installed', () => {
+ const situation = { local: true, modelType: 'qwenimage', textEncoders: [FREE, T2I, T2I_FREE, I2I_FREE] }
+ expect(improveWriters({ ...situation, intent: 'image' }).map((w) => w.id)).toEqual(['official', 'unfiltered', 'chat'])
+ expect(pickQwenEnhancer({ ...situation, intent: 'image' }, 'unfiltered')?.file).toBe(T2I_FREE)
+ expect(pickQwenEnhancer({ ...situation, intent: 'edit' }, 'auto')?.file).toBe(I2I_FREE)
+ })
+})
+
+// ── The Model Manager bundle ────────────────────────────────────────────
+
+describe('bundle Qwen-Image 2.1 (No Refusals)', () => {
+ const all = getImageBundles()
+ const official = all.find((b) => b.name === 'Qwen-Image 2.1 (Generate and Edit)')!
+ const bundle = all.find((b) => b.name === 'Qwen-Image 2.1 (No Refusals)')!
+ const file = (b: typeof bundle, folder: string) => b.files.find((f) => f.subfolder === folder)!
+
+ it('exists once, under Image, in the list without refusals, right after the official one', () => {
+ expect(all.filter((b) => b.name === bundle.name)).toHaveLength(1)
+ expect(all.indexOf(bundle)).toBe(all.indexOf(official) + 1)
+ expect(bundle.workflow).toBe('qwenimage')
+ expect(bundle.uncensored).toBe(true)
+ })
+
+ it('is not marked verified: no run on real hardware yet', () => {
+ expect(bundle.verified).toBeUndefined()
+ })
+
+ it('the image model and the VAE are the very entries of the official bundle', () => {
+ expect(file(bundle, 'diffusion_models')).toEqual(file(official, 'diffusion_models'))
+ expect(file(bundle, 'vae')).toEqual(file(official, 'vae'))
+ expect(file(bundle, 'diffusion_models').filename).toBe(MODEL)
+ expect(file(bundle, 'vae').filename).toBe(VAE_FILE)
+ })
+
+ it('the text encoder is the Heretic file from pottokao, with byte count and SHA-256', () => {
+ const enc = file(bundle, 'text_encoders')
+ expect(bundle.files).toHaveLength(3)
+ expect(enc.filename).toBe(FREE)
+ expect(enc.downloadUrl).toBe(`https://huggingface.co/pottokao/Qwen-Image-2.1-Text-Encoder-Heretic-int8-convrot/resolve/main/${FREE}`)
+ expect(enc.sizeBytes).toBe(9_350_828_392)
+ expect(enc.sha256).toBe('f15ce4275428e04f42cdb59e3a253cb290cae5de99259527f01d3d2e51153653')
+ expect(qwenEncoderFile(enc.filename!)?.variant).toBe('unfiltered')
+ })
+
+ it('every file of both bundles states its exact size and digest', () => {
+ const expected: Record<string, [number, string]> = {
+ [MODEL]: [7_256_783_064, 'cb74113cb03faecd79611b01fd7fd642f0aa60d6f0b95086abee214d75eaa57d'],
+ [OFFICIAL]: [9_350_798_360, '8bfd0f6e12abf2d2d697ecc888e5e90b0d6741d6708f05799f53afa560452e8f'],
+ [FREE]: [9_350_828_392, 'f15ce4275428e04f42cdb59e3a253cb290cae5de99259527f01d3d2e51153653'],
+ [VAE_FILE]: [675_509_688, 'bb21f7473051e1ac368515dd3f2e15cd44d7a11748ee8823e1ddca3e4876b7c9'],
+ }
+ for (const b of [official, bundle]) {
+ let sum = 0
+ for (const f of b.files) {
+ const [bytes, sha] = expected[f.filename!]
+ expect(f.sizeBytes, f.filename).toBe(bytes)
+ expect(f.sha256, f.filename).toBe(sha)
+ expect(Math.abs(f.sizeGB! - bytes / 1_073_741_824), f.filename).toBeLessThan(0.01)
+ sum += f.sizeGB!
+ }
+ expect(Math.abs(b.totalSizeGB - sum), b.name).toBeLessThan(0.05)
+ }
+ })
+
+ it('tier, VRAM figure and numbers are those of the official bundle', () => {
+ expect(bundle.tier).toBe(official.tier)
+ expect(bundle.vramRequired).toBe(official.vramRequired)
+ expect(bundle.vramMinGB).toBe(official.vramMinGB)
+ expect(bundle.vramComfortGB).toBe(official.vramComfortGB)
+ expect(bundle.customNodes).toBeUndefined()
+ })
+
+ it('says what the edition is, what it is not, where to pick it, and both licences', () => {
+ const d = bundle.description
+ expect(d).toContain('text encoder that has its refusal direction removed by the community (Heretic)')
+ expect(d).toContain('Only the text encoder differs')
+ expect(d).toContain('Text encoder in the Expert settings')
+ expect(d).toContain('Qwen Research License, non-commercial use: https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE')
+ expect(d).toContain('Apache 2.0')
+ expect(d).not.toMatch(/[\u2013\u2014]/)
+ expect(d).not.toMatch(/faster|better|sharper|quality/i)
+ })
+})
diff --git a/src/api/__tests__/qwen-image-21-workflow.test.ts b/src/api/__tests__/qwen-image-21-workflow.test.ts
index 51aa4693..8cbe7ba5 100644
--- a/src/api/__tests__/qwen-image-21-workflow.test.ts
+++ b/src/api/__tests__/qwen-image-21-workflow.test.ts
@@ -373,10 +373,10 @@ describe('the resolvers pick the 2.1 files, and leave Krea 2 its own', () => {
describe('Qwen-Image 2.1 bundle', () => {
const bundle = getImageBundles().find(b => b.workflow === 'qwenimage')
- it('exists exactly once', () => {
+ it('exists exactly once, next to the one edition with the other text encoder', () => {
// The two prompt enhancer add-ons share the family and carry no model file.
const withModel = getImageBundles().filter(b => b.workflow === 'qwenimage' && b.files.some(f => f.subfolder === 'diffusion_models'))
- expect(withModel).toHaveLength(1)
+ expect(withModel.map(b => b.name)).toEqual(['Qwen-Image 2.1 (Generate and Edit)', 'Qwen-Image 2.1 (No Refusals)'])
expect(withModel[0].name).toBe(bundle!.name)
expect(bundle).toBeDefined()
})
diff --git a/src/api/__tests__/vram-handoff.test.ts b/src/api/__tests__/vram-handoff.test.ts
index feb3a7f7..0696bbe8 100644
--- a/src/api/__tests__/vram-handoff.test.ts
+++ b/src/api/__tests__/vram-handoff.test.ts
@@ -16,7 +16,7 @@
*
* Run: npx vitest run src/api/__tests__/vram-handoff.test.ts
*/
-import { describe, it, expect, vi, beforeEach } from 'vitest'
+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
import { readFileSync } from 'node:fs'
import { resolve, dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
@@ -102,6 +102,7 @@ vi.mock('../comfyui-ws', () => ({
import { decideUnload, vramHandoffGenerate, pollGone, resolveClip, resolveModelName, resolveI2VResolution, comfyErrorHint, requestGenerationCancel, resolveTunables, __resetGenerationStateForTests } from '../vram-handoff'
import { useSettingsStore } from '../../stores/settingsStore'
+import { useCreateStore } from '../../stores/createStore'
import type { ModelCapabilities } from '../comfyui-nodes'
const GB = 1024 * 1024 * 1024
@@ -1040,4 +1041,27 @@ describe('vramHandoffGenerate — what the image tool builds', () => {
expect(type).toBe('zimage')
expect(params.modelParts).toEqual({ textEncoder: false, vae: false })
})
+
+ // Qwen-Image 2.1 with both editions of its text encoder installed: the
+ // picture made in chat reads the prompt with the one picked in Create.
+ describe('the Qwen-Image 2.1 text encoder picked in Create', () => {
+ const QWEN = { name: 'qwen_image_2.1_int8_convrot.safetensors', type: 'qwenimage', source: 'diffusion_model' }
+ afterEach(() => { useCreateStore.setState({ qwenTextEncoder: 'auto' }) })
+
+ it('the edition without refusals is handed to the builder', async () => {
+ useCreateStore.setState({ qwenTextEncoder: 'unfiltered' })
+ getImageModels.mockResolvedValue([QWEN])
+ await vramHandoffGenerate('image', { prompt: 'a lighthouse at dusk' })
+ const [params, type] = built()
+ expect(type).toBe('qwenimage')
+ expect(params.model).toBe(QWEN.name)
+ expect(params.qwenTextEncoder).toBe('unfiltered')
+ })
+
+ it('COUNTER-CHECK: with nothing picked no pick is sent, the builder takes the official one first', async () => {
+ getImageModels.mockResolvedValue([QWEN])
+ await vramHandoffGenerate('image', { prompt: 'a lighthouse at dusk' })
+ expect('qwenTextEncoder' in built()[0]).toBe(false)
+ })
+ })
})
diff --git a/src/api/comfyui.ts b/src/api/comfyui.ts
index 932d2fd2..50714594 100644
--- a/src/api/comfyui.ts
+++ b/src/api/comfyui.ts
@@ -18,6 +18,7 @@ import { isRecord, asString, asRecordArray } from '../types/json-guards'
// jetzt in model-bundles.ts, das beide Seiten statisch lesen.
import { getImageBundles, getVideoBundles } from './model-bundles'
import { isQwenEnhancerFile } from '../lib/render/qwen-enhancer'
+import { pickQwenEncoder, qwenEncoderFile, type QwenEncoderChoice } from '../lib/render/qwen-text-encoder'
import { COMPONENT_REGISTRY, type ComponentSpec } from './component-registry'
// ─── Control-plane fetch timeouts ───
@@ -65,6 +66,10 @@ export interface GenerateParams {
/** Qwen-Image 2.1 text-to-image only: ask for an RGBA picture with a
* transparent background (lib/transparent-image.ts). Ignored elsewhere. */
transparent?: boolean
+ /** Qwen-Image 2.1 only: which installed text encoder reads the prompt, the
+ * official one or the edition without refusals
+ * (lib/render/qwen-text-encoder.ts). Ignored elsewhere. */
+ qwenTextEncoder?: QwenEncoderChoice
// Local Edit (mask inpaint): ComfyUI /upload/image filename of the painted
// mask (white = repaint). With inputImage set this selects the inpaint
// pipeline (VAEEncodeForInpaint / InpaintModelConditioning) on the
@@ -1584,11 +1589,11 @@ function isQwenImage21Vae(name: string): boolean {
return /qwen[._-]?image[._-]?2[._-]?1/.test(name.toLowerCase())
}
-/** Qwen-Image 2.1's text encoder tier (Qwen3-VL 8B). Krea 2 uses the 4B
- * sibling under a near-identical name, and the two have different embedding
- * dimensions. */
+/** Qwen-Image 2.1's text encoder tier (Qwen3-VL 8B), official or with the
+ * refusals removed. Krea 2 uses the 4B sibling under a near-identical name,
+ * and the two have different embedding dimensions. */
function isQwen3vl8b(name: string): boolean {
- return /qwen3[._-]?vl[._-]?8b/.test(name.toLowerCase())
+ return qwenEncoderFile(name) !== null
}
/** MiniMax H3's own encoder (qwen3vl_32b_minimax_h3_*). It is a Qwen3-VL file
@@ -1817,8 +1822,10 @@ export async function findMiniMaxAudioVAE(): Promise<string> {
* the full-precision Qwen encoder. When omitted (legacy callers), we
* fall back to the full-precision variant, which is what most users
* want.
+ * @param qwenTextEncoder Qwen-Image 2.1 only: the edition the user picked in
+ * the advanced settings. Omitted, the official one goes first.
*/
-export async function findMatchingCLIP(modelType: ModelType, activeModelName?: string): Promise<string> {
+export async function findMatchingCLIP(modelType: ModelType, activeModelName?: string, qwenTextEncoder?: QwenEncoderChoice): Promise<string> {
// The Qwen-Image 2.1 prompt enhancers sit in the same folder and carry
// "qwen" in their names, but they are text models, not encoders. Without
// this they answer the loose "qwen" searches below (HunyuanVideo, FramePack,
@@ -1869,8 +1876,10 @@ export async function findMatchingCLIP(modelType: ModelType, activeModelName?: s
// to the 8B tier with no fallback: Krea 2's 4B sibling sits in the same
// folder under a near-identical name and has different embedding
// dimensions, so a fallback would load silently and encode nonsense.
- const match = clips.find(c => isQwen3vl8b(c))
- if (match) return match
+ // Two editions can sit side by side, the official one and the one
+ // without refusals; the advanced settings say which one reads the prompt.
+ const match = pickQwenEncoder(clips, qwenTextEncoder)
+ if (match) return match.file
throw new Error(`No Qwen-Image 2.1 text encoder found. Download "qwen3vl_8b_int8_convrot.safetensors" from the Model Manager.`)
}
if (modelType === 'krea2') {
diff --git a/src/api/dynamic-workflow.ts b/src/api/dynamic-workflow.ts
index f1d56d44..f2f7017e 100644
--- a/src/api/dynamic-workflow.ts
+++ b/src/api/dynamic-workflow.ts
@@ -853,7 +853,7 @@ export async function buildDynamicWorkflow(
}
} else {
try {
- clip = await findMatchingCLIP(type, params.model)
+ clip = await findMatchingCLIP(type, params.model, params.qwenTextEncoder)
} catch (clipErr) {
if (!carriesClip) {
const message = clipErr instanceof Error ? clipErr.message : 'Required text encoder not found in ComfyUI.'
diff --git a/src/api/model-bundles.ts b/src/api/model-bundles.ts
index 298fd538..0368940c 100644
--- a/src/api/model-bundles.ts
+++ b/src/api/model-bundles.ts
@@ -86,6 +86,31 @@ export interface DiscoverModel {
sha256?: string
}
+// The two Qwen-Image 2.1 files that both of its bundles load, the official one
+// and the one with the text encoder without refusals: the image model and the
+// VAE. One entry each, so the two bundles can never drift apart and a machine
+// that has one bundle does not fetch these again for the other. Byte counts
+// and SHA-256 are the Hugging Face LFS values of Comfy-Org/Qwen-Image-2.1,
+// read on 2026-10-03.
+const QWEN21_DIFFUSION_MODEL: DiscoverModel = {
+ name: 'Qwen-Image 2.1 (INT8)',
+ description: 'Diffusion model · generates and edits, native 2K, transparent backgrounds.',
+ pulls: '', tags: ['Diffusion Model', '7.26 GB'], updated: 'New',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/diffusion_models/qwen_image_2.1_int8_convrot.safetensors',
+ filename: 'qwen_image_2.1_int8_convrot.safetensors', subfolder: 'diffusion_models', sizeGB: 6.76,
+ sizeBytes: 7256783064,
+ sha256: 'cb74113cb03faecd79611b01fd7fd642f0aa60d6f0b95086abee214d75eaa57d',
+}
+const QWEN21_VAE: DiscoverModel = {
+ name: 'Qwen-Image 2.1 VAE',
+ description: 'Required autoencoder for Qwen-Image 2.1.',
+ pulls: '', tags: ['VAE', '676 MB'], updated: '',
+ downloadUrl: 'https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/vae/qwen_image_2.1_vae_bf16.safetensors',
+ filename: 'qwen_image_2.1_vae_bf16.safetensors', subfolder: 'vae', sizeGB: 0.63,
+ sizeBytes: 675509688,
+ sha256: 'bb21f7473051e1ac368515dd3f2e15cd44d7a11748ee8823e1ddca3e4876b7c9',
+}
+
// ─── Image Model Bundles ───
export function getImageBundles(): ModelBundle[] {
@@ -372,27 +397,54 @@ export function getImageBundles(): ModelBundle[] {
tier: 'best',
url: 'https://huggingface.co/Comfy-Org/Qwen-Image-2.1',
files: [
- {
- name: 'Qwen-Image 2.1 (INT8)',
- description: 'Diffusion model · generates and edits, native 2K, transparent backgrounds.',
- pulls: '', tags: ['Diffusion Model', '7.26 GB'], updated: 'New',
- downloadUrl: 'https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/diffusion_models/qwen_image_2.1_int8_convrot.safetensors',
- filename: 'qwen_image_2.1_int8_convrot.safetensors', subfolder: 'diffusion_models', sizeGB: 6.76,
- },
+ QWEN21_DIFFUSION_MODEL,
{
name: 'Qwen3-VL 8B Text Encoder (INT8)',
description: 'Required text encoder for Qwen-Image 2.1 prompt understanding.',
pulls: '', tags: ['Text Encoder', '9.35 GB'], updated: 'New',
downloadUrl: 'https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/text_encoders/qwen3vl_8b_int8_convrot.safetensors',
filename: 'qwen3vl_8b_int8_convrot.safetensors', subfolder: 'text_encoders', sizeGB: 8.71,
+ sizeBytes: 9350798360,
+ sha256: '8bfd0f6e12abf2d2d697ecc888e5e90b0d6741d6708f05799f53afa560452e8f',
},
+ QWEN21_VAE,
+ ],
+ },
+ // Qwen-Image 2.1 with the community text encoder that has its refusals
+ // removed. Read off the model card on 2026-10-03
+ // (pottokao/Qwen-Image-2.1-Text-Encoder-Heretic-int8-convrot, Apache 2.0):
+ // a Heretic directional ablation of Qwen/Qwen3-VL-8B-Instruct, the model
+ // Qwen-Image 2.1 uses as its text encoder, on o_proj and down_proj; the
+ // card states that only the text encoder is modified and that the file
+ // has the tensor names and the INT8 ConvRot layout of the official one,
+ // so the stock CLIPLoader loads it. The image model and the VAE are the
+ // official files, the same entries as in the bundle above, so a machine
+ // that has that bundle fetches only the encoder. Byte count and SHA-256
+ // are the Hugging Face LFS values read on 2026-10-03; the address answers
+ // without a token. Not marked verified: no run on real hardware yet.
+ {
+ name: 'Qwen-Image 2.1 (No Refusals)',
+ description: 'Qwen-Image 2.1 with a text encoder that has its refusal direction removed by the community (Heretic). Only the text encoder differs: the image model and the VAE are the official files, shared with the official bundle and not downloaded twice. Generates from a prompt and edits a reference image from a prompt, no mask needed. With both text encoders installed, pick one under Text encoder in the Expert settings. Image model under the Qwen Research License, non-commercial use: https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE. Text encoder under Apache 2.0.',
+ tags: ['Qwen Image 2.1', 'Image', 'Edit', '1024px'],
+ uncensored: true,
+ // 6.76 + 8.71 + 0.63, in gibibytes like the official bundle.
+ totalSizeGB: 16.1,
+ vramRequired: '16-24 GB',
+ workflow: 'qwenimage',
+ tier: 'best',
+ url: 'https://huggingface.co/pottokao/Qwen-Image-2.1-Text-Encoder-Heretic-int8-convrot',
+ files: [
+ QWEN21_DIFFUSION_MODEL,
{
- name: 'Qwen-Image 2.1 VAE',
- description: 'Required autoencoder for Qwen-Image 2.1.',
- pulls: '', tags: ['VAE', '676 MB'], updated: '',
- downloadUrl: 'https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/vae/qwen_image_2.1_vae_bf16.safetensors',
- filename: 'qwen_image_2.1_vae_bf16.safetensors', subfolder: 'vae', sizeGB: 0.63,
+ name: 'Qwen3-VL 8B Text Encoder, No Refusals (INT8)',
+ description: 'Text encoder for Qwen-Image 2.1 with the refusal direction removed (Heretic). From pottokao/Qwen-Image-2.1-Text-Encoder-Heretic.',
+ pulls: '', tags: ['Text Encoder', '9.35 GB'], updated: 'New',
+ downloadUrl: 'https://huggingface.co/pottokao/Qwen-Image-2.1-Text-Encoder-Heretic-int8-convrot/resolve/main/qwen3vl_8b_int8_convrot_heretic.safetensors',
+ filename: 'qwen3vl_8b_int8_convrot_heretic.safetensors', subfolder: 'text_encoders', sizeGB: 8.71,
+ sizeBytes: 9350828392,
+ sha256: 'f15ce4275428e04f42cdb59e3a253cb290cae5de99259527f01d3d2e51153653',
},
+ QWEN21_VAE,
],
},
// The Qwen-Image 2.1 prompt enhancers (GH #148). Add-ons to the bundle
diff --git a/src/api/vram-handoff.ts b/src/api/vram-handoff.ts
index e4d85791..8f9de8da 100644
--- a/src/api/vram-handoff.ts
+++ b/src/api/vram-handoff.ts
@@ -1289,11 +1289,17 @@ async function generateImage(
inputImage = (await resolveInputImage(args.inputImage)).name
denoise = clampFloat(args.denoise, 0.6, 0.05, 1.0)
}
+ // Qwen-Image 2.1: the agent loads the text encoder the user picked in
+ // Create's advanced settings, so a picture made in chat reads the prompt
+ // with the same one.
+ const { useCreateStore } = await import('../stores/createStore')
+ const qwenTextEncoder = useCreateStore.getState().qwenTextEncoder
const workflow = await buildDynamicWorkflow(
{
prompt,
negativePrompt: typeof args.negativePrompt === 'string' ? args.negativePrompt : '',
model,
+ ...(qwenTextEncoder !== 'auto' ? { qwenTextEncoder } : {}),
sampler: tun.sampler,
scheduler: tun.scheduler,
steps: tun.steps,
diff --git a/src/components/create/experimental/ParamGroups.tsx b/src/components/create/experimental/ParamGroups.tsx
index dbd6ccdb..9385ac27 100644
--- a/src/components/create/experimental/ParamGroups.tsx
+++ b/src/components/create/experimental/ParamGroups.tsx
@@ -20,6 +20,7 @@ import { HINWEIS_TEXT } from '../../../lib/hinweis'
import { lorasForRun, loraFitsModel } from '../../../lib/lora-stack'
import { LoraStrength } from './LoraStrength'
import { supportsTransparent } from '../../../lib/transparent-image'
+import { QWEN_ENCODER_HELP, pickQwenEncoder, qwenEncoderOptions, type QwenEncoderVariant } from '../../../lib/render/qwen-text-encoder'
import { MAX_SHOTS, MAX_SHOT_CHARS, supportsMultishot } from '../../../lib/ltx-multishot'
// Video families whose dynamic-workflow strategy actually wires a LoRA node:
@@ -93,6 +94,13 @@ export function ParamGroups() {
// model family whose VAE writes an alpha channel (lib/transparent-image.ts).
const showTransparent = !isCloud && !isVideo && meta.id === 'image' && !isMlxLocal && supportsTransparent(laneType)
+ // Text encoder: a local Qwen-Image 2.1 with both editions of its encoder
+ // installed, the official one and the one without refusals. Here, in the
+ // Expert section, the user says which one reads the prompt. With one
+ // edition installed there is nothing to choose and no row.
+ const encoderOptions = !isCloud && !isVideo && !isMlxLocal && laneType === 'qwenimage' ? qwenEncoderOptions(s.textEncoderList) : []
+ const activeEncoder = pickQwenEncoder(s.textEncoderList, s.qwenTextEncoder)?.variant
+
// Shots: LTX 2.5 can cut between several shots in one run, with the same
// figure (lib/ltx-multishot.ts). Local text-to-video on that model only.
const showShots = !isCloud && meta.id === 'video' && !isMlxLocal && supportsMultishot(laneType)
@@ -343,6 +351,11 @@ export function ParamGroups() {
<Select size="sm" options={vaes.map((v) => ({ value: v, label: v }))} value={s.selectedVae} onChange={s.setSelectedVae} />
</Field>
)}
+ {encoderOptions.length > 0 && activeEncoder && (
+ <Field label="Text encoder" help={QWEN_ENCODER_HELP}>
+ <Select size="sm" ariaLabel="Text encoder" options={encoderOptions.map((o) => ({ value: o.id, label: o.label }))} value={activeEncoder} onChange={(v) => s.setQwenTextEncoder(v as QwenEncoderVariant)} />
+ </Field>
+ )}
{!isCloud && !isVideo && (
<Slider label="Skip CLIP layers" min={0} max={12} step={1} value={s.clipSkip} onChange={s.setClipSkip} />
)}
diff --git a/src/components/create/experimental/__tests__/qwen-text-encoder-oberflaeche.test.tsx b/src/components/create/experimental/__tests__/qwen-text-encoder-oberflaeche.test.tsx
new file mode 100644
index 00000000..47f5edda
--- /dev/null
+++ b/src/components/create/experimental/__tests__/qwen-text-encoder-oberflaeche.test.tsx
@@ -0,0 +1,145 @@
+// @vitest-environment jsdom
+/**
+ * "Text encoder" in the Expert settings (03.10.2026): on a local
+ * Qwen-Image 2.1 with both editions of its text encoder installed, the user
+ * says which one reads the prompt. One row, in the advanced settings, never
+ * at the prompt field.
+ */
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { cleanup, fireEvent, render, screen, within } from '@testing-library/react'
+
+const host = vi.hoisted(() => ({ mlx: false }))
+vi.mock('../../../../api/mlx-image', () => ({ isMlxImageHost: () => host.mlx }))
+vi.mock('../../../../api/comfyui', () => ({
+ classifyModel: (n: string) => (/qwen_image_2\.1/.test(n) ? 'qwenimage' : 'sdxl'),
+ isI2VModel: () => false,
+ isT2VCapable: () => true,
+ getImageUrl: (f: string) => `http://127.0.0.1:8188/view?filename=${f}`,
+}))
+vi.mock('../CreateContext', () => ({
+ useCreateExp: () => ({
+ samplerList: [], schedulerList: [], loraList: [], vaeList: [], refreshModelLists: vi.fn(),
+ }),
+}))
+
+import { ParamGroups } from '../ParamGroups'
+import { useCreateStore } from '../../../../stores/createStore'
+
+const QWEN = 'qwen_image_2.1_int8_convrot.safetensors'
+const SDXL = 'sdxl_base.safetensors'
+const OFFICIAL = 'qwen3vl_8b_int8_convrot.safetensors'
+const FREE = 'qwen3vl_8b_int8_convrot_heretic.safetensors'
+
+function setup(model: string, type: string, extra: Record<string, unknown> = {}) {
+ useCreateStore.setState({
+ backend: 'local', isGenerating: false, qwenTextEncoder: 'auto',
+ imageModel: model, imageModelList: [{ name: model, type }], cloudOp: null, utilityOp: null, removebg: false,
+ textEncoderList: [OFFICIAL, FREE],
+ ...extra,
+ } as never)
+ useCreateStore.getState().setMode('image')
+}
+
+/** The Expert section is closed until the user opens it. */
+function openExpert() {
+ fireEvent.click(screen.getByRole('button', { name: 'Expert' }))
+}
+const row = () => screen.queryByRole('button', { name: 'Text encoder' })
+
+beforeEach(() => { host.mlx = false })
+afterEach(() => { cleanup() })
+
+describe('row Text encoder', () => {
+ it('sits in the Expert section, not on the open surface', () => {
+ setup(QWEN, 'qwenimage')
+ render(<ParamGroups />)
+ expect(row()).toBeNull()
+ openExpert()
+ expect(row()).not.toBeNull()
+ expect(screen.getByText('Text encoder')).toBeTruthy()
+ })
+
+ it('shows the official encoder by default and offers both editions', () => {
+ setup(QWEN, 'qwenimage')
+ render(<ParamGroups />)
+ openExpert()
+ expect(row()!.textContent).toContain('Qwen3-VL 8B')
+ expect(row()!.textContent).not.toContain('no refusals')
+ fireEvent.click(row()!)
+ const list = screen.getByRole('listbox')
+ expect(within(list).getAllByRole('option').map((o) => o.textContent)).toEqual(['Qwen3-VL 8B', 'Qwen3-VL 8B, no refusals'])
+ })
+
+ it('picking the edition without refusals is stored and shown', () => {
+ setup(QWEN, 'qwenimage')
+ render(<ParamGroups />)
+ openExpert()
+ fireEvent.click(row()!)
+ fireEvent.click(within(screen.getByRole('listbox')).getByRole('option', { name: 'Qwen3-VL 8B, no refusals' }))
+ expect(useCreateStore.getState().qwenTextEncoder).toBe('unfiltered')
+ expect(row()!.textContent).toContain('Qwen3-VL 8B, no refusals')
+ })
+
+ it('is there for an edit too', () => {
+ setup(QWEN, 'qwenimage')
+ useCreateStore.getState().setIntent('edit')
+ render(<ParamGroups />)
+ openExpert()
+ expect(row()).not.toBeNull()
+ })
+
+ it('with one edition installed there is nothing to choose and no row', () => {
+ for (const only of [[OFFICIAL], [FREE], []]) {
+ setup(QWEN, 'qwenimage', { textEncoderList: only })
+ const view = render(<ParamGroups />)
+ openExpert()
+ expect(row()).toBeNull()
+ view.unmount()
+ }
+ })
+
+ it('is missing on every other model, in the cloud, on video and on the Mac', () => {
+ setup(SDXL, 'sdxl')
+ let view = render(<ParamGroups />)
+ openExpert()
+ expect(row()).toBeNull()
+ view.unmount()
+
+ setup(QWEN, 'qwenimage', { backend: 'cloud' })
+ view = render(<ParamGroups />)
+ expect(row()).toBeNull()
+ view.unmount()
+
+ setup(QWEN, 'qwenimage')
+ useCreateStore.getState().setMode('video')
+ view = render(<ParamGroups />)
+ openExpert()
+ expect(row()).toBeNull()
+ view.unmount()
+
+ setup(QWEN, 'qwenimage')
+ host.mlx = true
+ render(<ParamGroups />)
+ expect(row()).toBeNull()
+ })
+})
+
+describe('the setting in the store', () => {
+ it('takes the three values and nothing else', () => {
+ const s = useCreateStore.getState()
+ s.setQwenTextEncoder('unfiltered')
+ expect(useCreateStore.getState().qwenTextEncoder).toBe('unfiltered')
+ s.setQwenTextEncoder('official')
+ expect(useCreateStore.getState().qwenTextEncoder).toBe('official')
+ s.setQwenTextEncoder('something else' as never)
+ expect(useCreateStore.getState().qwenTextEncoder).toBe('auto')
+ })
+
+ it('is remembered across restarts', () => {
+ useCreateStore.getState().setQwenTextEncoder('unfiltered')
+ const kept = useCreateStore.persist.getOptions().partialize!(useCreateStore.getState()) as Record<string, unknown>
+ expect(kept.qwenTextEncoder).toBe('unfiltered')
+ // The list of files is read from ComfyUI every time, never stored.
+ expect('textEncoderList' in kept).toBe(false)
+ })
+})
diff --git a/src/hooks/__tests__/useCreate-qwen-text-encoder.test.ts b/src/hooks/__tests__/useCreate-qwen-text-encoder.test.ts
new file mode 100644
index 00000000..47cec94b
--- /dev/null
+++ b/src/hooks/__tests__/useCreate-qwen-text-encoder.test.ts
@@ -0,0 +1,179 @@
+// @vitest-environment jsdom
+/**
+ * The text encoder picked for a local Qwen-Image 2.1, through the real
+ * generate path of useCreate: the pick from the advanced settings reaches the
+ * builder on every kind of run the family has (new picture, edit, edit with
+ * references, transparent background, one image after the other as the batch
+ * does it, and behind the prompt enhancer).
+ *
+ * Nothing is rendered: ComfyUI and the enhancer run are mocked, and the run is
+ * stopped at the submit of the picture. Which file the pick loads is the
+ * builder's part (api/__tests__/qwen-image-21-no-refusals.test.ts).
+ */
+import { describe, it, expect, vi, beforeEach } from 'vitest'
+import { renderHook } from '@testing-library/react'
+
+type Built = { prompt: string; inputImage?: string; referenceImages?: string[]; transparent?: boolean; qwenTextEncoder?: string }
+const seen = vi.hoisted(() => ({
+ order: [] as string[],
+ built: [] as Built[],
+ enhancer: [] as { file: string; mode: string }[],
+}))
+
+vi.mock('../../api/mlx-image', () => ({
+ isMlxImageHost: () => false,
+ isMlxImageModel: () => false,
+ mlxStatus: vi.fn(async () => ({ installed: false })),
+ listMlxImageModels: vi.fn(async () => []),
+ buildMlxImageModels: vi.fn(() => []),
+ mergeImageModels: vi.fn((a: unknown[]) => a),
+ mlxModelIdFor: vi.fn(() => ''),
+ generateMlxImageDataUrl: vi.fn(),
+}))
+vi.mock('../../api/comfyui', async (orig) => ({
+ ...((await orig()) as Record<string, unknown>),
+ checkComfyConnection: vi.fn(async () => true),
+ submitWorkflow: vi.fn(async () => { seen.order.push('submit-picture'); throw new Error('stop here') }),
+}))
+vi.mock('../../api/comfyui-ws', () => ({
+ CLIENT_ID: 'lu-test',
+ comfyWS: { connect: vi.fn(async () => { throw new Error('no socket') }), mark: () => 0 },
+}))
+vi.mock('../../api/vram-handoff', async (orig) => ({
+ ...((await orig()) as Record<string, unknown>),
+ evictChatBackendsForRender: vi.fn(async () => null),
+ restoreChatBackendsAfterRender: vi.fn(),
+}))
+vi.mock('../../api/dynamic-workflow', async (orig) => ({
+ ...((await orig()) as Record<string, unknown>),
+ buildDynamicWorkflow: vi.fn(async (params: Built) => {
+ seen.order.push('build-picture')
+ seen.built.push({
+ prompt: params.prompt, inputImage: params.inputImage, referenceImages: params.referenceImages,
+ transparent: params.transparent, qwenTextEncoder: params.qwenTextEncoder,
+ })
+ return { '1': { class_type: 'SaveImage', inputs: {} } }
+ }),
+}))
+vi.mock('../../api/qwen-enhancer', () => ({
+ buildQwenEnhancerWorkflow: vi.fn(async (req: { file: string; mode: string }) => {
+ seen.order.push('build-enhancer')
+ seen.enhancer.push({ file: req.file, mode: req.mode })
+ return { '4': { class_type: 'TextGenerate', inputs: {} } }
+ }),
+ runQwenEnhancer: vi.fn(async () => ({ status: 'improved', prompt: 'A long rewritten prompt from the enhancer.' })),
+}))
+
+import { useCreate } from '../useCreate'
+import { useCreateStore } from '../../stores/createStore'
+
+const QWEN = 'qwen_image_2.1_int8_convrot.safetensors'
+const OFFICIAL = 'qwen3vl_8b_int8_convrot.safetensors'
+const FREE = 'qwen3vl_8b_int8_convrot_heretic.safetensors'
+const T2I_FREE = 'qwen3.5_9b_qwen_image_2.1_pe_t2i_heretic.int8_convrot.safetensors'
+const I2I_FREE = 'qwen3.5_9b_qwen_image_2.1_pe_i2i_heretic.int8_convrot.safetensors'
+
+const image = (filename: string) => ({ filename, url: `blob:${filename}`, width: 1024, height: 1024 })
+
+beforeEach(() => {
+ seen.order.length = 0
+ seen.built.length = 0
+ seen.enhancer.length = 0
+ useCreateStore.setState({
+ backend: 'local', isGenerating: false, error: null, gallery: [], promptHistory: [],
+ improvePrompt: false, improveWith: 'auto', qwenTextEncoder: 'unfiltered',
+ cloudOp: null, utilityOp: null, removebg: false, source: null, mask: null, references: [],
+ selectedLoras: [], hiresFixEnabled: false, transparentBackground: false, seed: 42,
+ imageModel: QWEN, imageModelList: [{ name: QWEN, type: 'qwenimage' }],
+ textEncoderList: [OFFICIAL, FREE],
+ } as never)
+ const s = useCreateStore.getState()
+ s.setIntent('image')
+ s.setPrompt('a fox in snow')
+})
+
+async function run() {
+ const { result } = renderHook(() => useCreate())
+ await result.current.generate()
+}
+
+describe('the picked text encoder reaches the builder', () => {
+ it('Image: a new picture', async () => {
+ await run()
+ expect(seen.built).toHaveLength(1)
+ expect(seen.built[0].qwenTextEncoder).toBe('unfiltered')
+ expect(seen.built[0].prompt).toBe('a fox in snow')
+ })
+
+ it('the default sends no pick, the builder then takes the official one first', async () => {
+ useCreateStore.setState({ qwenTextEncoder: 'auto' } as never)
+ await run()
+ expect(seen.built[0].qwenTextEncoder).toBeUndefined()
+ })
+
+ it('the official one picked by hand is sent as such', async () => {
+ useCreateStore.setState({ qwenTextEncoder: 'official' } as never)
+ await run()
+ expect(seen.built[0].qwenTextEncoder).toBe('official')
+ })
+
+ it('Edit without a mask, with the source', async () => {
+ useCreateStore.getState().setIntent('edit')
+ useCreateStore.setState({ source: image('street.png') } as never)
+ await run()
+ expect(seen.built[0]).toMatchObject({ inputImage: 'street.png', qwenTextEncoder: 'unfiltered' })
+ })
+
+ it('Edit with three more reference images', async () => {
+ useCreateStore.getState().setIntent('edit')
+ useCreateStore.setState({ source: image('street.png'), references: [image('a.png'), image('b.png'), image('c.png')] } as never)
+ await run()
+ expect(seen.built[0]).toMatchObject({
+ inputImage: 'street.png', referenceImages: ['a.png', 'b.png', 'c.png'], qwenTextEncoder: 'unfiltered',
+ })
+ })
+
+ it('Transparent background', async () => {
+ useCreateStore.setState({ transparentBackground: true } as never)
+ await run()
+ expect(seen.built[0]).toMatchObject({ transparent: true, qwenTextEncoder: 'unfiltered' })
+ })
+
+ // The batch runs the normal single run once per image, with that image as
+ // the source (batchRun.ts). Two runs in a row are what it does.
+ it('several images edited one after the other: every run carries the pick', async () => {
+ useCreateStore.getState().setIntent('edit')
+ for (const name of ['one.png', 'two.png']) {
+ useCreateStore.setState({ source: image(name), isGenerating: false, error: null } as never)
+ await run()
+ }
+ expect(seen.built.map((b) => [b.inputImage, b.qwenTextEncoder])).toEqual([['one.png', 'unfiltered'], ['two.png', 'unfiltered']])
+ })
+})
+
+describe('together with Improve my prompt', () => {
+ beforeEach(() => {
+ useCreateStore.setState({ improvePrompt: true, improveWith: 'unfiltered', textEncoderList: [OFFICIAL, FREE, T2I_FREE, I2I_FREE] } as never)
+ })
+
+ it('new picture: the enhancer writes, then the picture is built with the picked encoder', async () => {
+ await run()
+ expect(seen.enhancer).toEqual([{ file: T2I_FREE, mode: 't2i' }])
+ expect(seen.order).toEqual(['build-enhancer', 'build-picture', 'submit-picture'])
+ expect(seen.built[0]).toMatchObject({ prompt: 'A long rewritten prompt from the enhancer.', qwenTextEncoder: 'unfiltered' })
+ })
+
+ it('edit: the edit enhancer writes, the encoder pick rides along', async () => {
+ useCreateStore.getState().setIntent('edit')
+ useCreateStore.setState({ source: image('street.png') } as never)
+ await run()
+ expect(seen.enhancer).toEqual([{ file: I2I_FREE, mode: 'i2i' }])
+ expect(seen.built[0]).toMatchObject({ inputImage: 'street.png', qwenTextEncoder: 'unfiltered' })
+ })
+
+ it('the text encoder is never offered to the enhancer as its file', async () => {
+ useCreateStore.setState({ textEncoderList: [OFFICIAL, FREE] } as never)
+ await run()
+ expect(seen.enhancer).toHaveLength(0)
+ })
+})
diff --git a/src/hooks/useCreate.ts b/src/hooks/useCreate.ts
index d114d1ae..fe1cd16a 100644
--- a/src/hooks/useCreate.ts
+++ b/src/hooks/useCreate.ts
@@ -1102,6 +1102,9 @@ export function useCreate() {
...(selectedVae && selectedVae !== 'auto' ? { vae: selectedVae } : {}),
...(clipSkip > 0 ? { clipSkip } : {}),
...(listedModel?.parts ? { modelParts: listedModel.parts } : {}),
+ // Qwen-Image 2.1: the text encoder picked in the advanced settings.
+ // The builder reads it for that family only.
+ ...(state.qwenTextEncoder !== 'auto' ? { qwenTextEncoder: state.qwenTextEncoder } : {}),
}
let workflow: ComfyApiGraph = {}
diff --git a/src/lib/__tests__/vram-fit.test.ts b/src/lib/__tests__/vram-fit.test.ts
index 5334e16a..65eaf51b 100644
--- a/src/lib/__tests__/vram-fit.test.ts
+++ b/src/lib/__tests__/vram-fit.test.ts
@@ -187,6 +187,7 @@ describe('every bundle in the catalogue carries the two numbers', () => {
['Z-Image Turbo (Unfiltered, Fast)', 10, 16, 'big tight fits fits'],
['Z-Image Base (Unfiltered, Quality)', 10, 16, 'big tight fits fits'],
['Qwen-Image 2.1 (Generate and Edit)', 16, 24, 'big big tight fits'],
+ ['Qwen-Image 2.1 (No Refusals)', 16, 24, 'big big tight fits'],
['Qwen-Image 2.1 Prompt Enhancer (Official)', 16, 16, 'big big fits fits'],
['Qwen-Image 2.1 Prompt Enhancer (No Refusals)', 16, 16, 'big big fits fits'],
['DreamShaper XL Turbo V2 (Anime/Stylized)', 6, 8, 'fits fits fits fits'],
diff --git a/src/lib/render/__tests__/local-model-tier.test.ts b/src/lib/render/__tests__/local-model-tier.test.ts
index bee16e03..5efc2f76 100644
--- a/src/lib/render/__tests__/local-model-tier.test.ts
+++ b/src/lib/render/__tests__/local-model-tier.test.ts
@@ -25,8 +25,8 @@ const mainFile = (b: ModelBundle) =>
const tierOfFile = (name: string) => localTier({ name, type: classifyModel(name) })
describe('jedes lokale Bundle traegt eine Stufe', () => {
- it('alle 41 Bundles haben best, standard oder older', () => {
- expect(ALL.length).toBe(41)
+ it('alle 42 Bundles haben best, standard oder older', () => {
+ expect(ALL.length).toBe(42)
for (const b of ALL) expect(['best', 'standard', 'older'], b.name).toContain(b.tier)
})
diff --git a/src/lib/render/qwen-text-encoder.ts b/src/lib/render/qwen-text-encoder.ts
new file mode 100644
index 00000000..900e30da
--- /dev/null
+++ b/src/lib/render/qwen-text-encoder.ts
@@ -0,0 +1,77 @@
+// Which text encoder a local Qwen-Image 2.1 run loads: the pure half. No
+// stores, no network; api/comfyui.ts (findMatchingCLIP) asks it for the file.
+//
+// Qwen-Image 2.1 reads the prompt with a Qwen3-VL 8B encoder. Read off the
+// sources on 2026-10-03:
+// - Comfy-Org/Qwen-Image-2.1 ships the official one as a single file,
+// text_encoders/qwen3vl_8b_int8_convrot.safetensors.
+// - pottokao/Qwen-Image-2.1-Text-Encoder-Heretic-int8-convrot ships the same
+// encoder with the refusal direction removed (Heretic, on o_proj and
+// down_proj), in the same format with the same tensor names:
+// qwen3vl_8b_int8_convrot_heretic.safetensors. Only the text encoder is
+// changed, the image model and the VAE are not.
+// Both load with the stock CLIPLoader (type qwen_image) and go into the same
+// TextEncodeQwenImage21 node, so everything the family does works with either.
+
+/** The official file, or a community edition with the refusals removed. */
+export type QwenEncoderVariant = 'official' | 'unfiltered'
+
+export interface QwenEncoderFile {
+ /** The name ComfyUI lists, with its subfolder when it has one. */
+ file: string
+ variant: QwenEncoderVariant
+}
+
+const ENCODER_NAME = /qwen3[._-]?vl[._-]?8b/i
+const UNFILTERED_NAME = /heretic|abliterat/i
+
+/** Is this text encoder file Qwen-Image 2.1's encoder tier (Qwen3-VL 8B), and
+ * which edition? Krea 2 uses the 4B sibling under a near-identical name and
+ * MiniMax H3 the 32B one; both have other embedding dimensions and are no
+ * match. The name is the only thing ComfyUI tells us. */
+export function qwenEncoderFile(file: string): QwenEncoderFile | null {
+ const base = file.split(/[\\/]/).pop() ?? file
+ if (!ENCODER_NAME.test(base)) return null
+ return { file, variant: UNFILTERED_NAME.test(base) ? 'unfiltered' : 'official' }
+}
+
+/** Which encoder reads the prompt. 'auto' is the default: the official one
+ * when it is there, otherwise the edition that is. */
+export type QwenEncoderChoice = 'auto' | QwenEncoderVariant
+
+export const QWEN_ENCODER_CHOICES: readonly QwenEncoderChoice[] = ['auto', 'official', 'unfiltered']
+
+export interface QwenEncoderOption {
+ id: QwenEncoderVariant
+ label: string
+}
+
+const ENCODER_LABEL: Record<QwenEncoderVariant, string> = {
+ official: 'Qwen3-VL 8B',
+ unfiltered: 'Qwen3-VL 8B, no refusals',
+}
+
+/** One file per installed edition, official first. */
+function installed(textEncoders: readonly string[]): QwenEncoderFile[] {
+ const files = textEncoders.map(qwenEncoderFile).filter((f): f is QwenEncoderFile => f !== null)
+ const first = (variant: QwenEncoderVariant) => files.find((f) => f.variant === variant)
+ return [first('official'), first('unfiltered')].filter((f): f is QwenEncoderFile => !!f)
+}
+
+/** What the setting lets the user choose between. Empty unless both editions
+ * are installed: with one there is nothing to choose, it reads the prompt. */
+export function qwenEncoderOptions(textEncoders: readonly string[]): QwenEncoderOption[] {
+ const files = installed(textEncoders)
+ if (files.length < 2) return []
+ return files.map((f) => ({ id: f.variant, label: ENCODER_LABEL[f.variant] }))
+}
+
+/** The encoder file a run loads, or null when none is installed. The user's
+ * choice wins when that edition is installed; otherwise the first one there. */
+export function pickQwenEncoder(textEncoders: readonly string[], choice: QwenEncoderChoice = 'auto'): QwenEncoderFile | null {
+ const files = installed(textEncoders)
+ return files.find((f) => f.variant === choice) ?? files[0] ?? null
+}
+
+export const QWEN_ENCODER_HELP =
+ 'The model that reads your prompt for Qwen-Image 2.1. The no refusals edition has its refusal direction removed by the community (Heretic). The image model is the same.'
diff --git a/src/stores/createStore.ts b/src/stores/createStore.ts
index 59b9b3a3..4c5f3c97 100644
--- a/src/stores/createStore.ts
+++ b/src/stores/createStore.ts
@@ -36,6 +36,7 @@ import type { ModelType, ClassifiedModel } from '../api/comfyui'
import { MAX_SHOTS, MAX_SHOT_CHARS } from '../lib/ltx-multishot'
import { clampLoraStrength, defaultLoraStrength } from '../lib/lora-strength'
import { IMPROVE_WITH, type ImproveWith } from '../lib/render/qwen-enhancer'
+import { QWEN_ENCODER_CHOICES, type QwenEncoderChoice } from '../lib/render/qwen-text-encoder'
import { classifyModel, hidreamSampling } from '../api/comfyui'
import type { HiresUpscaleMethod } from '../api/hires-fix'
import { releaseVideoBlobUrl } from '../api/mlx-video'
@@ -418,8 +419,12 @@ interface CreateState {
* enhancer installed (lib/render/qwen-enhancer.ts). Remembered. */
improveWith: ImproveWith
setImproveWith: (who: ImproveWith) => void
+ /** Which text encoder reads the prompt on a local Qwen-Image 2.1 run when
+ * both editions are installed (lib/render/qwen-text-encoder.ts). Remembered. */
+ qwenTextEncoder: QwenEncoderChoice
+ setQwenTextEncoder: (which: QwenEncoderChoice) => void
/** Runtime-only: the text encoder files ComfyUI lists, read with the model
- * lists. The switch finds the installed prompt enhancers in it. */
+ * lists. The prompt enhancers and the Qwen-Image 2.1 encoders are found in it. */
textEncoderList: string[]
setTextEncoderList: (list: string[]) => void
/** Runtime-only: the LOCAL model picked inside a specialized lane (ACE
@@ -744,6 +749,7 @@ export const useCreateStore = create<CreateState>()(
cloudImageCount: 1,
improvePrompt: false,
improveWith: 'auto' as ImproveWith,
+ qwenTextEncoder: 'auto' as QwenEncoderChoice,
textEncoderList: [] as string[],
transparentBackground: false,
videoShots: [],
@@ -1014,6 +1020,7 @@ export const useCreateStore = create<CreateState>()(
setCloudImageCount: (count) => set({ cloudImageCount: clampImageCount(count) }),
setImprovePrompt: (on) => set({ improvePrompt: on === true }),
setImproveWith: (who) => set({ improveWith: IMPROVE_WITH.includes(who) ? who : 'auto' }),
+ setQwenTextEncoder: (which) => set({ qwenTextEncoder: QWEN_ENCODER_CHOICES.includes(which) ? which : 'auto' }),
setTextEncoderList: (list) => set({ textEncoderList: list }),
setVideoShotCount: (count) => set((st) => {
const further = Math.max(1, Math.min(MAX_SHOTS, Math.floor(count) || 1)) - 1
@@ -1289,6 +1296,7 @@ export const useCreateStore = create<CreateState>()(
musicHowtoSeen: state.musicHowtoSeen,
improvePrompt: state.improvePrompt,
improveWith: state.improveWith,
+ qwenTextEncoder: state.qwenTextEncoder,
transparentBackground: state.transparentBackground,
triggerWord: state.triggerWord,
trainSteps: state.trainSteps,