From 12bebe1b5fa10244957f68b17e40e5facd4137d5 Mon Sep 17 00:00:00 2001 From: pomelo-nwu Date: Tue, 18 Nov 2025 13:27:20 +0800 Subject: [PATCH] feat:Strengthen LLM output language rule prompt --- .../cli/src/ui/commands/languageCommand.ts | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/packages/cli/src/ui/commands/languageCommand.ts b/packages/cli/src/ui/commands/languageCommand.ts index eee70b98..e9e63cdf 100644 --- a/packages/cli/src/ui/commands/languageCommand.ts +++ b/packages/cli/src/ui/commands/languageCommand.ts @@ -28,27 +28,38 @@ const LLM_OUTPUT_LANGUAGE_RULE_FILENAME = 'output-language.md'; * Generates the LLM output language rule template based on the language name. */ function generateLlmOutputLanguageRule(language: string): string { - return `# ${language} Response Rules + return `# โš ๏ธ CRITICAL: ${language} Output Language Rule - HIGHEST PRIORITY โš ๏ธ -## Core Rules +## ๐Ÿšจ MANDATORY RULE - NO EXCEPTIONS ๐Ÿšจ -**ALL OUTPUTS MUST USE ${language.toUpperCase()}, WITHOUT EXCEPTION.** This includes: conversation replies, tool call results, generated files, documentation, comments, and error messages. Even if the user asks in English, you MUST respond in ${language}. +**YOU MUST RESPOND IN ${language.toUpperCase()} FOR EVERY SINGLE OUTPUT, REGARDLESS OF THE USER'S INPUT LANGUAGE.** -## Tool Call Outputs +This is a **NON-NEGOTIABLE** requirement. Even if the user writes in English, says "hi", asks a simple question, or explicitly requests another language, **YOU MUST ALWAYS RESPOND IN ${language.toUpperCase()}.** -All tool execution result descriptions, success/failure messages, and summary explanations must use ${language}: +## What Must Be in ${language} -- File operations: \`read_file\`, \`write_file\`, \`edit_file\`, etc. -- Code search: \`codebase_search\`, \`grep\`, etc. -- Terminal commands: \`run_terminal_cmd\` execution result descriptions -- Other tools: \`todo_write\`, \`web_search\`, etc. +**EVERYTHING** you output: conversation replies, tool call descriptions, success/error messages, generated file content (comments, documentation), and all explanatory text. -**Examples:** +**Tool outputs**: All descriptive text from \`read_file\`, \`write_file\`, \`codebase_search\`, \`run_terminal_cmd\`, \`todo_write\`, \`web_search\`, etc. MUST be in ${language}. -- โœ… "Successfully read file config.json, contains 15 lines" (translated to ${language}) -- โŒ "Successfully read file config.json, contains 15 lines" (in English when ${language} is required) +## Examples -**Note:** Variable names and function names in code can remain in English, but comments, documentation, and all explanatory text must be in ${language}. +### โœ… CORRECT: +- User says "hi" โ†’ Respond in ${language} (e.g., "Bonjour" if ${language} is French) +- Tool result โ†’ "ๅทฒๆˆๅŠŸ่ฏปๅ–ๆ–‡ไปถ config.json" (if ${language} is Chinese) +- Error โ†’ "ๆ— ๆณ•ๆ‰พๅˆฐๆŒ‡ๅฎš็š„ๆ–‡ไปถ" (if ${language} is Chinese) + +### โŒ WRONG: +- User says "hi" โ†’ "Hello" in English +- Tool result โ†’ "Successfully read file" in English +- Error โ†’ "File not found" in English + +## Notes + +- Code elements (variable/function names, syntax) can remain in English +- Comments, documentation, and all other text MUST be in ${language} + +**THIS RULE IS ACTIVE NOW. ALL OUTPUTS MUST BE IN ${language.toUpperCase()}. NO EXCEPTIONS.** `; }