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 Hausteil geht genau einmal raus
purplec1e0c2695905
diff --git a/src/lib/__tests__/constants-validation.test.ts b/src/lib/__tests__/constants-validation.test.tsindex 337016c8..fb6cdebe 100644--- a/src/lib/__tests__/constants-validation.test.ts+++ b/src/lib/__tests__/constants-validation.test.ts@@ -133,11 +133,12 @@ describe('constants-validation', () => {// zurueck, und gemessen an 46 Katalogmodellen hat genau das sechs Modelle// vom Antworten aufs Ablehnen gebracht. Die Rolle steht jetzt drin, der// Test haelt fest, dass sie da ist und keine Inhaltsregel enthaelt.- it('contains the "unrestricted" persona with a real role and no content policy', () => {+ // R5-3: leer, damit der Grundtext greift und der Hausteil genau einmal+ // rausgeht. Die Rolle steht in CHAT_BASE_SYSTEM_PROMPT, nicht hier.+ it('contains the "unrestricted" persona, and it carries no text of its own', () => {const unrestricted = BUILT_IN_PERSONAS.find(p => p.id === 'unrestricted')expect(unrestricted).toBeDefined()- expect(unrestricted!.systemPrompt.length).toBeGreaterThan(40)- expect(unrestricted!.systemPrompt).not.toMatch(/refuse|decline|nsfw|explicit|appropriate/i)+ expect(unrestricted!.systemPrompt).toBe('')})it('all persona names are unique', () => {diff --git a/src/lib/__tests__/persona-prompts.test.ts b/src/lib/__tests__/persona-prompts.test.tsindex 569e7ba8..a7c71f46 100644--- a/src/lib/__tests__/persona-prompts.test.ts+++ b/src/lib/__tests__/persona-prompts.test.ts@@ -12,18 +12,27 @@import { describe, expect, it } from 'vitest'import { BUILT_IN_PERSONAS } from '../constants'+import { buildChatSystemPrompt, CHAT_BASE_SYSTEM_PROMPT } from '../system-prompt'const byId = (id: string) => BUILT_IN_PERSONAS.find((p) => p.id === id)const defaultPersona = byId('unrestricted')describe('built-in persona prompts', () => {- it('ships the default persona with an actual role', () => {+ /**+ * R5-3: die Vorgabeperson TRUG den Grundtext als ihren eigenen Text. Wer sie+ * einschaltete, schickte den Hausteil zweimal, weil die Zusammensetzung ihn+ * ein zweites Mal anhaengt. Sie sagt ohnehin nichts, was der Grundtext nicht+ * sagt, also traegt sie gar nichts mehr und der Grundtext greift. Wie im Web.+ */+ it('ships the default persona empty, so the baseline carries the role', () => {expect(defaultPersona).toBeDefined()- expect(defaultPersona!.systemPrompt.trim().length).toBeGreaterThan(40)+ expect(defaultPersona!.systemPrompt).toBe('')+ expect(buildChatSystemPrompt({ systemPrompt: defaultPersona!.systemPrompt, personaEnabled: true }))+ .toBe(CHAT_BASE_SYSTEM_PROMPT)})- it('gives every built-in persona a non-empty prompt', () => {- for (const p of BUILT_IN_PERSONAS) {+ it('gives every NAMED persona a non-empty prompt', () => {+ for (const p of BUILT_IN_PERSONAS.filter((x) => x.id !== 'unrestricted')) {expect(p.systemPrompt.trim(), p.id).not.toBe('')}})@@ -44,16 +53,16 @@ describe('built-in persona prompts', () => {}})- it('keeps assistant-identity filler out of the default persona', () => {+ it('keeps assistant-identity filler out of what the default sends', () => {// The exact phrasing that pushes a model into its built-in assistant mode.for (const pattern of [/helpful/i, /friendly/i, /\bassistant\b/i]) {- expect(pattern.test(defaultPersona!.systemPrompt), String(pattern)).toBe(false)+ expect(pattern.test(CHAT_BASE_SYSTEM_PROMPT), String(pattern)).toBe(false)}})it('tells the model not to volunteer disclaimers, which is a style rule and not a filter', () => {- expect(defaultPersona!.systemPrompt).toMatch(/disclaimer/i)- expect(defaultPersona!.systemPrompt).toMatch(/did not ask for/i)+ expect(CHAT_BASE_SYSTEM_PROMPT).toMatch(/disclaimer/i)+ expect(CHAT_BASE_SYSTEM_PROMPT).toMatch(/did not ask for/i)})it('leaves the named personas free to describe their own job', () => {diff --git a/src/lib/__tests__/system-prompt.test.ts b/src/lib/__tests__/system-prompt.test.tsindex bebf48d7..d447e613 100644--- a/src/lib/__tests__/system-prompt.test.ts+++ b/src/lib/__tests__/system-prompt.test.ts@@ -162,6 +162,16 @@ describe('die Reichweitenzeile haengt an jeder Oberflaeche mit einem Menschen dabuildChatSystemPrompt({ systemPrompt: 'You are a pirate.', personaEnabled: true }),false,)+ // R2-8: die Vorgabeperson TRUG den Grundtext als ihren eigenen Text. Wer+ // sie einschaltete, bekam den Hausteil deshalb zweimal, einmal aus der+ // Person und einmal aus der Zusammensetzung. `withHouseConduct` hat den+ // Schutz dagegen seit jeher, `buildChatSystemPrompt` hatte ihn nicht.+ traegtDenHausteil(+ buildChatSystemPrompt({+ systemPrompt: BUILT_IN_PERSONAS.find((p) => p.id === 'unrestricted')!.systemPrompt,+ personaEnabled: true,+ }),+ )})/**diff --git a/src/lib/constants.ts b/src/lib/constants.tsindex b55d3b90..2963a93e 100644--- a/src/lib/constants.ts+++ b/src/lib/constants.ts@@ -1,5 +1,4 @@import type { Persona, Settings } from '../types/settings'-import { CHAT_BASE_SYSTEM_PROMPT } from './system-prompt'// Feature flags — flip to true when ready to shipexport const FEATURE_FLAGS = {@@ -189,7 +188,11 @@ export const BUILT_IN_PERSONAS: Persona[] = [id: 'unrestricted',name: 'No Filter',icon: 'Shield',- systemPrompt: CHAT_BASE_SYSTEM_PROMPT,+ // R5-3: hier stand CHAT_BASE_SYSTEM_PROMPT, also der Grundtext als+ // Personentext. Diese Person sagt nichts, was der Grundtext nicht ohnehin+ // sagt; sie einzuschalten hiess bisher, ihn ein zweites Mal zu schicken.+ // Leer heisst: die Zusammensetzung faellt auf den Grundtext, wie im Web.+ systemPrompt: '',isBuiltIn: true,},{diff --git a/src/lib/system-prompt.ts b/src/lib/system-prompt.tsindex 05854cd5..0bf232c7 100644--- a/src/lib/system-prompt.ts+++ b/src/lib/system-prompt.ts@@ -73,7 +73,13 @@ export function buildChatSystemPrompt(conv: {personaEnabled?: boolean}): string {const persona = conv.personaEnabled === true ? (conv.systemPrompt || '').trim() : ''- return persona ? `${persona}\n\n${HOUSE_RULES}` : CHAT_BASE_SYSTEM_PROMPT+ 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.+ // Dann stand er zweimal im Systemtext, und ein doppelter Befehl liest sich+ // fuer ein Modell als Nachdruck. `withHouseConduct` hat diesen Schutz seit+ // jeher, hier fehlte er.+ return persona.includes(HOUSE_RULES) ? persona : `${persona}\n\n${HOUSE_RULES}`}/**