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(neuron): the comparison names sliders as the mix does, not by their ids

purpleb2e8010112c1
diff --git a/src/components/neuron/NeuronView.tsx b/src/components/neuron/NeuronView.tsx
index e55c24ae..132288af 100644
--- a/src/components/neuron/NeuronView.tsx
+++ b/src/components/neuron/NeuronView.tsx
@@ -535,7 +535,7 @@ export function NeuronView() {
done={compared}
testId="neuron-step-compare"
>
- <ComparePanel modelPath={modelPath} entries={entries} disabled={running || !modelPath} model={model} tuning={restartTuning} onError={setError} onDone={() => setCompared(true)} />
+ <ComparePanel modelPath={modelPath} entries={entries} labelOf={labelOf} disabled={running || !modelPath} model={model} tuning={restartTuning} onError={setError} onDone={() => setCompared(true)} />
</StepCard>
<StepCard
diff --git a/src/components/neuron/__tests__/neurons-for-beginners.test.tsx b/src/components/neuron/__tests__/neurons-for-beginners.test.tsx
index 411e5214..b8b8130d 100644
--- a/src/components/neuron/__tests__/neurons-for-beginners.test.tsx
+++ b/src/components/neuron/__tests__/neurons-for-beginners.test.tsx
@@ -22,6 +22,7 @@ const vectors: Array<Record<string, unknown>> = []
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, name: 'Qwen2.5 0.5B Instruct', nLayer: 24, mlpNeurons: false, nFf: null as number | null }))
+const compare = vi.fn(async (..._a: unknown[]) => ({ before: 'People are kind.', after: 'I want to scare you.' }))
const mlpAdd = vi.fn(async (_path: string, _layer: number, _neuron: number) => ({ started: true }))
vi.mock('../../../api/neuron', () => ({
@@ -41,7 +42,7 @@ vi.mock('../../../api/neuron', () => ({
neuronBuildPreset: (p: string, id: string) => buildPreset(p, id),
neuronBuildOwn: (...a: unknown[]) => buildOwn(...a),
neuronMlpAdd: (p: string, l: number, n: number) => mlpAdd(p, l, n),
- neuronCancel: vi.fn(), neuronCompare: vi.fn(), neuronDelete: vi.fn(), neuronDismiss: vi.fn(),
+ neuronCancel: vi.fn(), neuronCompare: (...a: unknown[]) => compare(...a), neuronDelete: vi.fn(), neuronDismiss: vi.fn(),
neuronFeatureAdd: vi.fn(), neuronSaeDownload: vi.fn(), neuronSaeSearch: vi.fn(),
}))
vi.mock('../../../api/engine', () => ({
@@ -271,6 +272,16 @@ describe('single neurons', () => {
expect(useNeuronStore.getState().profiles['qwen-1']).toEqual({ 'n-L14-N8949': 2.5 })
})
+ it('names the neurons in the comparison as the mix does, not by their ids', async () => {
+ vectors.push({ id: 'n-L13-N7956', kind: 'neuron', name: 'L13 N7956', left: 'Less', right: 'More', unit: 30, builtAt: 1, more: [], less: [] })
+ useNeuronStore.setState({ profiles: { 'qwen-1': { 'n-L13-N7956': -1 } } })
+ render(createElement(NeuronView))
+ await within(await screen.findByTestId('neuron-mix')).findByText('L13 N7956')
+ fireEvent.click(screen.getByTestId('neuron-compare-run'))
+ const after = await screen.findByTestId('neuron-compare-after')
+ expect(after.previousElementSibling!.textContent).toBe('After · L13 N7956 −1.00')
+ })
+
it('names the layers and neurons a model has before anything runs', async () => {
render(createElement(NeuronView))
fireEvent.click(await screen.findByTestId('neuron-way-coords'))
diff --git a/src/components/neuron/panels.tsx b/src/components/neuron/panels.tsx
index d159faac..cbac2173 100644
--- a/src/components/neuron/panels.tsx
+++ b/src/components/neuron/panels.tsx
@@ -304,9 +304,11 @@ export function CoordinatesPanel({ presets, modelNames, states, onUse, disabled
// ── Before and after ──────────────────────────────────────────────────
-export function ComparePanel({ modelPath, entries, disabled, model, tuning, onError, onDone }: {
+export function ComparePanel({ modelPath, entries, labelOf, disabled, model, tuning, onError, onDone }: {
modelPath: string
entries: ReturnType<typeof entriesFor>
+ /** The slider's name as "On right now" shows it ("L13 N7956", "Cheerful"). */
+ labelOf?: (id: string) => string
disabled: boolean
model: BundledModel | undefined
tuning: (m: BundledModel | undefined) => Promise<BuiltinEngineTuning | undefined>
@@ -354,7 +356,7 @@ export function ComparePanel({ modelPath, entries, disabled, model, tuning, onEr
<p className="t-body text-gray-100 whitespace-pre-wrap" data-testid="neuron-compare-before">{result.before}</p>
</div>
<div className="rounded-lg border border-lu-accent/40 bg-lu-accent/[0.05] p-3">
- <p className="t-label text-lu-accent mb-1.5">After · {result.entries.map((e) => `${e.id} ${signedValue(e.strength)}`).join(', ') || 'all at 0'}</p>
+ <p className="t-label text-lu-accent mb-1.5">After · {result.entries.map((e) => `${labelOf ? labelOf(e.id) : e.id} ${signedValue(e.strength)}`).join(', ') || 'all at 0'}</p>
<p className="t-body text-gray-100 whitespace-pre-wrap" data-testid="neuron-compare-after">{result.after}</p>
</div>
</div>