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.

Keep trainer diagnostics readable during setup and reinstall

Davidd5f5b328ab4d
diff --git a/e2e/trainer-error-readable.spec.ts b/e2e/trainer-error-readable.spec.ts
new file mode 100644
index 00000000..a18bb6b6
--- /dev/null
+++ b/e2e/trainer-error-readable.spec.ts
@@ -0,0 +1,50 @@
+import { test, expect } from '@playwright/test'
+import { tauriMockInit, DEFAULT_ASSISTANT_REPLY, DEFAULT_MODEL_NAME } from './support/tauri-mock'
+import { routeCloud, seedOnboardingDone, cloudSwitch } from './support/cloud-mock'
+
+for (const ready of [false, true]) {
+ test(`trainer failure remains readable with environment ready=${ready}`, async ({ page }) => {
+ await page.addInitScript(tauriMockInit, {
+ assistantReply: DEFAULT_ASSISTANT_REPLY, modelName: DEFAULT_MODEL_NAME, platform: 'windows',
+ })
+ await page.addInitScript(({ ready }) => {
+ const bridge = (window as any).__TAURI_INTERNALS__
+ const invoke = bridge.invoke
+ bridge.invoke = async (cmd: string, args: unknown) => {
+ if (cmd === 'character_trainer_status') return {
+ envReady: ready, basesReady: ready, dit: null, textEncoder: null, vae: null,
+ root: 'C:\\test-trainer', install: { status: 'idle', logs: [] },
+ }
+ if (cmd === 'install_character_trainer') {
+ throw new Error(Array.from({ length: 80 }, (_, i) => `Diagnostic line ${i + 1}: setup failed.`).join('\n'))
+ }
+ return invoke(cmd, args)
+ }
+ }, { ready })
+ await seedOnboardingDone(page)
+ await routeCloud(page, { license: 'active', access: true, mediaLive: true })
+ await page.goto('/')
+ await expect(cloudSwitch(page)).toBeVisible()
+ await page.getByRole('button', { name: /^Create$/ }).click()
+ await page.getByRole('radio', { name: 'Character Studio', exact: true }).click()
+ await page.getByRole('button', { name: ready ? 'Reinstall trainer' : 'Set up trainer', exact: true }).click()
+ const note = page.getByRole('status').filter({ hasText: 'Diagnostic line 80' })
+ await expect(note).toBeVisible()
+ const result = await note.evaluate((el) => {
+ const style = getComputedStyle(el)
+ el.focus()
+ el.scrollTop = el.scrollHeight
+ const range = document.createRange()
+ range.selectNodeContents(el)
+ const selection = window.getSelection()!
+ selection.removeAllRanges()
+ selection.addRange(range)
+ return {
+ scrollable: el.scrollHeight > el.clientHeight && el.scrollTop > 0,
+ selectable: style.userSelect, focused: document.activeElement === el,
+ selectedEnd: selection.toString().includes('Diagnostic line 80: setup failed.'),
+ }
+ })
+ expect(result).toEqual({ scrollable: true, selectable: 'text', focused: true, selectedEnd: true })
+ })
+}
diff --git a/src/components/create/experimental/SpecialIntentControls.tsx b/src/components/create/experimental/SpecialIntentControls.tsx
index b8c4f21e..50933685 100644
--- a/src/components/create/experimental/SpecialIntentControls.tsx
+++ b/src/components/create/experimental/SpecialIntentControls.tsx
@@ -362,7 +362,7 @@ function LocalTrainControls() {
{busy === 'install' ? 'Setting up…' : 'Set up trainer'}
</Button>
</div>
- {note && <div className="t-label text-gray-600 max-w-[520px] text-center break-words">{note}</div>}
+ {note && <div role="status" tabIndex={0} className="text-xs leading-relaxed text-gray-600 max-w-[520px] max-h-40 overflow-y-auto select-text whitespace-pre-wrap text-center break-words">{note}</div>}
</div>
)
}
@@ -375,7 +375,7 @@ function LocalTrainControls() {
{busy === 'bases' ? 'Downloading…' : 'Download base files'}
</Button>
</div>
- {note && <div className="t-label text-gray-600 max-w-[520px] text-center break-words">{note}</div>}
+ {note && <div role="status" tabIndex={0} className="text-xs leading-relaxed text-gray-600 max-w-[520px] max-h-40 overflow-y-auto select-text whitespace-pre-wrap text-center break-words">{note}</div>}
</div>
)
}
@@ -421,6 +421,7 @@ function LocalTrainControls() {
</button>
</div>
)}
+ {note && <div role="status" tabIndex={0} className="text-xs leading-relaxed text-gray-600 max-w-[520px] max-h-40 overflow-y-auto select-text whitespace-pre-wrap text-center break-words">{note}</div>}
</div>
)
}
diff --git a/src/components/create/experimental/__tests__/die-notiz-wird-nicht-abgeschnitten.test.ts b/src/components/create/experimental/__tests__/die-notiz-wird-nicht-abgeschnitten.test.ts
index b36e0fca..8acaff53 100644
--- a/src/components/create/experimental/__tests__/die-notiz-wird-nicht-abgeschnitten.test.ts
+++ b/src/components/create/experimental/__tests__/die-notiz-wird-nicht-abgeschnitten.test.ts
@@ -11,14 +11,20 @@ describe('the note under the trainer buttons', () => {
const src = readFileSync(resolve(__dirname, '..', 'SpecialIntentControls.tsx'), 'utf8')
const notes = src.split('\n').filter((l) => l.includes('{note && <div'))
- it('exists under both setup buttons', () => {
- expect(notes).toHaveLength(2)
+ it('exists for setup, base download and reinstall', () => {
+ expect(notes).toHaveLength(3)
})
it('wraps instead of being cut after one line', () => {
for (const line of notes) {
expect(line).not.toContain('truncate')
expect(line).toContain('break-words')
+ expect(line).toContain('max-h-40')
+ expect(line).toContain('overflow-y-auto')
+ expect(line).toContain('select-text')
+ expect(line).toContain('whitespace-pre-wrap')
+ expect(line).toContain('tabIndex={0}')
+ expect(line).toContain('role="status"')
}
})
})