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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
feat(create): say the working range when CFG or a LoRA strength is far off
purple789ffb36f372
diff --git a/e2e/slider-hints.spec.ts b/e2e/slider-hints.spec.tsnew file mode 100644index 00000000..ee7b734d--- /dev/null+++ b/e2e/slider-hints.spec.ts@@ -0,0 +1,100 @@+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'++/**+ * B50 (Discord, 30.10.2026): a character trained in LU came out as noise with a+ * checker pattern on Z-Image. Its workflow showed CFG 30 and the LoRA at 2.0.+ * Now a note stands next to each slider, with the range that works; the value+ * stays as set (David: a note, never a lock).+ *+ * A stand-in ComfyUI answers over proxy_localhost, as in+ * lora-stack-search-and-wide-strength.spec.ts. LU_SHOTS=<folder> writes the+ * screenshots there.+ */++const MODEL = 'z_image_bf16.safetensors'+const CHAR = 'char_jolene_zimage.safetensors'+const SHOTS = process.env.LU_SHOTS++async function boot(page: Page) {+ await page.addInitScript(tauriMockInit, { assistantReply: DEFAULT_ASSISTANT_REPLY, modelName: DEFAULT_MODEL_NAME, platform: 'windows' as const })+ await seedOnboardingDone(page)+ await page.addInitScript(([lora, model]) => {+ const w = window as unknown as { __PROMPTS__: string[]; __TAURI_INTERNALS__: { invoke: (c: string, a: { url?: string; method?: string; body?: string }) => Promise<unknown> } }+ if (!localStorage.getItem('create-store')) {+ localStorage.setItem('create-store', JSON.stringify({ state: { backend: 'local', imageModel: model }, version: 2 }))+ }+ w.__PROMPTS__ = []+ const bridge = w.__TAURI_INTERNALS__+ const invoke = bridge.invoke+ const combo = (v: string[]) => [v]+ const nodes = {+ UNETLoader: { input: { required: { unet_name: combo([model as string]), weight_dtype: combo(['default']) } } },+ CLIPLoader: { input: { required: { clip_name: combo(['qwen_3_4b.safetensors']), type: combo(['qwen_image']) } } },+ LoraLoader: { input: { required: { lora_name: combo([lora as string]) } } },+ LoraLoaderModelOnly: { input: { required: { lora_name: combo([lora as string]) } } },+ VAELoader: { input: { required: { vae_name: combo(['ae.safetensors']) } } },+ KSampler: { input: { required: { sampler_name: combo(['euler']), scheduler: combo(['simple']) } } },+ EmptySD3LatentImage: { input: { required: {} } }, EmptyLatentImage: { input: { required: {} } }, CLIPTextEncode: { input: { required: {} } },+ VAEDecode: { input: { required: {} } }, SaveImage: { input: { required: {} } },+ } as Record<string, unknown>+ 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 3060', type: 'cuda', vram_total: 12 * 1024 ** 3 }] }))+ if (url.endsWith('/prompt') && args.method === 'POST') {+ w.__PROMPTS__.push(String(args.body))+ return Promise.resolve(JSON.stringify({ prompt_id: 'p1', number: 1, node_errors: {} }))+ }+ 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('{}')+ }+ }, [CHAR, MODEL] as const)+}++const shot = async (page: Page, name: string, testId: string) => {+ if (!SHOTS) return+ await page.waitForTimeout(500)+ await page.getByTestId(testId).evaluate((el) => el.scrollIntoView({ block: 'center' }))+ await page.screenshot({ path: `${SHOTS}/${name}.png` })+}++test('Z-Image at CFG 30 and a character at 2.0: a note at each slider, gone again at a fitting value', async ({ page }) => {+ await boot(page)+ await page.goto('/')+ await page.getByRole('button', { name: /^Create$/ }).click()+ await page.getByRole('radio', { name: 'Image', exact: true }).click()+ await page.getByRole('button', { name: 'Advanced settings' }).click()++ // CFG: quiet at the start (3.5), a note at 30.+ // The CFG slider is the one that goes to 30 (ParamGroups.tsx).+ const cfg = page.locator('input[type="range"][max="30"]')+ await expect(cfg).toBeVisible({ timeout: 15_000 })+ await expect(page.getByTestId('cfg-hint')).toHaveCount(0)+ await cfg.fill('30')+ await expect(page.getByTestId('cfg-hint')).toHaveText('This model works best at CFG 1 to 5. Above 10 the picture turns to noise or a checker pattern.')+ await shot(page, 'p8-b50-1-cfg-30', 'cfg-hint')++ // The character LoRA at 2.0.+ const expert = page.getByRole('button', { name: 'Expert', exact: true })+ if (!(await page.getByText(/^LoRA stack/).isVisible())) await expert.click()+ await page.getByRole('button', { name: /char_jolene_zimage/ }).click()+ const strength = page.getByRole('textbox', { name: 'Strength of char_jolene_zimage' })+ await expect(page.getByTestId('lora-strength-hint')).toHaveCount(0)+ await strength.fill('2')+ await strength.blur()+ await expect(page.getByTestId('lora-strength-hint')).toHaveText('Above 1.5 most LoRAs break the picture. 0.6 to 1.2 is the usual range.')+ await shot(page, 'p8-b50-2-lora-2', 'lora-strength-hint')++ // A note, never a lock: the values stay as set, and back in range the notes go.+ await expect(cfg).toHaveValue('30')+ await cfg.fill('4')+ await expect(page.getByTestId('cfg-hint')).toHaveCount(0)+ await strength.fill('0.8')+ await strength.blur()+ await expect(page.getByTestId('lora-strength-hint')).toHaveCount(0)+})diff --git a/src/components/create/experimental/ParamGroups.tsx b/src/components/create/experimental/ParamGroups.tsxindex c257cfca..f1f66739 100644--- a/src/components/create/experimental/ParamGroups.tsx+++ b/src/components/create/experimental/ParamGroups.tsx@@ -27,6 +27,7 @@ import { HINWEIS_TEXT } from '../../../lib/hinweis'import { filterLoraRows, loraCopyText, lorasForRun, loraRows } from '../../../lib/lora-stack'import { loraStackView, setLoraStackQuery, setLoraStackScroll } from './loraStackView'import { LoraStrength } from './LoraStrength'+import { cfgHint, loraStrengthHint } from '../../../lib/param-hints'import { MOTION_OWN_WORKFLOW_NOTE, useMotionOwnWorkflow } from './motionWorkflow'import { supportsTransparent } from '../../../lib/transparent-image'import { QWEN_ENCODER_HELP, pickQwenEncoder, qwenEncoderOptions, type QwenEncoderVariant } from '../../../lib/render/qwen-text-encoder'@@ -232,6 +233,8 @@ export function ParamGroups() {// its LoRAs too. The real values are in Workflow parameters below.const motionWorkflow = useMotionOwnWorkflow() !== null+ const cfgNote = cfgHint(laneType, s.cfgScale)+const samplers = samplerList.length ? samplerList : SAMPLERS_FALLBACKconst schedulers = schedulerList.length ? schedulerList : SCHEDULERS_FALLBACKconst vaes = vaeList.length ? vaeList : ['auto']@@ -248,6 +251,8 @@ export function ParamGroups() {>{showSteps && <Slider label="Steps" min={1} max={macVideo ? (macClip?.maxSteps ?? 60) : 60} step={1} value={s.steps} onChange={s.setSteps} />}{showCfg && <Slider label={isVideo ? 'Guidance' : 'CFG scale'} min={0} max={30} step={0.5} value={s.cfgScale} onChange={s.setCfgScale} format={(v) => v.toFixed(1)} />}+ {/* B50: far above what the model takes, a note with the range that works. It never blocks. */}+ {showCfg && !isVideo && cfgNote && <p className={`t-micro ${HINWEIS_TEXT.ruhig}`} data-testid="cfg-hint">{cfgNote}</p>}{showSize && (macSize && macClip ? (// The Mac: the model's grid and bounds. What runs is said below.<div className="grid grid-cols-2 gap-2">@@ -584,6 +589,7 @@ export function ParamGroups() {// the strength set here on Qwen-Image 2.1, and says so where// the strength is set.const alphaNote = isMlxLocal && laneType === 'qwenimage' ? mlxLoraAlphaNote(loraAlpha?.[name]) : null+ const strengthNote = active ? loraStrengthHint(file, active.strength) : nullreturn (<div key={name} className={cn('rounded-md border transition-colors', active ? 'border-white/15 bg-white/[0.06]' : 'border-white/[0.06]')}><div className="flex items-stretch">@@ -597,6 +603,7 @@ export function ParamGroups() {<div className="px-2.5 pb-2"><LoraStrength name={label} value={active.strength} onChange={(v) => s.setLoraStrengthFor(name, v)} />{alphaNote && <p className="mt-1.5 t-micro text-gray-500" data-testid="lora-alpha-note">{alphaNote}</p>}+ {strengthNote && <p className={`mt-1.5 t-micro ${HINWEIS_TEXT.ruhig}`} data-testid="lora-strength-hint">{strengthNote}</p>}</div>)}</div>diff --git a/src/components/create/experimental/__tests__/regler-hinweise.test.tsx b/src/components/create/experimental/__tests__/regler-hinweise.test.tsxnew file mode 100644index 00000000..f1e3cb32--- /dev/null+++ b/src/components/create/experimental/__tests__/regler-hinweise.test.tsx@@ -0,0 +1,113 @@+// @vitest-environment jsdom+/**+ * B50 (Discord, 30.10.2026): a character trained in LU came out as noise with+ * a checker pattern. The picture's own workflow said why: CFG 30 and the LoRA+ * at 2.0, both turned up by hand. Nothing in LU said that this breaks Z-Image.+ * Now a short note stands next to the slider, with the range that works. It+ * never blocks (David, 30.10.2026).+ *+ * The rules are lib/param-hints.ts; here they are checked as rules and in the+ * real ParamGroups.+ */+import { afterEach, describe, expect, it, vi } from 'vitest'+import { cleanup, fireEvent, render, screen } from '@testing-library/react'++const lists = vi.hoisted(() => ({ loras: [] as string[] }))+vi.mock('../../../../api/mlx-image', () => ({ isMlxImageHost: () => false }))+vi.mock('../CreateContext', () => ({+ useCreateExp: () => ({+ samplerList: [], schedulerList: [], loraList: lists.loras, vaeList: [], refreshModelLists: vi.fn(),+ }),+}))++import { ParamGroups } from '../ParamGroups'+import { useCreateStore } from '../../../../stores/createStore'+import { classifyModel, MODEL_TYPE_DEFAULTS, type ModelType } from '../../../../api/comfyui'+import { cfgHint, loraStrengthHint, LOW_CFG_FAMILIES } from '../../../../lib/param-hints'++const Z_BASE = 'z_image_bf16.safetensors'+const SDXL = 'juggernautXL_v9.safetensors'+const CHAR = 'char_jolene_zimage.safetensors'+const SLIDER = 'krea2_age_slider.safetensors'++describe('the rules', () => {+ it('the low-CFG families are exactly the image families whose default CFG is at most 4', () => {+ const notImage = new Set(['wan', 'wan22', 'hunyuan', 'ltx', 'ltx25', 'minimaxh3', 'mochi', 'cosmos', 'ace', 'yue2'])+ const low = Object.entries(MODEL_TYPE_DEFAULTS)+ .filter(([family, d]) => !notImage.has(family) && d.frames === 1 && d.cfg <= 4)+ .map(([family, d]) => [family, d.cfg])+ expect(Object.fromEntries(low)).toEqual(LOW_CFG_FAMILIES)+ expect(LOW_CFG_FAMILIES['sdxl' as ModelType]).toBeUndefined()+ })++ it('Z-Image: quiet up to 10, a note with the working range above', () => {+ expect(cfgHint('zimage', 3.5)).toBeNull()+ expect(cfgHint('zimage', 10)).toBeNull()+ expect(cfgHint('zimage', 30)).toBe('This model works best at CFG 1 to 5. Above 10 the picture turns to noise or a checker pattern.')+ })++ it('a distilled family that runs at CFG 1 speaks up earlier', () => {+ expect(cfgHint('flux', 4)).toBeNull()+ expect(cfgHint('flux', 6)).toBe('This model works best at CFG 1 to 2. Above 5 the picture turns to noise or a checker pattern.')+ })++ it('families made for a high CFG and unknown models get no note', () => {+ expect(cfgHint('sdxl', 30)).toBeNull()+ expect(cfgHint('sd15', 30)).toBeNull()+ expect(cfgHint('unknown', 30)).toBeNull()+ })++ it('a LoRA above 1.5 gets a note, a slider LoRA does not', () => {+ expect(loraStrengthHint(CHAR, 1.5)).toBeNull()+ expect(loraStrengthHint(CHAR, 2)).toBe('Above 1.5 most LoRAs break the picture. 0.6 to 1.2 is the usual range.')+ expect(loraStrengthHint(SLIDER, 8)).toBeNull()+ expect(loraStrengthHint(CHAR, -2)).toBeNull()+ })+})++function setup(model: string, cfg: number, loras: { name: string; strength: number }[] = []) {+ lists.loras = loras.map((l) => l.name)+ useCreateStore.setState({+ backend: 'local', isGenerating: false, cloudOp: null, utilityOp: null, removebg: false, expertOpen: false,+ selectedLoras: loras,+ imageModel: model, imageModelList: [{ name: model, type: classifyModel(model) }],+ videoModel: '', videoModelList: [],+ } as never)+ useCreateStore.getState().setIntent('image')+ useCreateStore.setState({ cfgScale: cfg } as never)+ render(<ParamGroups />)+}++afterEach(() => { cleanup() })++describe('next to the sliders', () => {+ it('the reported case: Z-Image Base at CFG 30 says the working range, and Create stays possible', () => {+ setup(Z_BASE, 30)+ expect(screen.getByTestId('cfg-hint').textContent).toBe(cfgHint('zimage', 30))+ // A note, not a lock: the value stays what the user set.+ expect(useCreateStore.getState().cfgScale).toBe(30)+ })++ it('Z-Image at its default says nothing', () => {+ setup(Z_BASE, 3.5)+ expect(screen.queryByTestId('cfg-hint')).toBeNull()+ })++ it('SDXL at a high CFG says nothing', () => {+ setup(SDXL, 20)+ expect(screen.queryByTestId('cfg-hint')).toBeNull()+ })++ it('the character at 2.0 in the stack gets the note under its strength', () => {+ setup(Z_BASE, 3.5, [{ name: CHAR, strength: 2 }])+ fireEvent.click(screen.getByRole('button', { name: 'Expert' }))+ expect(screen.getByTestId('lora-strength-hint').textContent).toBe(loraStrengthHint(CHAR, 2))+ expect(useCreateStore.getState().selectedLoras[0].strength).toBe(2)+ })++ it('the character at 0.8 has no note', () => {+ setup(Z_BASE, 3.5, [{ name: CHAR, strength: 0.8 }])+ fireEvent.click(screen.getByRole('button', { name: 'Expert' }))+ expect(screen.queryByTestId('lora-strength-hint')).toBeNull()+ })+})diff --git a/src/lib/param-hints.ts b/src/lib/param-hints.tsnew file mode 100644index 00000000..9cf8257a--- /dev/null+++ b/src/lib/param-hints.ts@@ -0,0 +1,50 @@+// Short notes next to the CFG and LoRA strength sliders when a value is far+// outside what the model takes. They never block; the value stays.+//+// B50 (Discord, 30.10.2026): a character trained in LU came out as noise with a+// checker pattern. The picture's own workflow showed CFG 30 and the LoRA at+// 2.0, both turned up by hand on Z-Image. Nothing said that this breaks it.+import type { ModelType } from '../api/comfyui'++/** The default CFG of each image family with a low optimum, as in+ * MODEL_TYPE_DEFAULTS (api/comfyui.ts; a test keeps the two equal). Kept here+ * so the rule needs no import of the ComfyUI module. SD 1.5 and SDXL (7) are+ * made for a high CFG and are not in it. */+export const LOW_CFG_FAMILIES: Partial<Record<ModelType, number>> = {+ flux: 1, flux2: 1, krea2: 1, qwenimage: 1, hidream: 1, ernie_image: 1,+ zimage: 3.5, chroma: 3.5, qwenimage1: 4, sd3: 4, lumina2: 4,+}++/** Z-Image: Turbo runs at 1, Base at about 3.5 to 5 (LU starts at 3.5, the+ * P8 box runs used 4). */+const ZIMAGE_RANGE = { low: 1, high: 5, limit: 10 }++function cfgRange(family: ModelType): { low: number; high: number; limit: number } | null {+ if (family === 'zimage') return ZIMAGE_RANGE+ const cfg = LOW_CFG_FAMILIES[family]+ if (cfg === undefined) return null+ // A family that runs at CFG 1 (distilled, or guidance in the model) already+ // suffers at 5; the others around their default from 10 on.+ return cfg <= 1 ? { low: 1, high: 2, limit: 5 } : { low: 1, high: Math.round((cfg + 1.5) * 2) / 2, limit: 10 }+}++/** The note under the CFG slider of an image model, or null. */+export function cfgHint(family: ModelType, cfg: number): string | null {+ const range = cfgRange(family)+ if (!range || cfg <= range.limit) return null+ return `This model works best at CFG ${range.low} to ${range.high}. Above ${range.limit} the picture turns to noise or a checker pattern.`+}++/** Above this most LoRAs break the picture. */+export const LORA_STRENGTH_HINT_ABOVE = 1.5++/** Slider LoRAs are made for a wide range (lib/lora-strength.ts: -10 to 15),+ * so a high value there is meant. Their files say so in the name. */+const SLIDER_LORA = /slider/i++/** The note under the strength of one LoRA in the stack, or null. */+export function loraStrengthHint(file: string, strength: number): string | null {+ if (strength <= LORA_STRENGTH_HINT_ABOVE) return null+ if (SLIDER_LORA.test(file.replace(/^.*[\\/]/, ''))) return null+ return 'Above 1.5 most LoRAs break the picture. 0.6 to 1.2 is the usual range.'+}