diff --git a/src/routers/chat.py b/src/routers/chat.py index be2801e..ef1d6e5 100644 --- a/src/routers/chat.py +++ b/src/routers/chat.py @@ -813,7 +813,7 @@ FORMATIERUNG: def _escape_prompt_content(text: str) -> str: """Escaped Inhalte die in den Prompt eingefuegt werden, um Spoofing zu verhindern.""" # XML-artige Tags escapen - text = re.sub(r"<(/?)(?:user_message|system|assistant|human|instruction)", r"<\1\2", text, flags=re.IGNORECASE) + text = re.sub(r"<(/?)(?:user_message|system|assistant|human|instruction)", "[tag]", text, flags=re.IGNORECASE) # Rollen-Prefixe am Zeilenanfang escapen (verhindert History-Spoofing) text = re.sub(r"^(Nutzer|Assistent|User|Assistant|System|Human):", r"[\1]:", text, flags=re.MULTILINE | re.IGNORECASE) return text