feat(brain): add OUTPUT_LANGUAGE reply-language lock
Add an optional OUTPUT_LANGUAGE env var that forces every reply into a single language. When set, output_language_directive() injects a "respond only in <language>" instruction (also forbidding other scripts) into the chat loop's system prompt, next to the existing TTS English-only lock. Empty (default) keeps the multilingual "reply in the user's language" behaviour, so upstream is unaffected. For the Korean-only deployment this also suppresses the occasional trailing CJK/Hanja fragment qwen2.5:3b leaks on free-form chit-chat. - system_prompt.py: language-agnostic output_language_directive() helper - engine.py: read OUTPUT_LANGUAGE, append directive in _build_initial_system_message - docker-compose.yml + .env.example: document/pass the new var - docs/llm_contexts.md: note the new gating on the main reply context - tests: cover unset/set/agnostic/whitespace cases
This commit is contained in:
@@ -59,6 +59,12 @@ OLLAMA_CHAT_MODEL=qwen2.5:3b
|
||||
OLLAMA_EMBED_MODEL=nomic-embed-text
|
||||
WHISPER_MODEL=small
|
||||
|
||||
# Lock every reply to one language, e.g. OUTPUT_LANGUAGE=Korean. Leave BLANK to
|
||||
# keep the default behaviour of replying in whatever language the user wrote in.
|
||||
# A fixed value also suppresses stray characters from other scripts (e.g. the
|
||||
# occasional trailing CJK fragment small models leak on free-form chat).
|
||||
OUTPUT_LANGUAGE=
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Docker desktop (VNC) — used only by the container image
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user