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(chat): die Standardpersona bekommt eine Rolle statt eines leeren Systemtexts
David1bb7fa74cba6
diff --git a/src/lib/__tests__/constants-validation.test.ts b/src/lib/__tests__/constants-validation.test.tsindex 6bcaf59d..337016c8 100644--- a/src/lib/__tests__/constants-validation.test.ts+++ b/src/lib/__tests__/constants-validation.test.ts@@ -128,10 +128,16 @@ describe('constants-validation', () => {expect(coder).toBeDefined()})- it('contains the "unrestricted" persona with empty system prompt', () => {+ // Bis 10.09.2026 stand hier `toBe('')`. Ein leerer Systemtext ist aber+ // nicht neutral: das Modell faellt dann auf seine eigene Grundhaltung+ // 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', () => {const unrestricted = BUILT_IN_PERSONAS.find(p => p.id === 'unrestricted')expect(unrestricted).toBeDefined()- expect(unrestricted!.systemPrompt).toBe('')+ expect(unrestricted!.systemPrompt.length).toBeGreaterThan(40)+ expect(unrestricted!.systemPrompt).not.toMatch(/refuse|decline|nsfw|explicit|appropriate/i)})it('all persona names are unique', () => {diff --git a/src/lib/__tests__/persona-prompts.test.ts b/src/lib/__tests__/persona-prompts.test.tsnew file mode 100644index 00000000..569e7ba8--- /dev/null+++ b/src/lib/__tests__/persona-prompts.test.ts@@ -0,0 +1,66 @@+// The built-in personas, and what a system prompt may never contain.+//+// Measured on 2026-09-10 across the cloud catalogue: the system prompt decides+// more than any sampling value. Six models that declined a bare instruction+// answered once a role was set. The default persona shipped with an empty+// prompt, which is not neutral, so it now states a role.+//+// The rule these tests defend: a system prompt states role and task. It never+// carries a content policy. Enforcement belongs on the server, in+// lib/render/safety.ts, where it can be tested and cannot be edited away by a+// user who owns their own prompt field.++import { describe, expect, it } from 'vitest'+import { BUILT_IN_PERSONAS } from '../constants'++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', () => {+ expect(defaultPersona).toBeDefined()+ expect(defaultPersona!.systemPrompt.trim().length).toBeGreaterThan(40)+ })++ it('gives every built-in persona a non-empty prompt', () => {+ for (const p of BUILT_IN_PERSONAS) {+ expect(p.systemPrompt.trim(), p.id).not.toBe('')+ }+ })++ it('keeps content policy out of every built-in prompt', () => {+ // A prompt that asks the model to refuse is both weaker than the server+ // gate and unmeasurable. If one of these ever appears, the enforcement+ // moved to the wrong layer.+ const forbidden = [+ /\brefuse\b/i, /\bdecline\b/i, /\bnot generate\b/i, /\bmust not\b/i,+ /\bcontent polic/i, /\bguidelines\b/i, /\bsafe(ty)? (rules|policy)\b/i,+ /\bnsfw\b/i, /\bexplicit\b/i, /\badult content\b/i,+ ]+ for (const p of BUILT_IN_PERSONAS) {+ for (const pattern of forbidden) {+ expect(pattern.test(p.systemPrompt), `${p.id} matched ${pattern}`).toBe(false)+ }+ }+ })++ it('keeps assistant-identity filler out of the default persona', () => {+ // 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)+ }+ })++ 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)+ })++ it('leaves the named personas free to describe their own job', () => {+ // They are the user's deliberate choice, so their wording stays. Only the+ // default changed. This assertion exists so a future sweep does not+ // flatten them all into one voice.+ expect(byId('coder')!.systemPrompt).toMatch(/software engineer/i)+ expect(byId('writer')?.systemPrompt ?? byId('assistant')!.systemPrompt).toBeTruthy()+ })+})diff --git a/src/lib/constants.ts b/src/lib/constants.tsindex c833f01d..fb56cddb 100644--- a/src/lib/constants.ts+++ b/src/lib/constants.ts@@ -171,10 +171,20 @@ export const BUILT_IN_PERSONAS: Persona[] = [isBuiltIn: true,},{+ // The default persona. It used to send no system prompt at all, which is+ // not neutral: with no role set, most instruction-tuned models fall back to+ // their built-in assistant persona and decline requests they would+ // otherwise answer. Measured against the whole cloud catalogue on+ // 2026-09-10, an explicit role moved six models from refusing to answering.+ //+ // So this states a role and nothing else. It carries no content rule in+ // either direction: it does not ask the model to police the user, and it+ // does not ask it to ignore its own limits. Enforcement lives on the+ // server, in lib/render/safety.ts, where it is testable.id: 'unrestricted',name: 'No Filter',icon: 'Shield',- systemPrompt: '',+ systemPrompt: "You are the user's own model, running for them alone. Answer the request that was actually made. Do not add disclaimers, warnings or moral commentary that the user did not ask for, and do not lecture. If a request is genuinely ambiguous, ask one short question instead of guessing.",isBuiltIn: true,},{