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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(person): der globale Schalter schlaegt den Schalter der Unterhaltung
purpleac54148bb9c8
diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.tsindex d5af3ce6..831359ee 100644--- a/src/hooks/useAgentChat.ts+++ b/src/hooks/useAgentChat.ts@@ -473,7 +473,7 @@ export function useAgentChat() {// Per-chat persona toggle — default OFF. Only apply persona prompt// when user explicitly flipped it on. See useChat.ts for the// full rationale (Devil's Advocate hijack bug).- let systemPrompt = buildChatSystemPrompt(conv)+ let systemPrompt = buildChatSystemPrompt(conv, settings.personasEnabled !== false)const ragState = useRAGStore.getState()const ragEnabled = ragState.ragEnabled[convId] ?? falselet ragSuffix = ''diff --git a/src/hooks/useChat.ts b/src/hooks/useChat.tsindex 6796da24..e1e287d9 100644--- a/src/hooks/useChat.ts+++ b/src/hooks/useChat.ts@@ -561,7 +561,7 @@ export function useChat() {// flipped it on via the Plugins dropdown does the persona prompt// apply. Undefined / unset → suppress, so a globally selected// persona never silently hijacks a new chat.- let systemPrompt = buildChatSystemPrompt(conv)+ let systemPrompt = buildChatSystemPrompt(conv, settings.personasEnabled !== false)const ragState = useRAGStore.getState()const ragEnabled = ragState.ragEnabled[convId] ?? falselet ragSuffix = ''diff --git a/src/lib/__tests__/system-prompt.test.ts b/src/lib/__tests__/system-prompt.test.tsindex d447e613..745ee590 100644--- a/src/lib/__tests__/system-prompt.test.ts+++ b/src/lib/__tests__/system-prompt.test.ts@@ -21,7 +21,7 @@ import {buildChatSystemPrompt,withHouseConduct,} from '../system-prompt'-import { BUILT_IN_PERSONAS } from '../constants'+import { BUILT_IN_PERSONAS, DEFAULT_SETTINGS } from '../constants'import { groupSystemPrompt } from '../group-chat'import { buildHermesToolPrompt } from '../../api/hermes-tool-calling'import {@@ -86,10 +86,35 @@ describe('system prompt', () => {it('leaves no assembly point that can fall back to an empty string', () => {for (const file of ['hooks/useChat.ts', 'hooks/useAgentChat.ts']) {expect(read(file)).not.toMatch(/personaEnabled === true \? conv\.systemPrompt : ''/)- expect(read(file)).toContain('buildChatSystemPrompt(conv)')+ // R5-1: der Aufruf traegt jetzt den globalen Schalter als zweites+ // Argument, wie im Web. Die Klammer bleibt deshalb offen.+ expect(read(file)).toContain('buildChatSystemPrompt(conv, settings.personasEnabled !== false)')}})+ /**+ * R5-1: der Chat las nur den Schalter der Unterhaltung. Wer Personen global+ * abschaltete, bekam die eingefrorene Person weiter geschickt, und der+ * Schalter tat sichtbar nichts.+ */+ it('der globale Schalter schlaegt den Schalter der Unterhaltung', () => {+ const mitPerson = { systemPrompt: 'You are a pirate.', personaEnabled: true }+ expect(buildChatSystemPrompt(mitPerson, true)).toContain('You are a pirate.')+ const aus = buildChatSystemPrompt(mitPerson, false)+ expect(aus).not.toContain('You are a pirate.')+ expect(aus).toBe(CHAT_BASE_SYSTEM_PROMPT)+ // Negativkontrolle: wer nichts uebergibt, bekommt das Verhalten von vorher.+ expect(buildChatSystemPrompt(mitPerson)).toContain('You are a pirate.')+ })++ /**+ * R5-2: stand der globale Schalter auf an, kaperte eine global gewaehlte+ * Person jede neue Unterhaltung, und der Grundtext kam nicht zum Zug.+ */+ it('frische Einstellungen schicken keine Person', () => {+ expect(DEFAULT_SETTINGS.personasEnabled).toBe(false)+ })+it('carries the conduct line on the coding surface too', () => {expect(read('hooks/useCodex.ts')).toContain('withHouseConduct(')})diff --git a/src/lib/constants.ts b/src/lib/constants.tsindex 2963a93e..7bbc2d3a 100644--- a/src/lib/constants.ts+++ b/src/lib/constants.ts@@ -18,7 +18,10 @@ export const DEFAULT_SETTINGS: Settings = {appMode: 'local',// Cloud teasers in Local mode (2.5.8) — on by default, one-click off.cloudTeasersEnabled: true,- personasEnabled: true,+ // R5-2: Web gilt. Stand er auf true, kaperte eine global gewaehlte Person+ // jede neue Unterhaltung, und der Grundtext, der die Ablehnungen abstellt,+ // kam gar nicht erst zum Zug.+ personasEnabled: false,thinkingEnabled: true,// Reasoning effort (2.6.8). 'high' is not a taste, it is the rung this// client has always sent for thinking ON. Any other default would move everydiff --git a/src/lib/system-prompt.ts b/src/lib/system-prompt.tsindex 0bf232c7..721e4708 100644--- a/src/lib/system-prompt.ts+++ b/src/lib/system-prompt.ts@@ -68,11 +68,21 @@ export const CHAT_BASE_SYSTEM_PROMPT = `${CHAT_BASE_ROLE} ${HOUSE_RULES}`* nur den Hausteil an. Ohne Person gilt der Grundtext ganz. In beiden Faellen* geht etwas raus, nie mehr ein leerer String.*/-export function buildChatSystemPrompt(conv: {- systemPrompt?: string | null- personaEnabled?: boolean-}): string {- const persona = conv.personaEnabled === true ? (conv.systemPrompt || '').trim() : ''+export function buildChatSystemPrompt(+ conv: {+ systemPrompt?: string | null+ personaEnabled?: boolean+ },+ /**+ * `settings.personasEnabled`, der GLOBALE Schalter. R5-1: der Chat las nur+ * den Schalter der Unterhaltung. Wer Personen global abschaltete, bekam die+ * eingefrorene Person der Unterhaltung trotzdem weiter geschickt, und der+ * Schalter, den er gerade umgelegt hatte, tat sichtbar nichts. Vorgabe+ * `true`, damit kein Aufrufer, der nichts uebergibt, sein Verhalten aendert.+ */+ personasOn = true,+): string {+ const persona = personasOn && conv.personaEnabled === true ? (conv.systemPrompt || '').trim() : ''if (!persona) return CHAT_BASE_SYSTEM_PROMPT// R2-8: eine Person kann den Hausteil selbst schon tragen, etwa weil sie aus// dem Grundtext gebaut wurde oder weil ein Nutzer ihn hineinkopiert hat.