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(trainer): der Hinweistext nennt die Stufe, nicht nur die Schrittzahl

purplec5ee5cf45ace
diff --git a/docs/guide/create/index.html b/docs/guide/create/index.html
index 83d42efd..10c64da5 100644
--- a/docs/guide/create/index.html
+++ b/docs/guide/create/index.html
@@ -171,7 +171,7 @@
<span class="step-num">3</span>
<span class="step-title">Train</span>
<div class="step-body">
-<p>Pick a step count: "Quick" (400 steps), "Standard" (1200) or "Thorough" (2400). The help line reads "Runs on your GPU and takes a while (1200 steps). The local chat model pauses for the run. The character lands in your local LoRAs." Press "Create". The run goes "Freeing the card for training (the local chat model pauses until the run ends)...", "Step 1/4: Caching image latents...", "Step 2/4: Caching text encoder outputs...", "Step 3/4: Training (1200 steps). This runs for a while, the counter follows every step." with "Training 312/1200...", and "Step 4/4: Converting the LoRA for ComfyUI...". It ends with "Character ready: char_davechar_zimage.safetensors is in your loras. Put 'davechar' in a prompt on the Image tab with the LoRA active."</p>
+<p>Pick a step count: "Quick" (400 steps), "Standard" (1200) or "Thorough" (2400). The help line names the step you picked: "Runs on your GPU and takes a while (Standard, 1200 steps). The local chat model pauses for the run. The character lands in your local LoRAs." Press "Create". The run goes "Freeing the card for training (the local chat model pauses until the run ends)...", "Step 1/4: Caching image latents...", "Step 2/4: Caching text encoder outputs...", "Step 3/4: Training (1200 steps). This runs for a while, the counter follows every step." with "Training 312/1200...", and "Step 4/4: Converting the LoRA for ComfyUI...". It ends with "Character ready: char_davechar_zimage.safetensors is in your loras. Put 'davechar' in a prompt on the Image tab with the LoRA active."</p>
<p>The local recipe needs a card with 12 GB of memory. The code does not state how long a run takes; it depends on the card and the step count, and the counter is the honest measure. "Cancel" stops the run at once and frees the card.</p>
<p>Hosted, the same tab trains on LU Cloud with no card requirement; the footer reads "Training runs in the cloud and lands the character on your shelf." A plan includes a monthly number of trainings.</p>
</div>
diff --git a/src/components/create/experimental/SpecialIntentControls.tsx b/src/components/create/experimental/SpecialIntentControls.tsx
index 50933685..07ff5f06 100644
--- a/src/components/create/experimental/SpecialIntentControls.tsx
+++ b/src/components/create/experimental/SpecialIntentControls.tsx
@@ -22,6 +22,7 @@ import { startModelDownload, getDownloadProgress } from '../../../api/discover'
import { useDownloadStore } from '../../../stores/downloadStore'
import { getLoraModels } from '../../../api/comfyui'
import { musicTakesLyrics, musicHowtoLines } from '../../../lib/render/music-ui'
+import { TRAIN_PRESETS, trainStepsNote } from '../../../lib/trainer-presets'
import { useCreateExp } from './CreateContext'
import { loadImageRef } from './loadImage'
import { mediaRefFrom } from './mediaRef'
@@ -393,11 +394,7 @@ function LocalTrainControls() {
layoutId="train-steps"
value={String(trainSteps)}
onChange={(v) => setTrainSteps(Number(v))}
- options={[
- { value: '400', label: 'Quick' },
- { value: '1200', label: 'Standard' },
- { value: '2400', label: 'Thorough' },
- ]}
+ options={TRAIN_PRESETS.map((p) => ({ value: String(p.steps), label: p.label }))}
/>
<span className="t-label text-gray-600">
{trainImages.length}/30 photos{trainImages.length < 4 ? ', need at least 4' : ''}
@@ -405,7 +402,11 @@ function LocalTrainControls() {
</div>
{!isGenerating && (
<div className="t-label text-gray-600 flex items-center gap-1.5">
- <span>Runs on your GPU and takes a while ({trainSteps} steps). The local chat model pauses for the run. The character lands in your local LoRAs.</span>
+ {/* Die Klammer nennt die Stufe UND die Zahl. Fund 2 der Kampagne
+ 3.0.0: `(400 STEPS)` allein sagt nicht, welche der drei Stufen
+ gerade gilt, und ein Tester hielt Quick deshalb fuer wirkungslos,
+ obwohl Quick genau diese 400 sind. */}
+ <span>Runs on your GPU and takes a while ({trainStepsNote(trainSteps)}). The local chat model pauses for the run. The character lands in your local LoRAs.</span>
{/* The run repairs its own environment now (A2), so this is no
longer the only way out of a broken install. It stays because
the button used to render ONLY while the environment counted as
diff --git a/src/components/create/experimental/__tests__/die-stufe-des-trainers-kommt-an.test.tsx b/src/components/create/experimental/__tests__/die-stufe-des-trainers-kommt-an.test.tsx
new file mode 100644
index 00000000..a95a26be
--- /dev/null
+++ b/src/components/create/experimental/__tests__/die-stufe-des-trainers-kommt-an.test.tsx
@@ -0,0 +1,140 @@
+// @vitest-environment jsdom
+/**
+ * Fund 2 der E2E-Kampagne 3.0.0: "Quick senkt die Schrittzahl des Trainers
+ * nicht" (T3, Nebenfund 8, Box, 11.09.2026).
+ *
+ * Nachgemessen am Code und an den Belegen des Testers: Quick IST 400, und 400
+ * ist die kleinste der drei Stufen (Quick 400, Standard 1200, Thorough 2400).
+ * Der Beleg `T3-belege/cdp-ausgaben/p-5a-out.json`, aufgenommen um 17:27 Boxzeit
+ * und damit zwei Minuten VOR dem Klick auf Quick, zeigt den Hinweistext schon
+ * mit `(400 STEPS)`: die gespeicherte Wahl der Box stand laengst auf Quick, der
+ * Klick konnte also nichts mehr senken. Das Handbuch nennt dieselben Zahlen
+ * (docs/guide/create: "Quick" (400 steps), "Standard" (1200) or "Thorough"
+ * (2400)).
+ *
+ * Was fehlte, war der Name der Stufe neben der Zahl. Diese Datei nagelt beides
+ * fest: die Zahl jeder Stufe erreicht den Hinweistext UND den Auftrag an den
+ * Trainer, und der Text sagt, welche Stufe gilt.
+ *
+ * Run: npx vitest run src/components/create/experimental/__tests__/die-stufe-des-trainers-kommt-an.test.tsx
+ */
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { resolve } from 'node:path'
+import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+
+import { TRAIN_PRESETS, TRAIN_STEPS_DEFAULT, trainStepsNote } from '../../../../lib/trainer-presets'
+
+const backendCall = vi.fn(async () => ({ status: 'ok' }))
+vi.mock('../../../../api/backend', () => ({
+ isTauri: () => true,
+ isMacOS: () => false,
+ isWindows: () => true,
+ isLinux: () => false,
+ backendCall: (...a: unknown[]) => backendCall(...(a as [])),
+}))
+vi.mock('../../../../api/trainer', async () => {
+ const actual = await vi.importActual<typeof import('../../../../api/trainer')>('../../../../api/trainer')
+ return {
+ ...actual,
+ characterTrainerStatus: vi.fn(async () => ({
+ envReady: true,
+ basesReady: true,
+ install: { status: 'done', step: '', percent: 100 },
+ })),
+ installCharacterTrainer: vi.fn(async () => undefined),
+ }
+})
+vi.mock('../../../../api/comfyui', () => ({ getLoraModels: vi.fn(async () => []) }))
+vi.mock('../../../../api/cloud/loras', () => ({ listLoras: vi.fn(async () => []), deleteLora: vi.fn() }))
+
+import { SpecialControls } from '../SpecialIntentControls'
+import { useCreateStore } from '../../../../stores/createStore'
+import { startCharacterTraining } from '../../../../api/trainer'
+
+const quelle = readFileSync(resolve(__dirname, '..', 'SpecialIntentControls.tsx'), 'utf8')
+
+beforeEach(() => {
+ cleanup()
+ backendCall.mockClear()
+ useCreateStore.setState({ backend: 'local', characterTab: 'train', trainSteps: TRAIN_STEPS_DEFAULT })
+})
+
+describe('die drei Stufen des Trainers', () => {
+ it('Quick ist die kleinste, und die Voreinstellung ist Standard', () => {
+ expect(TRAIN_PRESETS.map((p) => `${p.label}:${p.steps}`)).toEqual([
+ 'Quick:400', 'Standard:1200', 'Thorough:2400',
+ ])
+ expect(Math.min(...TRAIN_PRESETS.map((p) => p.steps)), 'Quick ist die kleinste Zahl').toBe(400)
+ expect(TRAIN_STEPS_DEFAULT).toBe(1200)
+ })
+
+ it('die Voreinstellung ist dieselbe, die der Trainer ohne Angabe nimmt', () => {
+ // Ohne das traegt die Oberflaeche eine Zahl vor, und der Lauf nimmt eine
+ // andere, sobald ein Aufrufer die Stufe weglaesst.
+ const rust = readFileSync(resolve(__dirname, '../../../../..', 'src-tauri/src/commands/trainer.rs'), 'utf8')
+ expect(rust).toContain(`steps.unwrap_or(${TRAIN_STEPS_DEFAULT})`)
+ })
+
+ it('das Handbuch nennt dieselben drei Zahlen', () => {
+ const guide = readFileSync(resolve(__dirname, '../../../../..', 'docs/guide/create/index.html'), 'utf8')
+ expect(guide).toContain('"Quick" (400 steps), "Standard" (1200) or "Thorough" (2400)')
+ })
+})
+
+describe('die gewaehlte Stufe steht im Hinweistext', () => {
+ it('THE FIX: der Text nennt die Stufe UND die wirksame Zahl', async () => {
+ render(<SpecialControls intent="character" />)
+ const zeile = await screen.findByText(/Runs on your GPU and takes a while/)
+ expect(zeile.textContent).toContain('(Standard, 1200 steps)')
+
+ fireEvent.click(screen.getByRole('radio', { name: 'Quick' }))
+ expect(useCreateStore.getState().trainSteps, 'Quick senkt die Schrittzahl').toBe(400)
+ expect(zeile.textContent).toContain('(Quick, 400 steps)')
+
+ fireEvent.click(screen.getByRole('radio', { name: 'Thorough' }))
+ expect(useCreateStore.getState().trainSteps).toBe(2400)
+ expect(zeile.textContent).toContain('(Thorough, 2400 steps)')
+ })
+
+ it('DIE ROTE ZAHL: `(400 steps)` allein sagt nicht, welche Stufe gilt', () => {
+ // Genau das hat T3 gelesen. Der Satz aus der Klammer ohne Namen kommt in
+ // der Oberflaeche nicht mehr vor.
+ expect(trainStepsNote(400)).toBe('Quick, 400 steps')
+ expect(quelle).not.toContain('({trainSteps} steps)')
+ expect(quelle).toContain('({trainStepsNote(trainSteps)})')
+ })
+
+ it('GEGENPFAD: eine Zahl ohne Stufe nennt keine Stufe', () => {
+ // Eine gespeicherte Zahl von Hand (der Store laesst 100 bis 4000 zu) ist
+ // keine der drei, und der Text erfindet dafuer keinen Namen.
+ expect(trainStepsNote(777)).toBe('777 steps')
+ })
+
+ it('der Waehler hat genau die drei Stufen aus der Tabelle', async () => {
+ render(<SpecialControls intent="character" />)
+ for (const p of TRAIN_PRESETS) await screen.findByRole('radio', { name: p.label })
+ expect(quelle).toContain('TRAIN_PRESETS.map((p) => ({ value: String(p.steps), label: p.label }))')
+ })
+})
+
+describe('die gewaehlte Zahl erreicht den Lauf', () => {
+ it('der Auftrag an den Trainer traegt die Zahl der Stufe', async () => {
+ await startCharacterTraining('t3char', 't3char', 't3char', 400)
+ expect(backendCall).toHaveBeenCalledWith('start_character_training', {
+ setId: 't3char', name: 't3char', triggerWord: 't3char', steps: 400,
+ })
+ })
+
+ it('der Absendeweg nimmt die Zahl aus dem Store, nicht eine eigene', () => {
+ const hook = readFileSync(resolve(__dirname, '../../../..', 'hooks/useCreate.ts'), 'utf8')
+ expect(hook).toContain('await startCharacterTraining(setId, trigger, trigger, state.trainSteps)')
+ })
+
+ it('und der Trainer legt sie auf die Befehlszeile', () => {
+ // `--max_train_steps 400` ist genau das, was T3 in der laufenden
+ // Befehlszeile gemessen hat.
+ const rust = readFileSync(resolve(__dirname, '../../../../..', 'src-tauri/src/commands/trainer.rs'), 'utf8')
+ expect(rust).toContain('"--max_train_steps", step.steps,')
+ })
+})
diff --git a/src/lib/trainer-presets.ts b/src/lib/trainer-presets.ts
new file mode 100644
index 00000000..b158de6e
--- /dev/null
+++ b/src/lib/trainer-presets.ts
@@ -0,0 +1,50 @@
+/**
+ * Die drei Stufen des lokalen Character-Trainers, an EINER Stelle.
+ *
+ * Die Zahlen standen bisher nur im Waehler von SpecialIntentControls, und der
+ * Hinweistext darunter nannte die wirksame Zahl ohne den Namen der Stufe. Fund
+ * 2 der E2E-Kampagne 3.0.0 (T3, Box, 11.09.2026) ist genau diese Luecke: der
+ * Tester klickte `Quick`, las weiter `(400 STEPS)` und hielt die Stufe fuer
+ * wirkungslos. Sie war es nicht. Seine eigene Messung eine Minute vor dem Klick
+ * (`p-5a-out.json`) zeigt denselben Text schon mit 400, weil die gespeicherte
+ * Wahl der Box laengst auf Quick stand. 400 IST Quick, und Quick ist die
+ * kleinste der drei Stufen; das Handbuch sagt dasselbe (docs/guide/create:
+ * "Quick" (400 steps), "Standard" (1200) or "Thorough" (2400)).
+ *
+ * Der Hinweistext nennt deshalb jetzt die Stufe neben der Zahl. Wer das liest,
+ * kann nicht mehr raten, welche der drei gerade gilt.
+ */
+
+export interface TrainPreset {
+ /** `--max_train_steps` des Laufs (src-tauri/src/commands/trainer.rs). */
+ steps: number
+ /** Was im Waehler steht. UI-Text, also englisch. */
+ label: string
+}
+
+export const TRAIN_PRESETS: TrainPreset[] = [
+ { steps: 400, label: 'Quick' },
+ { steps: 1200, label: 'Standard' },
+ { steps: 2400, label: 'Thorough' },
+]
+
+/**
+ * Die Voreinstellung. Muss der Voreinstellung des Trainers gleichen, die ohne
+ * Angabe greift (`steps.unwrap_or(1200)` in trainer.rs), sonst traegt eine
+ * Oberflaeche eine andere Zahl vor als der Lauf nimmt.
+ */
+export const TRAIN_STEPS_DEFAULT = 1200
+
+/** Die Stufe zu einer Schrittzahl, oder null fuer eine Zahl, die keine ist. */
+export function trainPresetLabel(steps: number): string | null {
+ return TRAIN_PRESETS.find((p) => p.steps === steps)?.label ?? null
+}
+
+/**
+ * Was im Hinweistext in der Klammer steht: die wirksame Zahl, und davor die
+ * Stufe, wenn es eine ist.
+ */
+export function trainStepsNote(steps: number): string {
+ const label = trainPresetLabel(steps)
+ return label ? `${label}, ${steps} steps` : `${steps} steps`
+}
diff --git a/src/stores/createStore.ts b/src/stores/createStore.ts
index 078bf608..4e393298 100644
--- a/src/stores/createStore.ts
+++ b/src/stores/createStore.ts
@@ -1,6 +1,7 @@
import { create } from 'zustand'
import { persist } from 'zustand/middleware'
import { safeJSONStorage } from '../lib/storage-quota'
+import { TRAIN_STEPS_DEFAULT } from '../lib/trainer-presets'
import { isRecord } from '../types/json-guards'
/**
@@ -520,7 +521,9 @@ export const useCreateStore = create<CreateState>()(
characterTab: 'train' as 'train' | 'use',
trainImages: [] as MediaRef[],
triggerWord: '',
- trainSteps: 1200,
+ // Dieselbe Zahl, die der Trainer ohne Angabe nimmt
+ // (`steps.unwrap_or(1200)`, trainer.rs), und die Stufe `Standard`.
+ trainSteps: TRAIN_STEPS_DEFAULT,
selectedCharacter: null as CharacterRef | null,
audioInput: null as MediaRef | null,
voiceFromJob: null as { jobId: string; label: string } | null,