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): local character training takes up to 100 photos
purple67363b325b3d
diff --git a/src/components/create/experimental/Composer.tsx b/src/components/create/experimental/Composer.tsxindex 9f9e0849..002cbd94 100644--- a/src/components/create/experimental/Composer.tsx+++ b/src/components/create/experimental/Composer.tsx@@ -348,7 +348,7 @@ export function Composer({ onOpenAdvanced, onOpenWorkflows }: Props) {background"). */}{showNoPromptHint && !needsMask && (<div className="px-3.5 py-3 t-body text-gray-500">- {noPromptHint(meta.id)}+ {noPromptHint(meta.id, backend)}</div>)}{needsMask && !needPrompt && !isGenerating && (diff --git a/src/components/create/experimental/SpecialIntentControls.tsx b/src/components/create/experimental/SpecialIntentControls.tsxindex aa7b82c7..75a1411d 100644--- a/src/components/create/experimental/SpecialIntentControls.tsx+++ b/src/components/create/experimental/SpecialIntentControls.tsx@@ -37,6 +37,7 @@ import { Slider } from '../ui/Slider'import { cn } from '../ui/cn'import { useClickAway } from '../ui/useClickAway'import { Modal } from '../../ui/Modal'+import { MIN_TRAIN_IMAGES, maxTrainImages } from '../../../lib/train-image-cap'export function SpecialControls({ intent }: { intent: CreateIntent }) {switch (intent) {@@ -198,7 +199,7 @@ function CharacterPanel() {className="t-control w-44 px-2.5 h-[var(--control-h-sm)] rounded-md bg-white/[0.03] border border-white/[0.06] text-gray-200 placeholder-gray-600 focus:outline-none focus:border-white/15"/><span className="t-label text-gray-600">- {trainImages.length}/30 photos added{trainImages.length < 4 ? ', need at least 4' : ''}+ {trainImages.length}/{maxTrainImages(backend)} photos added{trainImages.length < MIN_TRAIN_IMAGES ? `, need at least ${MIN_TRAIN_IMAGES}` : ''}</span></div>) : (@@ -571,7 +572,7 @@ function LocalTrainControls() {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' : ''}+ {trainImages.length}/{maxTrainImages('local')} photos{trainImages.length < MIN_TRAIN_IMAGES ? `, need at least ${MIN_TRAIN_IMAGES}` : ''}</span></div>{!isGenerating && (diff --git a/src/components/create/experimental/Stage.tsx b/src/components/create/experimental/Stage.tsxindex 6d5f41e4..1f8b30b2 100644--- a/src/components/create/experimental/Stage.tsx+++ b/src/components/create/experimental/Stage.tsx@@ -21,6 +21,7 @@ import { InstallCancelled } from '../../../lib/bundle-install'import { isMlxImageHost } from '../../../api/mlx-image'import { bundleForVideoIntent } from '../../../api/comfyui'import { getVideoBundles } from '../../../api/discover'+import { MIN_TRAIN_IMAGES, maxTrainImages } from '../../../lib/train-image-cap'interface Props {displayed?: GalleryItem@@ -642,7 +643,7 @@ function TrainSetBoard() {className="flex-1 rounded-xl border-2 border-dashed border-white/10 hover:border-white/25 transition-colors flex flex-col items-center justify-center gap-2 text-gray-500 hover:text-gray-300"><UploadCloud size={28} />- <div className="t-body">Drop 4 to 30 photos of your character here</div>+ <div className="t-body">Drop {MIN_TRAIN_IMAGES} to {maxTrainImages(backend)} photos of your character here</div><div className="t-label text-gray-600">One person or character, varied angles and lighting works best</div>@@ -675,7 +676,7 @@ function TrainSetBoard() {</div></div><div className="t-label text-gray-500 text-center shrink-0">- {trainImages.length}/30 photos. {backend === 'cloud'+ {trainImages.length}/{maxTrainImages(backend)} photos. {backend === 'cloud'? 'Training runs in the cloud and lands the character on your shelf.': 'Training runs on your GPU and lands the character in your local LoRAs.'}</div>diff --git a/src/components/create/experimental/__tests__/das-trainingsset-gibt-seine-blobs-zurueck.test.ts b/src/components/create/experimental/__tests__/das-trainingsset-gibt-seine-blobs-zurueck.test.tsindex 9c88825b..53daf520 100644--- a/src/components/create/experimental/__tests__/das-trainingsset-gibt-seine-blobs-zurueck.test.ts+++ b/src/components/create/experimental/__tests__/das-trainingsset-gibt-seine-blobs-zurueck.test.ts@@ -74,13 +74,21 @@ describe('das Trainingsset gibt seine Blob-URLs zurück', () => {expect(live.size).toBe(1)})- it('was die 30er-Kappe abschneidet, gibt seine Datei frei', () => {+ it('was die Cloud-Kappe (30) abschneidet, gibt seine Datei frei', () => {// Diese Grenze hat gar keine UI: der Schnitt passiert still.+ useCreateStore.setState({ backend: 'cloud' })drop(...Array.from({ length: 34 }, (_, i) => `f${i}.png`))expect(useCreateStore.getState().trainImages).toHaveLength(30)expect(live.size).toBe(30)})+ it('lokal liegt die Kappe bei 100 (GH #121), und auch dort wird frei, was sie abschneidet', () => {+ useCreateStore.setState({ backend: 'local' })+ drop(...Array.from({ length: 104 }, (_, i) => `f${i}.png`))+ expect(useCreateStore.getState().trainImages).toHaveLength(100)+ expect(live.size).toBe(100)+ })+it('das Leeren des Sets gibt jede Datei zurück, die es hielt', () => {// `useCloudCreate` ruft clearTrainImages nach jedem abgeschickten// Trainingslauf — vorher blieb dabei der komplette Satz im Speicher.diff --git a/src/components/create/experimental/__tests__/laneHint.test.ts b/src/components/create/experimental/__tests__/laneHint.test.tsindex b6f1c0e6..2a79a774 100644--- a/src/components/create/experimental/__tests__/laneHint.test.ts+++ b/src/components/create/experimental/__tests__/laneHint.test.ts@@ -68,7 +68,9 @@ describe('noPromptHint', () => {it('names the inputs each lane is waiting for', () => {expect(noPromptHint('motion')).toContain('driving dance/pose video')expect(noPromptHint('lipsync')).toContain('voice')- expect(noPromptHint('character')).toContain('4 to 30 photos')+ // GH #121: the local trainer takes 100, the cloud job API 30.+ expect(noPromptHint('character', 'local')).toContain('4 to 100 photos')+ expect(noPromptHint('character', 'cloud')).toContain('4 to 30 photos')})it('keeps the eraser on its own line instead of the cutout default', () => {diff --git a/src/components/create/experimental/laneHint.ts b/src/components/create/experimental/laneHint.tsindex 69677208..2ab4b57e 100644--- a/src/components/create/experimental/laneHint.ts+++ b/src/components/create/experimental/laneHint.ts@@ -6,7 +6,8 @@// both chips were filled and the sampler was already counting steps. The// caption was rendered on `!needsPrompt` alone, so it never reacted to anything// the user did.-import type { CreateIntent } from '../../../stores/createStore'+import type { CreateBackend, CreateIntent } from '../../../stores/createStore'+import { MIN_TRAIN_IMAGES, maxTrainImages } from '../../../lib/train-image-cap'/** Captions that name the inputs a lane is waiting for. These go stale the* moment the chips are filled, so they hide once the lane reports ready. */@@ -16,14 +17,14 @@ const INPUT_HINT_INTENTS: ReadonlySet<CreateIntent> =/** Caption for prompt-less intents so each reads honestly (the old copy said* "remove the background" for every one of them — misleading the eraser into* a guaranteed "Paint a mask first" error). */-export function noPromptHint(id: CreateIntent): string {+export function noPromptHint(id: CreateIntent, backend: CreateBackend = 'local'): string {switch (id) {case 'upscale':return 'No prompt needed. Just hit Create to enhance the image.'case 'eraser':return 'No prompt needed. Paint a mask over the object to remove, then hit Create.'case 'character':- return 'Add 4 to 30 photos of one person or character above, pick a trigger word, then hit Create to train.'+ return `Add ${MIN_TRAIN_IMAGES} to ${maxTrainImages(backend)} photos of one person or character above, pick a trigger word, then hit Create to train.`case 'lipsync':return 'Add the portrait (or clip) and a voice above, then hit Create to make it speak.'case 'motion':diff --git a/src/hooks/useCloudCreate.ts b/src/hooks/useCloudCreate.tsindex 7b2a64e4..ac9cc640 100644--- a/src/hooks/useCloudCreate.ts+++ b/src/hooks/useCloudCreate.ts@@ -40,6 +40,7 @@ import { STUDIO_MODELS, studioFields } from '../lib/render/studio-contract'import { modelLabel } from '../lib/render/preset-models'import { bookedVideoSeconds } from '../lib/render/video-duration'import { studioQuote, StudioQuoteChangedError } from '../api/cloud/studio'+import { MIN_TRAIN_IMAGES, maxTrainImages } from '../lib/train-image-cap'// B3 (review-w2ui.md, 18.09.2026): the CSAM floor above runs regardless of// tier, but the adult half of safety.ts (ADULT_SOFT_TERMS/ADULT_HARD_TERMS)@@ -284,8 +285,14 @@ export function useCloudCreate(opts: { onQuotaChange?: () => void } = {}) {s.setError('This character has no compatible generation model yet.')return}- if (op === 'lora-train' && s.trainImages.length < 4) {- s.setError('Add at least 4 photos of your character (more is better, up to 30).')+ if (op === 'lora-train' && s.trainImages.length < MIN_TRAIN_IMAGES) {+ s.setError(`Add at least ${MIN_TRAIN_IMAGES} photos of your character (more is better, up to ${maxTrainImages('cloud')}).`)+ return+ }+ // Staged locally, where the limit is higher, then switched to Cloud: the+ // job API refuses more than its cap, so say how many to remove first.+ if (op === 'lora-train' && s.trainImages.length > maxTrainImages('cloud')) {+ s.setError(`Cloud training takes up to ${maxTrainImages('cloud')} photos. Remove ${s.trainImages.length - maxTrainImages('cloud')} and try again.`)return}// A Studio pick names its own required inputs (studio-contract.ts'sdiff --git a/src/lib/train-image-cap.ts b/src/lib/train-image-cap.tsnew file mode 100644index 00000000..fa3a1dc2--- /dev/null+++ b/src/lib/train-image-cap.ts@@ -0,0 +1,19 @@+/** Fewer photos than this give the trainer nothing to generalise from. */+export const MIN_TRAIN_IMAGES = 4++/**+ * How many photos one character training run takes.+ *+ * The cloud job API caps `image_paths` at 30 (apps/web/app/api/jobs). The+ * local trainer has no such cap: it sizes the repeats from the photo count+ * against a fixed step goal (commands/trainer.rs), so more photos mean more+ * variety for the same run length. Z0mbieK (GH #121, 2026-09-22) had more+ * than 30 and asked to use them; 100 keeps the staged set, held as blobs in+ * memory, well inside what a desktop handles.+ *+ * The parameter is createStore's CreateBackend, spelled out so this file+ * does not import the store that imports it.+ */+export function maxTrainImages(backend: 'local' | 'cloud'): number {+ return backend === 'cloud' ? 30 : 100+}diff --git a/src/stores/createStore.ts b/src/stores/createStore.tsindex 016637fe..41b2d1a7 100644--- a/src/stores/createStore.ts+++ b/src/stores/createStore.ts@@ -1,4 +1,5 @@import { create } from 'zustand'+import { maxTrainImages } from '../lib/train-image-cap'import type { FixupPrompt } from '../lib/render-fixups'import { persist } from 'zustand/middleware'import { safeJSONStorage } from '../lib/storage-quota'@@ -818,7 +819,7 @@ export const useCreateStore = create<CreateState>()(setGrowMaskBy: (n) => set({ growMaskBy: Math.max(0, Math.min(64, Math.floor(n))) }),setTargetResolution: (targetResolution) => set({ targetResolution }),setCharacterTab: (characterTab) => set({ characterTab }),- // Cap at 30 (the server's image_paths limit) and de-dupe by filename so+ // Cap at the backend's photo limit (lib/train-image-cap) and de-dupe by filename so// a re-drop of the same files doesn't double the set. Both of those// THROW REFS AWAY — the caller minted a blob: URL for every file it// handed over, including the ones landing in the dedupe and the ones@@ -827,7 +828,7 @@ export const useCreateStore = create<CreateState>()(addTrainImages: (imgs) => {const before = get().trainImagesconst have = new Set(before.map((i) => i.name))- const trainImages = [...before, ...imgs.filter((i) => !have.has(i.name))].slice(0, 30)+ const trainImages = [...before, ...imgs.filter((i) => !have.has(i.name))].slice(0, maxTrainImages(get().backend))releaseDroppedMediaRefs([...before, ...imgs], trainImages)set({ trainImages })},