feat(i18n): strengthen output-language.md template to enforce language compliance

Replace soft "Prefer responding" wording with mandatory "MUST always respond"
rule to improve LLM adherence to configured output language. Add exception
clause allowing users to explicitly override for the remainder of a conversation.
This commit is contained in:
沐目 2026-02-28 13:59:20 +08:00
parent e93b287329
commit 5f06bf8910
2 changed files with 43 additions and 5 deletions

View file

@ -89,17 +89,18 @@ function generateOutputLanguageFileContent(language: string): string {
return `# Output language preference: ${language}
<!-- ${LLM_OUTPUT_LANGUAGE_MARKER_PREFIX} ${safeLanguage} -->
## Goal
Prefer responding in **${language}** for normal assistant messages and explanations.
## Rule
You MUST always respond in **${language}** regardless of the user's input language.
This is a mandatory requirement, not a preference.
## Exception
If the user **explicitly** requests a response in a specific language (e.g., "please reply in English", "用中文回答"), switch to the user's requested language for the remainder of the conversation.
## Keep technical artifacts unchanged
Do **not** translate or rewrite:
- Code blocks, CLI commands, file paths, stack traces, logs, JSON keys, identifiers
- Exact quoted text from the user (keep quotes verbatim)
## When a conflict exists
If higher-priority instructions (system/developer) require a different behavior, follow them.
## Tool / system outputs
Raw tool/system outputs may contain fixed-format English. Preserve them verbatim, and if needed, add a short **${language}** explanation below.
`;