fix: Persona als eine Systemnachricht, Nur-Stil hängt an die Grundlage an (#1256, #1257)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GmHhg7bzeoxrPsLnJ4nor4
This commit is contained in:
2026-11-30 12:51:49 +01:00
parent 671f9e5bd0
commit fdcc11f45a
4 changed files with 139 additions and 33 deletions

View File

@ -7743,11 +7743,33 @@ async fn systemprompt_ebenen_ersetzen_sich_statt_sich_zu_stapeln() {
assert_eq!(st, 303);
let luna = gw.state.store().personas(TEST_NUTZER).unwrap()[0].id;
let antwort = systeme_chat(&gw, &nutzer, &ncsrf, Some(luna)).await;
assert!(antwort.contains("SYSTEM=PERSONA|STIL"), "{antwort}");
// Eine Systemnachricht aus Systemprompt und Stil (→ #1257), nicht zwei.
assert!(antwort.contains("SYSTEM=PERSONA\\n\\nSTIL"), "{antwort}");
assert!(
!antwort.contains("MODELL") && !antwort.contains("GLOBAL"),
"{antwort}"
);
// Nur Stil (→ #1256): Der Stil wird an die Grundlage des Modells angehängt, sie wird nicht ersetzt und nicht doppelt gesetzt.
let (st, _, _) = ui_post(
&gw,
"/ui/personas/speichern",
&nutzer,
&format!("csrf={ncsrf}&name=NurStil&systemprompt=&stil=NURSTIL"),
)
.await;
assert_eq!(st, 303);
let nur_stil = gw
.state
.store()
.personas(TEST_NUTZER)
.unwrap()
.into_iter()
.find(|p| p.name == "NurStil")
.unwrap()
.id;
let antwort = systeme_chat(&gw, &nutzer, &ncsrf, Some(nur_stil)).await;
assert!(antwort.contains("SYSTEM=MODELL\\n\\nNURSTIL"), "{antwort}");
assert_eq!(antwort.matches("MODELL").count(), 1, "{antwort}");
// Eine Persona ohne Text ersetzt nichts: Modell gilt weiter.
let (st, _, _) = ui_post(
&gw,