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.

feat(neuron): say how long a slider takes before it starts, and show the run moving

purple3616bcbd041c
diff --git a/src/components/neuron/NeuronView.tsx b/src/components/neuron/NeuronView.tsx
index 351ca659..54a93c1f 100644
--- a/src/components/neuron/NeuronView.tsx
+++ b/src/components/neuron/NeuronView.tsx
@@ -17,7 +17,7 @@ import { preservedSwapCtx } from '../../lib/builtin-ctx'
import { builtinModelMatches } from '../../lib/builtin-model-identity'
import {
backendNote, effectiveStrengths, entriesFor, hasPersonaProfile,
- clampStrength, steeringPersona, strengthWarning, tweakedModelNote, warningText, type BackendKind, type Strengths,
+ clampStrength, steeringPersona, strengthWarning, tweakedModelNote, buildTimeNote, warningText, type BackendKind, type Strengths,
} from '../../lib/neuron'
import { featureVectorId, neuronVectorId, recipeOwnId, type Recipe, type RecipeEntry } from '../../lib/neuron-recipe'
import { editingKey, useNeuronStore } from '../../stores/neuronStore'
@@ -26,7 +26,7 @@ import { useChatStore } from '../../stores/chatStore'
import { useSettingsStore } from '../../stores/settingsStore'
import { useUIStore } from '../../stores/uiStore'
import type { BuiltinEngineTuning } from '../../types/settings'
-import { JobPanel, ScopeButton, SliderRow, StepCard, TweakedNote, WayIntro, WayTabs, signedValue } from './parts'
+import { JobPanel, ScopeButton, SliderRow, StepCard, TimeNote, TweakedNote, WayIntro, WayTabs, signedValue } from './parts'
import { ComparePanel, CoordinatesPanel, FeaturePanel, OwnSliderForm, SharePanel, entryState, type NeuronInfoPlus } from './panels'
import { NeuronIntroHost } from './NeuronIntro'
import { useNeuronIntroRequest } from '../../stores/neuronIntroStore'
@@ -318,6 +318,12 @@ export function NeuronView() {
// A model changed before (fine-tune, merge, heretic …): say so before
// computing, and offer its original in Discover (David, 31.10.2026).
const tweak = info ? tweakedModelNote(info.facts) : null
+ // How long one slider takes, said before it starts (P11 5b67ef9fe): on the
+ // ways that compute, while something there still needs it, not while a
+ // job runs (its own line counts down then).
+ const estimate = way === 'own' ? info?.ownEstimate : way === 'ready' || way === 'coords' ? info?.buildEstimate : undefined
+ const needsCompute = way === 'own' || presets.some((p) => !vectors.some((x) => x.id === p.id))
+ const timeNote = estimate && info?.generator && needsCompute && !running ? buildTimeNote(estimate) : null
const original = info?.facts.original ?? null
const getOriginal = () => {
if (!original) return
@@ -401,6 +407,7 @@ export function NeuronView() {
>
{error && <Hinweis ton="fehler" className="mb-3" onDismiss={() => setError(null)}>{error}</Hinweis>}
{tweak && <TweakedNote title={tweak.title} text={tweak.text} original={tweak.original} onGetOriginal={getOriginal} />}
+ {timeNote && <TimeNote title={timeNote.title} text={timeNote.text} />}
{job && job.status !== 'idle' && <JobPanel job={job} onStop={() => { setQueue([]); void neuronCancel().then(poll) }} onDismiss={() => void neuronDismiss().then(poll)} onGetOriginal={getOriginal} original={original} />}
{queue.length > 0 && <p className={`t-micro ${HINWEIS_TEXT.ruhig} mb-3`} data-testid="neuron-queue">{queue.length} more to prepare from the recipe, one after the other.</p>}
{info && !info.generator && (
@@ -436,6 +443,7 @@ export function NeuronView() {
disabled={running || !modelPath || (!v && !info?.generator)}
onCompute={() => void startJob(() => neuronBuildPreset(modelPath, p.id))}
onChange={(x) => move(p.id, x)}
+ prepareHint={timeNote ? 'Once per model. How long it takes is said above.' : undefined}
/>
))}
</div>
diff --git a/src/components/neuron/__tests__/neurons-for-beginners.test.tsx b/src/components/neuron/__tests__/neurons-for-beginners.test.tsx
index e7d92dde..2f32fead 100644
--- a/src/components/neuron/__tests__/neurons-for-beginners.test.tsx
+++ b/src/components/neuron/__tests__/neurons-for-beginners.test.tsx
@@ -19,7 +19,8 @@ const apply = vi.fn(async (_path: string, _entries: unknown[], _tuning?: unknown
const buildPreset = vi.fn(async (_path: string, _id: string) => ({ started: true }))
const buildOwn = vi.fn(async (..._a: unknown[]) => ({ started: true }))
const vectors: Array<Record<string, unknown>> = []
-const job = vi.hoisted(() => ({ status: 'idle', error: null as string | null }))
+const job = vi.hoisted(() => ({ status: 'idle', error: null as string | null, kind: '', phaseLabel: '', step: 0, total: 0, etaSecs: null as number | null, elapsedSecs: 0 }))
+const est = vi.hoisted(() => ({ build: { lowSecs: 4, highSecs: 30, measured: false }, own: { lowSecs: 6, highSecs: 45, measured: false } }))
const facts = vi.hoisted(() => ({ tweaked: [] as string[], original: null as string | null }))
vi.mock('../../../api/neuron', () => ({
@@ -31,8 +32,9 @@ vi.mock('../../../api/neuron', () => ({
neuronInfo: async () => ({
facts: { arch: 'qwen2', nLayer: 24, nEmbd: 896, template: 'chatMl', name: 'Qwen2.5 0.5B Instruct', tweaked: [...facts.tweaked], original: facts.original },
modelKey: 'qwen-1', generator: true, band: [3, 20], vectors: [...vectors], sae: null, activeMix: null,
+ buildEstimate: { ...est.build }, ownEstimate: { ...est.own },
}),
- neuronStatus: async () => ({ status: job.status, kind: '', title: 'Computing', modelPath: '/models/qwen.gguf', phaseLabel: '', step: 0, total: 0, bytesDone: 0, bytesTotal: 0, rateBps: 0, etaSecs: null, elapsedSecs: 0, resultId: null, error: job.error, logs: [] }),
+ neuronStatus: async () => ({ status: job.status, kind: job.kind, title: 'Computing', modelPath: '/models/qwen.gguf', phaseLabel: job.phaseLabel, step: job.step, total: job.total, bytesDone: 0, bytesTotal: 0, rateBps: 0, etaSecs: job.etaSecs, elapsedSecs: job.elapsedSecs, resultId: null, error: job.error, logs: [] }),
neuronApply: (p: string, e: unknown[], t?: unknown) => apply(p, e, t),
neuronBuildPreset: (p: string, id: string) => buildPreset(p, id),
neuronBuildOwn: (...a: unknown[]) => buildOwn(...a),
@@ -63,8 +65,9 @@ beforeEach(() => {
buildPreset.mockClear()
buildOwn.mockClear()
vectors.length = 0
- job.status = 'idle'
- job.error = null
+ Object.assign(job, { status: 'idle', error: null, kind: '', phaseLabel: '', step: 0, total: 0, etaSecs: null, elapsedSecs: 0 })
+ est.build = { lowSecs: 4, highSecs: 30, measured: false }
+ est.own = { lowSecs: 6, highSecs: 45, measured: false }
facts.tweaked = []
facts.original = null
useNeuronStore.setState({ profiles: {}, scopeByModel: {}, introSeen: true })
@@ -282,3 +285,56 @@ describe('tweaked models', () => {
expect((await within(ended).findByTestId('neuron-get-original-failed')).textContent).toBe('Get the original: Qwen3.5 9B')
})
})
+
+// P11 5b67ef9fe, I1 on the box 31.10.2026: one slider took ~25 min on
+// Windows and nothing said so. Say the time before, show it moving during.
+describe('how long it takes', () => {
+ it('says the time before computing on a slow PC, on the ways that compute', async () => {
+ est.build = { lowSecs: 720, highSecs: 3000, measured: false }
+ est.own = { lowSecs: 1500, highSecs: 5400, measured: true }
+ render(createElement(NeuronView))
+ const note = await screen.findByTestId('neuron-time-note')
+ expect(note.textContent).toMatch(/^This takes a while on this PC/)
+ expect(note.textContent).toMatch(/Expect about 12–50 min for one slider\./)
+ // Above the ways, next to the original note; the row points up to it.
+ expect(note.compareDocumentPosition(screen.getByTestId('neuron-way-ready')) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()
+ expect(within(screen.getByTestId('neuron-slider-creative')).getByText('Once per model. How long it takes is said above.')).toBeTruthy()
+ fireEvent.click(screen.getByTestId('neuron-way-own'))
+ expect(screen.getByTestId('neuron-time-note').textContent).toMatch(/25 min to 1 h 30 min.*last run on this PC/)
+ fireEvent.click(screen.getByTestId('neuron-way-features'))
+ expect(screen.queryByTestId('neuron-time-note')).toBeNull()
+ })
+
+ it('says nothing where it is a moment, or nothing is left to compute', async () => {
+ render(createElement(NeuronView))
+ await screen.findByTestId('neuron-slider-creative')
+ expect(screen.queryByTestId('neuron-time-note')).toBeNull()
+ expect(within(screen.getByTestId('neuron-slider-creative')).getByText('Once per model, seconds to a few minutes.')).toBeTruthy()
+ cleanup()
+ est.build = { lowSecs: 720, highSecs: 3000, measured: false }
+ vectors.push(CHEERFUL, { ...CHEERFUL, id: 'creative' }, { ...CHEERFUL, id: 'detailed' })
+ render(createElement(NeuronView))
+ await screen.findByTestId('neuron-slider-creative')
+ expect(screen.queryByTestId('neuron-time-note')).toBeNull()
+ })
+
+ it('shows the run moving: a waiting bar before the first example, then examples, time left and time so far', async () => {
+ est.build = { lowSecs: 720, highSecs: 3000, measured: false }
+ Object.assign(job, { status: 'running', kind: 'build', phaseLabel: 'Loading the model', elapsedSecs: 20 })
+ render(createElement(NeuronView))
+ await screen.findByTestId('neuron-job-waiting')
+ expect(screen.getByTestId('neuron-job-progress').textContent).toBe('running for 20 s')
+ // The job counts down itself; the note before the start is gone.
+ expect(screen.queryByTestId('neuron-time-note')).toBeNull()
+ cleanup()
+ Object.assign(job, { phaseLabel: 'Reading the examples through the model', step: 12, total: 40, etaSecs: 840, elapsedSecs: 360 })
+ render(createElement(NeuronView))
+ await waitFor(() => expect(screen.getByTestId('neuron-job-progress').textContent).toBe('Example 12 of 40 · 30% · 14 min left · 6 min so far'))
+ expect(screen.queryByTestId('neuron-job-waiting')).toBeNull()
+ })
+
+ it('lets the waiting bar stand still with reduced motion', () => {
+ const css = readFileSync(resolve(__dirname, '../../../index.css'), 'utf8')
+ expect(css).toMatch(/@media \(prefers-reduced-motion: reduce\) \{\s*\.neuron-bar-wait \{ animation: none;/)
+ })
+})
diff --git a/src/components/neuron/parts.tsx b/src/components/neuron/parts.tsx
index 5881221f..817d2fca 100644
--- a/src/components/neuron/parts.tsx
+++ b/src/components/neuron/parts.tsx
@@ -5,12 +5,12 @@
// rows that read the same way everywhere (both ends on one line, the slider
// under them across the whole card).
-import { Check, Loader2, Trash2 } from 'lucide-react'
+import { Check, Clock, Loader2, Trash2 } from 'lucide-react'
import type { ReactNode } from 'react'
import { Hinweis } from '../ui/Hinweis'
import { HINWEIS_TEXT } from '../../lib/hinweis'
import { ICON_SM } from '../ui/icon-size'
-import { jobProgressText, jobShare } from '../../lib/neuron'
+import { jobProgressText, jobShare, shortDuration } from '../../lib/neuron'
import type { NeuronJob } from '../../api/neuron'
/** One step of the page: number, title, one line on what it is for, then
@@ -61,8 +61,13 @@ export interface SliderRowProps {
onChange: (v: number) => void
onCompute?: () => void
onDelete?: () => void
+ /** The line next to "Prepare": how long it takes, when that is said above. */
+ prepareHint?: string
}
+/** Next to "Prepare" when nothing above says how long it takes. */
+export const PREPARE_HINT = 'Once per model, seconds to a few minutes.'
+
export function signedValue(v: number): string {
if (v === 0) return '0'
return `${v > 0 ? '+' : '−'}${Math.abs(v).toFixed(2)}`
@@ -71,7 +76,7 @@ export function signedValue(v: number): string {
/** A slider as one card row: both ends and the value on one line, the
* slider under it across the whole row. Not computed yet: the same line,
* and in place of the slider the button that prepares it. */
-export function SliderRow({ id, left, right, value, computed, disabled, tag, onChange, onCompute, onDelete }: SliderRowProps) {
+export function SliderRow({ id, left, right, value, computed, disabled, tag, onChange, onCompute, onDelete, prepareHint = PREPARE_HINT }: SliderRowProps) {
const on = computed && value !== 0
return (
<div
@@ -117,7 +122,7 @@ export function SliderRow({ id, left, right, value, computed, disabled, tag, onC
>
Prepare for this model
</button>
- <span className={`t-micro ${HINWEIS_TEXT.ruhig}`}>Once per model, seconds to a few minutes.</span>
+ <span className={`t-micro ${HINWEIS_TEXT.ruhig}`}>{prepareHint}</span>
</div>
)}
</div>
@@ -140,6 +145,21 @@ export function TweakedNote({ title, text, original, onGetOriginal }: { title: s
)
}
+/** Before computing on a PC where one slider takes minutes (I1 on the box,
+ * 31.10.2026: ~25 min, said nowhere). Calm like the original note, blocks
+ * nothing; the words are lib/neuron's buildTimeNote. */
+export function TimeNote({ title, text }: { title: string; text: string }) {
+ return (
+ <div className="mb-4 border-l-2 border-lu-accent/50 pl-3 py-0.5 flex items-start gap-2" role="note" data-testid="neuron-time-note">
+ <Clock size={ICON_SM} className="flex-none mt-1 text-lu-accent" aria-hidden />
+ <div className="min-w-0">
+ <p className="t-body font-medium text-gray-100">{title}</p>
+ <p className={`t-body ${HINWEIS_TEXT.ruhig}`}>{text}</p>
+ </div>
+ </div>
+ )
+}
+
/** The ways to make a slider, as tabs. */
export function WayTabs<T extends string>({ ways, current, onPick }: {
ways: Array<{ id: T; label: string; count?: number }>
@@ -194,6 +214,14 @@ export function ScopeButton({ on, onClick, children }: { on: boolean; onClick: (
)
}
+/** P11's progress line, and on a long run how long it has run so far: at
+ * 25 minutes "12 min left" alone does not show that it is still moving. */
+function progressLine(job: NeuronJob): string {
+ const line = jobProgressText(job)
+ if (job.elapsedSecs < 60 || !line || /running for/.test(line)) return line
+ return `${line} · ${shortDuration(job.elapsedSecs)} so far`
+}
+
export function JobPanel({ job, onStop, onDismiss, onGetOriginal, original }: { job: NeuronJob; onStop: () => void; onDismiss: () => void; onGetOriginal?: () => void; original?: string | null }) {
const share = jobShare(job)
if (job.status === 'running') {
@@ -203,10 +231,12 @@ export function JobPanel({ job, onStop, onDismiss, onGetOriginal, original }: {
<Loader2 size={ICON_SM} className="animate-spin" /> {job.title}: {job.phaseLabel || 'starting…'}
</p>
<div className="h-1 rounded-full bg-gray-200 dark:bg-white/[0.08] overflow-hidden">
- <div className="h-full rounded-full bg-lu-accent transition-[width]" style={{ width: share == null ? '0%' : `${Math.round(share * 100)}%` }} />
+ {share == null
+ ? <div className="h-full w-1/4 rounded-full bg-lu-accent/60 neuron-bar-wait" data-testid="neuron-job-waiting" />
+ : <div className="h-full rounded-full bg-lu-accent transition-[width]" style={{ width: `${Math.round(share * 100)}%` }} />}
</div>
<div className="flex items-center justify-between gap-2">
- <p className={`t-micro font-mono ${HINWEIS_TEXT.ruhig}`} data-testid="neuron-job-progress">{jobProgressText(job)}</p>
+ <p className={`t-micro font-mono ${HINWEIS_TEXT.ruhig}`} data-testid="neuron-job-progress">{progressLine(job)}</p>
<button type="button" onClick={onStop} className="t-micro text-red-600 dark:text-red-400 hover:underline">Stop</button>
</div>
{job.logs.length > 0 && <p className={`t-micro ${HINWEIS_TEXT.ruhig} truncate`}>{job.logs[job.logs.length - 1]}</p>}
diff --git a/src/index.css b/src/index.css
index 0bfd2604..5d334dcb 100644
--- a/src/index.css
+++ b/src/index.css
@@ -2958,3 +2958,14 @@ input[type="range"].neuron-range,
linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.1)) center / 100% 4px no-repeat;
}
input[type="range"].neuron-range:disabled { cursor: not-allowed; opacity: 0.5; }
+
+/* Neurons job bar while the share is not known yet (model loading): a
+ short piece runs along the track instead of a bar stuck at 0 %. */
+.neuron-bar-wait { animation: lu-neuron-wait 1.6s ease-in-out infinite; }
+@keyframes lu-neuron-wait {
+ 0% { transform: translateX(-100%); }
+ 100% { transform: translateX(400%); }
+}
+@media (prefers-reduced-motion: reduce) {
+ .neuron-bar-wait { animation: none; transform: none; }
+}