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(character): what the gates and the other specs showed

purple8cdc2b5d8a5c
diff --git a/dev-server/remote-stubs.ts b/dev-server/remote-stubs.ts
index 02c0ae82..8dadc2d3 100644
--- a/dev-server/remote-stubs.ts
+++ b/dev-server/remote-stubs.ts
@@ -96,7 +96,11 @@ export function registerRemoteStubs(routes: RouteMount): void {
// The chat's workflow tools (C60-S5): the fetch with its host allowlist and
// the node pack install by key are Rust; the tools say so before calling.
// Watchers: the clock, the list and the notification live in Rust.
+ // The LoRA folder of "New character" and a LoRA file dropped there (3.1.0):
+ // the folder, the file manager and the copy are Rust.
for (const path of [
+ '/local-api/character-lora-folder', '/local-api/character-lora-folder-open',
+ '/local-api/character-lora-import', '/local-api/character-lora-import-cancel',
'/local-api/watchers-list', '/local-api/watchers-create', '/local-api/watchers-update', '/local-api/watchers-delete',
'/local-api/watchers-run-now', '/local-api/watchers-finished', '/local-api/watchers-runner-ready',
'/local-api/watchers-dismiss-hint', '/local-api/watchers-notify',
diff --git a/e2e/character-hub.spec.ts b/e2e/character-hub.spec.ts
index 989a98d6..8c2b5835 100644
--- a/e2e/character-hub.spec.ts
+++ b/e2e/character-hub.spec.ts
@@ -268,7 +268,7 @@ test('one pill: the characters as tabs, the stage, and the bar switches the acti
expect(seen.submits).toHaveLength(0)
})
-test('Image runs on the character, More options keeps its file actions', async ({ page }) => {
+test('Image runs on the character, its file actions stand at the character', async ({ page }) => {
await boot(page, { hub: true })
await openCharacterHub(page)
await page.locator('[data-hub-character^="cloud:1111"]').click()
@@ -277,11 +277,10 @@ test('Image runs on the character, More options keeps its file actions', async (
// The prompt sits in the bar, like the chat's composer.
await expect(page.getByPlaceholder('Describe the scene for your character…')).toBeVisible()
await page.getByRole('button', { name: 'More options' }).click()
- const more = page.getByTestId('hub-more')
- await expect(more.locator('[data-character-file-actions]')).toBeVisible()
- await expect(more.getByTestId('character-download')).toBeVisible()
- // The same file actions stand at the character on the stage.
+ // The file actions stand at the character on the stage, once.
await expect(page.locator('[data-hub-card] [data-character-file-actions]')).toBeVisible()
+ await expect(page.getByRole('button', { name: 'Download character' })).toHaveCount(1)
+ await expect(page.getByTestId('hub-more').locator('[data-character-file-actions]')).toBeHidden()
})
test('without the account switch: Swap says coming soon, Motion has no sound choice', async ({ page }) => {
diff --git a/e2e/cloud-character-download.spec.ts b/e2e/cloud-character-download.spec.ts
index e1b59c5f..62251ee8 100644
--- a/e2e/cloud-character-download.spec.ts
+++ b/e2e/cloud-character-download.spec.ts
@@ -78,13 +78,12 @@ async function boot(page: Page, answer: Answer) {
await signInViaGate(page)
await expect(cloudSwitch(page)).toBeChecked({ timeout: 20_000 })
await page.getByRole('button', { name: /^Create$/ }).click()
- // The Character area: the character in step 1, Image in step 2, its file
- // actions under More options.
+ // The Character area: the character takes the stage, its file actions
+ // stand under its name on the left.
await openCharacterHub(page)
- await page.getByRole('button', { name: /Anna Müller/ }).click({ timeout: 15_000 })
- await page.getByRole('radio', { name: 'Character Studio', exact: true }).click()
- await page.getByRole('button', { name: 'More options' }).click()
- await expect(page.locator('[data-character-file-actions]')).toContainText('Anna Müller', { timeout: 15_000 })
+ await expect(page.getByRole('tab', { name: /Anna Müller/ })).toHaveAttribute('aria-selected', 'true', { timeout: 15_000 })
+ await expect(page.locator('[data-hub-card-name]')).toHaveText('Anna Müller')
+ await expect(page.locator('[data-hub-card] [data-character-file-actions]')).toBeVisible({ timeout: 15_000 })
return { fileAsked: () => fileAsked }
}
diff --git a/e2e/create-save-character.spec.ts b/e2e/create-save-character.spec.ts
index 474a2754..e7a0fdf5 100644
--- a/e2e/create-save-character.spec.ts
+++ b/e2e/create-save-character.spec.ts
@@ -88,7 +88,7 @@ test('frames across a video become a saved character that survives a reload', as
await dialog.getByRole('button', { name: 'Train in Character Studio' }).click()
await expect(dialog).toHaveCount(0)
await expect(characterPill(page)).toBeChecked()
- await expect(page.locator('[data-hub-head]')).toContainText('Train')
+ await expect(page.locator('[data-hub-training]')).toContainText('Train a model')
await expect(page.getByText(/^4\/30 photos\./)).toBeVisible()
// After a reload the character is still there (the boot script puts the app
diff --git a/e2e/mac-character-train.spec.ts b/e2e/mac-character-train.spec.ts
index 021163c8..972a8ade 100644
--- a/e2e/mac-character-train.spec.ts
+++ b/e2e/mac-character-train.spec.ts
@@ -94,12 +94,10 @@ test('mac with Z-Image Turbo: Train new trains the character locally and it land
expect(typeof start.raw.run).toBe('string')
// Through: the tab turns to Use, and the new character is on the shelf.
- // In the Character area: the panel turns to Image, and the new character
- // is in the list of the head line.
- await expect(page.getByRole('button', { name: 'Action' })).toContainText('Image', { timeout: 20_000 })
- await page.getByRole('button', { name: 'Character', exact: true }).click()
- await expect(page.getByRole('option', { name: /^luxfox/ })).toBeVisible({ timeout: 10_000 })
- await page.keyboard.press('Escape')
+ // In the Character area: the stage turns to Image, and the new character
+ // is one of its tabs.
+ await expect(page.getByRole('radio', { name: 'Character Studio', exact: true })).toHaveAttribute('aria-checked', 'true', { timeout: 20_000 })
+ await expect(page.getByRole('tab', { name: /^luxfox/ })).toBeVisible({ timeout: 10_000 })
await expect(page.getByText(/Training failed/)).toHaveCount(0)
// The Windows trainer and ComfyUI are never asked.
const names = await page.evaluate(() => ((window as unknown as { __TAURI_CALLS__?: Array<{ cmd: string }> }).__TAURI_CALLS__ ?? []).map((c) => c.cmd))
@@ -161,7 +159,7 @@ test('mac: frames of a video go through Use frames for a character into the Mac
await expect(dialog).toHaveCount(0)
// They land on the Train tab of the Mac, which trains them here.
- await expect(page.locator('[data-hub-head]')).toContainText('Train')
+ await expect(page.locator('[data-hub-training]')).toContainText('Train a model')
const controls = page.getByTestId('mac-train-controls')
await expect(controls).toContainText('7/100 photos', { timeout: 15_000 })
await controls.getByPlaceholder('Trigger word, e.g. davechar').fill('foxclip')
@@ -173,8 +171,7 @@ test('mac: frames of a video go through Use frames for a character into the Mac
for (const s of staged) expect(Number(s.raw.bytes)).toBeGreaterThan(100)
const [start] = await calls(page, 'mlx_train_start')
expect(start.raw).toMatchObject({ set: 'foxclip', trigger: 'foxclip' })
- // The new character is in the list of the head line of the Character area.
- await expect(page.getByRole('button', { name: 'Action' })).toContainText('Image', { timeout: 20_000 })
- await page.getByRole('button', { name: 'Character', exact: true }).click()
- await expect(page.getByRole('option', { name: /^foxclip/ })).toBeVisible({ timeout: 10_000 })
+ // The new character is one of the tabs of the stage of the Character area.
+ await expect(page.getByRole('radio', { name: 'Character Studio', exact: true })).toHaveAttribute('aria-checked', 'true', { timeout: 20_000 })
+ await expect(page.getByRole('tab', { name: /^foxclip/ })).toBeVisible({ timeout: 10_000 })
})
diff --git a/src-tauri/src/commands/character_files.rs b/src-tauri/src/commands/character_files.rs
index 25a7430d..16369476 100644
--- a/src-tauri/src/commands/character_files.rs
+++ b/src-tauri/src/commands/character_files.rs
@@ -517,7 +517,9 @@ pub(crate) fn take_piece(loras: &Path, name: &str, offset: u64, bytes: &[u8], la
/// `character_lora_folder`: where a character file lives on this machine,
/// `{status: "ok", path}`, or `{status: "no_comfy"}` when there is no LoRA
-/// folder (no ComfyUI found).
+/// folder (no ComfyUI found). Desktop only, like the page that asks: a
+/// phone has no LoRA folder.
+#[cfg(desktop)]
#[tauri::command]
pub fn character_lora_folder(state: tauri::State<'_, AppState>) -> serde_json::Value {
match local_loras_dir(state.inner()) {
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 293ddf18..3166a209 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -943,6 +943,7 @@ pub fn run() {
#[cfg(desktop)]
commands::character_files::import_cloud_character,
commands::character_files::character_photos,
+ #[cfg(desktop)]
commands::character_files::character_lora_folder,
#[cfg(desktop)]
commands::character_files::character_lora_folder_open,
diff --git a/src/api/backend.ts b/src/api/backend.ts
index e8c646da..c4c09c63 100644
--- a/src/api/backend.ts
+++ b/src/api/backend.ts
@@ -697,6 +697,13 @@ export async function backendCall<T = unknown>(
// The training photos of a local character live in the Rust process; the
// dev server answers 501 (dev-server/remote-stubs.ts).
character_photos: { path: "/local-api/character-photos", method: "POST" },
+ // The LoRA folder of this machine and a LoRA file dropped on "New
+ // character" (3.1.0) are the Rust process's too; the dev server answers
+ // 501 (dev-server/remote-stubs.ts), and the page asks only in the app.
+ character_lora_folder: { path: "/local-api/character-lora-folder", method: "POST" },
+ character_lora_folder_open: { path: "/local-api/character-lora-folder-open", method: "POST" },
+ character_lora_import: { path: "/local-api/character-lora-import", method: "POST" },
+ character_lora_import_cancel: { path: "/local-api/character-lora-import-cancel", method: "POST" },
// The GGUF file dialog of the Model Manager is native (D17); the dev
// server answers 501 (dev-server/remote-stubs.ts).
pick_gguf_file: { path: "/local-api/pick-gguf-file", method: "POST" },
diff --git a/src/components/create/experimental/SpecialIntentControls.tsx b/src/components/create/experimental/SpecialIntentControls.tsx
index eddc39ed..8de3b63d 100644
--- a/src/components/create/experimental/SpecialIntentControls.tsx
+++ b/src/components/create/experimental/SpecialIntentControls.tsx
@@ -1986,7 +1986,10 @@ export function SwapControls({ oneClick }: {
* further, in the settings drawer (CharacterHub links it). */
export function SpecialMore({ intent }: { intent: CreateIntent }) {
if (intent === 'swap_character') return <SwapMore />
- if (intent === 'character') return <CharacterMore />
+ // On the stage the file actions stand at the character on the left. That
+ // column is gone on a phone-wide window (index.css, .hub-card), so there
+ // they stay here.
+ if (intent === 'character') return <div className="min-[701px]:hidden"><CharacterMore /></div>
return null
}
diff --git a/src/components/create/experimental/__tests__/character-stage.test.tsx b/src/components/create/experimental/__tests__/character-stage.test.tsx
index 320660cd..644200fe 100644
--- a/src/components/create/experimental/__tests__/character-stage.test.tsx
+++ b/src/components/create/experimental/__tests__/character-stage.test.tsx
@@ -14,7 +14,7 @@ import { render, cleanup, screen, fireEvent, waitFor } from '@testing-library/re
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
-const io = vi.hoisted(() => ({ folder: { status: 'ok', path: '/Users/dave/Library/Application Support/lu-labs/loras' } as { status: string; path?: string } | null, opened: 0, imported: [] as string[] }))
+const io = vi.hoisted(() => ({ folder: { status: 'ok', path: '/Users/me/Library/Application Support/lu-labs/loras' } as { status: string; path?: string } | null, opened: 0, imported: [] as string[] }))
vi.mock('../../../../api/backend', async (orig) => ({ ...(await orig<typeof import('../../../../api/backend')>()), isTauri: () => true }))
vi.mock('../../../../lib/create/character-lora', async (orig) => ({
...(await orig<typeof import('../../../../lib/create/character-lora')>()),
@@ -39,7 +39,7 @@ const hub = (ui: React.ReactElement) => render(<div className="lu-hub">{ui}</div
beforeEach(() => {
__resetSavedCharacters()
useCharacterNames.setState({ names: {} })
- io.folder = { status: 'ok', path: '/Users/dave/Library/Application Support/lu-labs/loras' }
+ io.folder = { status: 'ok', path: '/Users/me/Library/Application Support/lu-labs/loras' }
io.opened = 0
io.imported = []
let n = 0
@@ -115,7 +115,7 @@ describe('New character', () => {
const { container } = page()
const path = await waitFor(() => { const el = container.querySelector('[data-hub-lora-path]'); if (!el) throw new Error('no path yet'); return el })
expect(path.textContent).toBe('~/Library/Application Support/lu-labs/loras')
- expect(path.getAttribute('title')).toBe('/Users/dave/Library/Application Support/lu-labs/loras')
+ expect(path.getAttribute('title')).toBe('/Users/me/Library/Application Support/lu-labs/loras')
fireEvent.click(screen.getByRole('button', { name: 'Open LoRA folder' }))
await waitFor(() => expect(io.opened).toBe(1))
})
diff --git a/src/components/create/experimental/hub/CharacterHub.tsx b/src/components/create/experimental/hub/CharacterHub.tsx
index 7f7e3619..31ceba81 100644
--- a/src/components/create/experimental/hub/CharacterHub.tsx
+++ b/src/components/create/experimental/hub/CharacterHub.tsx
@@ -14,7 +14,7 @@
// The inner intent ids and the panels of the actions are untouched
// (lib/create/character-hub.ts): an action is still a name for an intent.
-import { useEffect, type ReactNode } from 'react'
+import { useEffect, useState, type ReactNode } from 'react'
import { ChevronLeft, Film, X } from 'lucide-react'
import { useCreateStore, type CreateIntent } from '../../../../stores/createStore'
import { useUIStore, type CloudTeaserTarget } from '../../../../stores/uiStore'
@@ -40,6 +40,9 @@ import { HubActions, HubCard, HubPhotos, HubTabs, type HubActionState } from './
import { SwapOneClick, useSwapOneClickShown } from './SwapOneClick'
import { openHubAction, useCharacterPhotos, useHubCharacters } from './hubCharacters'
+/** How long the first page waits for the list before it shows itself. */
+const LIST_GRACE_MS = 1500
+
type TeaserIntent = Extract<CloudTeaserTarget, { surface: 'intent' }>['intent']
interface Props {
@@ -82,6 +85,25 @@ export function CharacterHub({ stage, onOpenAdvanced, onOpenWorkflows, onOpenGal
}
}, [step, first, setHubCharacter, setHubStep])
+ // Image opened from outside the stage (a training that just finished, a
+ // Reuse from the gallery) runs on a character nobody picked here: that
+ // character takes the stage, so the left says who the picture will show.
+ const running = useCreateStore((s) => s.selectedCharacter)
+ const runningOnStage = action === 'image' && !picked && running ? list.find((c) => c.ref?.id === running.id) : undefined
+ useEffect(() => {
+ if (runningOnStage) setHubCharacter(runningOnStage)
+ }, [runningOnStage, setHubCharacter])
+
+ // A list that is slow to answer (the cloud does not reach us) holds the
+ // first page back for a moment only, so nobody with characters sees it
+ // flash, and nobody without a connection waits for it.
+ const [waited, setWaited] = useState(false)
+ useEffect(() => {
+ if (step !== 'who' || !loading) return
+ const t = setTimeout(() => setWaited(true), LIST_GRACE_MS)
+ return () => clearTimeout(t)
+ }, [step, loading])
+
const pick = (c: HubCharacter | null) => {
setHubCharacter(c)
if (step === 'panel' && action) {
@@ -122,7 +144,7 @@ export function CharacterHub({ stage, onOpenAdvanced, onOpenWorkflows, onOpenGal
</div>
)
} else if (step === 'who') {
- body = loading
+ body = loading && !waited
? <p className="hub-dim py-6 hub-fs-13" data-hub-step="who">Loading your characters…</p>
: <HubEmpty onCreate={() => setHubStep('new')} onTry={(a) => { setHubCharacter(null); pickAction(a) }} />
} else {
diff --git a/src/components/create/experimental/hub/HubNewCharacter.tsx b/src/components/create/experimental/hub/HubNewCharacter.tsx
index 9cf4ed97..192e22f6 100644
--- a/src/components/create/experimental/hub/HubNewCharacter.tsx
+++ b/src/components/create/experimental/hub/HubNewCharacter.tsx
@@ -190,7 +190,7 @@ export function HubNewCharacter({ onBack, onSaved, onOpenGallery }: Props) {
className={cn('hub-drop flex min-h-16 cursor-pointer items-center gap-3 px-4 hub-fs-14', over && 'hub-drop--over')}
data-hub-drop
>
- <Upload size={17} className="hub-dim shrink-0" />
+ <Upload size={16} className="hub-dim shrink-0" />
<span className="hub-muted min-w-0 flex-1">
<span className="hub-text font-medium">{desktop ? 'Drop photos or a LoRA file here' : 'Drop photos here'}</span>, or choose files
</span>
@@ -225,7 +225,7 @@ export function HubNewCharacter({ onBack, onSaved, onOpenGallery }: Props) {
title="Remove this photo"
aria-label={`Remove photo ${i + 1}`}
>
- <X size={10} strokeWidth={2.4} />
+ <X size={10} />
</button>
</li>
))}
@@ -245,11 +245,11 @@ export function HubNewCharacter({ onBack, onSaved, onOpenGallery }: Props) {
{!lora && (
<div className="hub-line mt-5 grid grid-cols-2 gap-6 border-t pt-3.5 hub-fs-13">
<ul className="hub-muted space-y-1">
- <li className="hub-text mb-1.5 flex items-center gap-1.5 font-medium"><Check size={13} strokeWidth={2.2} className="text-emerald-500 dark:text-emerald-300" />Good</li>
+ <li className="hub-text mb-1.5 flex items-center gap-1.5 font-medium"><Check size={13} className="text-emerald-500 dark:text-emerald-300" />Good</li>
{GOOD.map((t) => <li key={t}>{t}</li>)}
</ul>
<ul className="hub-muted space-y-1">
- <li className="hub-text mb-1.5 flex items-center gap-1.5 font-medium"><X size={13} strokeWidth={2.2} className="text-red-500 dark:text-red-300" />Avoid</li>
+ <li className="hub-text mb-1.5 flex items-center gap-1.5 font-medium"><X size={13} className="text-red-500 dark:text-red-300" />Avoid</li>
{AVOID.map((t) => <li key={t}>{t}</li>)}
</ul>
</div>
diff --git a/src/components/create/experimental/hub/HubStage.tsx b/src/components/create/experimental/hub/HubStage.tsx
index f9f24697..b7d36675 100644
--- a/src/components/create/experimental/hub/HubStage.tsx
+++ b/src/components/create/experimental/hub/HubStage.tsx
@@ -93,7 +93,7 @@ function Portrait({ c, photo }: { c: HubCharacter | null; photo: string | null }
}
return (
<span className="hub-portrait hub-portrait--none hub-dim" aria-hidden>
- {c ? <span className="hub-initial">{hubInitial(c.name)}</span> : <ImagePlus size={30} strokeWidth={1.4} />}
+ {c ? <span className="hub-initial">{hubInitial(c.name)}</span> : <ImagePlus size={28} />}
</span>
)
}
@@ -110,11 +110,11 @@ function Card({ c, photo }: { c: HubCharacter | null; photo: string | null }) {
if (!c) {
return (
- <aside className="hub-card" data-hub-card="photo">
+ <div className="hub-card" data-hub-card="photo">
<Portrait c={null} photo={null} />
<h2 className="hub-text hub-fs-20 font-semibold">{HUB_JUST_PHOTO}</h2>
<p className="hub-muted mt-1 hub-fs-13">{HUB_JUST_PHOTO_LINE}</p>
- </aside>
+ </div>
)
}
@@ -132,7 +132,7 @@ function Card({ c, photo }: { c: HubCharacter | null; photo: string | null }) {
}
return (
- <aside className="hub-card" data-hub-card={c.key}>
+ <div className="hub-card" data-hub-card={c.key}>
<Portrait c={c} photo={photo} />
{renaming ? (
<RenameField c={c} onDone={() => setRenaming(false)} />
@@ -162,7 +162,7 @@ function Card({ c, photo }: { c: HubCharacter | null; photo: string | null }) {
{c.kind === 'local' && (
<p className="hub-dim hub-line mt-4 border-t pt-3 hub-fs-125">In Chat, name it: “a picture of {c.ref?.name ?? c.name} at the beach”.</p>
)}
- </aside>
+ </div>
)
}
diff --git a/src/lib/create/__tests__/character-lora.test.ts b/src/lib/create/__tests__/character-lora.test.ts
index c3c30ae5..7eb1c5ef 100644
--- a/src/lib/create/__tests__/character-lora.test.ts
+++ b/src/lib/create/__tests__/character-lora.test.ts
@@ -27,7 +27,7 @@ describe('the file and its folder', () => {
})
it('shortens the home folder, and leaves a Windows path alone', () => {
- expect(shortFolder('/Users/dave/Library/Application Support/lu-labs/loras')).toBe('~/Library/Application Support/lu-labs/loras')
+ expect(shortFolder('/Users/me/Library/Application Support/lu-labs/loras')).toBe('~/Library/Application Support/lu-labs/loras')
expect(shortFolder('D:\\ComfyUI\\models\\loras')).toBe('D:\\ComfyUI\\models\\loras')
})