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): a persona's first slider move keeps the other sliders

purple342e969972dc
diff --git a/src/components/neuron/NeuronView.tsx b/src/components/neuron/NeuronView.tsx
index d6b8b386..ca746e4d 100644
--- a/src/components/neuron/NeuronView.tsx
+++ b/src/components/neuron/NeuronView.tsx
@@ -16,7 +16,7 @@ import { preservedSwapCtx } from '../../lib/builtin-ctx'
import { builtinModelMatches } from '../../lib/builtin-model-identity'
import {
backendNote, effectiveStrengths, entriesFor, hasPersonaProfile, jobProgressText, jobShare, sameEntries,
- steeringPersona, strengthWarning, warningText, type BackendKind,
+ clampStrength, steeringPersona, strengthWarning, warningText, type BackendKind,
} from '../../lib/neuron'
import { editingKey, useNeuronStore } from '../../stores/neuronStore'
import { useModelStore } from '../../stores/modelStore'
@@ -184,6 +184,14 @@ export function NeuronView() {
}
}
+ // A persona without its own profile shows the model's; its first move
+ // starts from what is shown, so the other sliders keep their place (T1:
+ // they fell to 0 when the saved scope was already "persona").
+ const move = (id: string, value: number) => {
+ if (editKey in profiles) setStrength(editKey, id, value)
+ else setProfile(editKey, { ...strengths, [id]: clampStrength(value) })
+ }
+
const reset = () => {
if (!modelKey) return
if (scope === 'persona') removeProfile(editKey)
@@ -257,7 +265,7 @@ export function NeuronView() {
computed={!!v}
disabled={running || !modelPath || (!v && !info?.generator)}
onCompute={() => void startJob(() => neuronBuildPreset(modelPath, p.id))}
- onChange={(x) => setStrength(editKey, p.id, x)}
+ onChange={(x) => move(p.id, x)}
/>
)
})}
@@ -275,7 +283,7 @@ export function NeuronView() {
value={strengths[v.id] ?? 0}
computed
disabled={running}
- onChange={(x) => setStrength(editKey, v.id, x)}
+ onChange={(x) => move(v.id, x)}
onDelete={() => void neuronDelete(modelPath, v.id).then(() => { removeSlider(modelKey, v.id); return refreshInfo(modelPath) })}
/>
))}
@@ -293,7 +301,7 @@ export function NeuronView() {
disabled={running}
onDownload={() => void startJob(() => neuronSaeDownload(modelPath))}
onAdd={(hit) => void startJob(() => neuronFeatureAdd(modelPath, hit.feature, hit.label))}
- onChange={(id, x) => setStrength(editKey, id, x)}
+ onChange={(id, x) => move(id, x)}
onDelete={(id) => void neuronDelete(modelPath, id).then(() => { removeSlider(modelKey, id); return refreshInfo(modelPath) })}
onError={setError}
/>
diff --git a/src/components/neuron/__tests__/neuron-view-steers-the-engine.test.tsx b/src/components/neuron/__tests__/neuron-view-steers-the-engine.test.tsx
index 30655c14..df6b662e 100644
--- a/src/components/neuron/__tests__/neuron-view-steers-the-engine.test.tsx
+++ b/src/components/neuron/__tests__/neuron-view-steers-the-engine.test.tsx
@@ -60,6 +60,9 @@ vi.mock('../../../api/builtin-ensure', () => ({ isManagedBuiltinSlot: () => slot
import { NeuronView } from '../NeuronView'
import { useModelStore } from '../../../stores/modelStore'
import { useNeuronStore } from '../../../stores/neuronStore'
+import { useSettingsStore } from '../../../stores/settingsStore'
+import { useChatStore } from '../../../stores/chatStore'
+import type { Persona } from '../../../types/settings'
beforeEach(() => {
apply.mockClear()
@@ -130,6 +133,21 @@ describe('Neuron tweaker view', () => {
expect(screen.queryByText(/qwen2 · 24 layers/)).toBeNull()
})
+ // T1 (3.0.9): with the scope already on "persona", a persona without its
+ // own sliders kept only the one moved; the others fell to 0.
+ it('keeps the other sliders when a persona is first moved', async () => {
+ for (const id of ['creative', 'cheerful']) vectors.push({ id, kind: 'preset', name: id, left: 'L', right: 'R', unit: 0.8, builtAt: 1, more: [], less: [] })
+ useNeuronStore.setState({ profiles: { 'qwen-1': { creative: 0.5, cheerful: 0.4 } }, scopeByModel: { 'qwen-1': 'persona' } })
+ useChatStore.setState({ conversations: [], activeConversationId: null })
+ useSettingsStore.setState((s) => ({ personas: [{ id: 'coder', name: 'Coder', systemPrompt: 'Code.' } as Persona], activePersonaId: 'coder', settings: { ...s.settings, personasEnabled: true } }))
+ render(createElement(NeuronView))
+ const row = await screen.findByTestId('neuron-slider-creative')
+ await screen.findByText(/This model with/)
+ fireEvent.change(row.querySelector('input[type=range]') as HTMLInputElement, { target: { value: '0.2' } })
+ expect(useNeuronStore.getState().profiles['qwen-1::persona:coder']).toEqual({ creative: 0.2, cheerful: 0.4 })
+ await waitFor(() => expect(apply.mock.calls.at(-1)?.[1]).toEqual([{ id: 'cheerful', strength: 0.4 }, { id: 'creative', strength: 0.2 }]), { timeout: 3000 })
+ })
+
// T1 (3.0.9): the embedding model of Document Chat was the only choice,
// and the vector tool aborted on it.
it('offers chat models only, under a labelled picker', async () => {