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): persona id types hold for tsc -b

purplea35ab53860a0
diff --git a/src/components/neuron/NeuronView.tsx b/src/components/neuron/NeuronView.tsx
index ca746e4d..ea66f43d 100644
--- a/src/components/neuron/NeuronView.tsx
+++ b/src/components/neuron/NeuronView.tsx
@@ -236,7 +236,7 @@ export function NeuronView() {
<div className="flex flex-wrap items-center gap-1 mb-4 t-body" role="radiogroup" aria-label="Save sliders for">
<span className="text-gray-600 dark:text-gray-300 mr-1">Save for</span>
<ScopeButton on={scope === 'model'} onClick={() => setScope(modelKey, 'model')}>This model</ScopeButton>
- <ScopeButton on={scope === 'persona'} onClick={() => { setScope(modelKey, 'persona'); if (!hasPersonaProfile(profiles, modelKey, personaId)) setProfile(editingKey(modelKey, personaId, 'persona'), { ...(profiles[modelKey] ?? {}) }) }}>
+ <ScopeButton on={scope === 'persona'} onClick={() => { setScope(modelKey, 'persona'); if (!hasPersonaProfile(profiles, modelKey, persona.id)) setProfile(editingKey(modelKey, persona.id, 'persona'), { ...(profiles[modelKey] ?? {}) }) }}>
This model with “{persona.name}”
</ScopeButton>
</div>
diff --git a/src/lib/__tests__/neuron.test.ts b/src/lib/__tests__/neuron.test.ts
index 83eea1e7..f9550267 100644
--- a/src/lib/__tests__/neuron.test.ts
+++ b/src/lib/__tests__/neuron.test.ts
@@ -1,4 +1,5 @@
import { describe, expect, it } from 'vitest'
+import { editingKey } from '../../stores/neuronStore'
import {
backendNote,
clampStrength,
@@ -97,3 +98,11 @@ describe('neuron progress', () => {
expect(shortDuration(3900)).toBe('1 h 5 min')
})
})
+
+describe('editingKey', () => {
+ it('is the persona key only while a persona steers', () => {
+ expect(editingKey('m', 'pirate', 'persona')).toBe('m::persona:pirate')
+ expect(editingKey('m', undefined, 'persona')).toBe('m')
+ expect(editingKey('m', 'pirate', 'model')).toBe('m')
+ })
+})
diff --git a/src/stores/neuronStore.ts b/src/stores/neuronStore.ts
index e8bb9ad4..63239a53 100644
--- a/src/stores/neuronStore.ts
+++ b/src/stores/neuronStore.ts
@@ -56,6 +56,7 @@ export const useNeuronStore = create<NeuronState>()(
)
/** The profile key the panel edits for this model and persona. */
-export function editingKey(modelKey: string, personaId: string, scope: 'model' | 'persona'): string {
- return scope === 'persona' ? personaProfileKey(modelKey, personaId) : modelProfileKey(modelKey)
+export function editingKey(modelKey: string, personaId: string | undefined, scope: 'model' | 'persona'): string {
+ // No persona steers (none active, or a group chat): the model's own.
+ return scope === 'persona' && personaId ? personaProfileKey(modelKey, personaId) : modelProfileKey(modelKey)
}