KiroProxy User commited on
Commit
ba83dca
·
1 Parent(s): 703f1ac

Update thinking.py with latest changes

Browse files
Files changed (1) hide show
  1. KiroProxy/kiro_proxy/core/thinking.py +28 -31
KiroProxy/kiro_proxy/core/thinking.py CHANGED
@@ -333,41 +333,38 @@ def build_thinking_prompt(
333
  budget_str = ""
334
  if budget_tokens:
335
  budget_str = f" (Budget: {budget_tokens} tokens)"
336
-
337
- # 根据是否有工具结果调整提示
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  if has_tool_results:
339
  return (
340
- f"[INTERNAL REASONING PHASE]{budget_str}\n\n"
341
- "You have received tool execution results. Based on the COMPLETE conversation history above, "
342
- "think through what these results mean and plan your response.\n\n"
343
- "CRITICAL CONSTRAINTS:\n"
344
- "- DO NOT call any tools in this thinking phase - analysis only\n"
345
- "- DO NOT output JSON tool calls or function_call structures\n"
346
- "- Output ONLY plain text reasoning\n"
347
- "- IMPORTANT: Think in the SAME LANGUAGE as the user's request\n\n"
348
- "Think about:\n"
349
- "1. What was the user's original request (from conversation history)?\n"
350
- "2. What do the tool results tell us?\n"
351
- "3. Is the task complete, or are more steps needed?\n"
352
- "4. How should I synthesize this into a helpful response?\n\n"
353
- f"Current input: {user_content}"
354
  )
355
-
356
  return (
357
- f"[INTERNAL REASONING PHASE]{budget_str}\n\n"
358
- "Based on the conversation history above (if any), analyze the current request thoroughly.\n\n"
359
- "CRITICAL CONSTRAINTS:\n"
360
- "- DO NOT call any tools - planning and analysis only\n"
361
- "- DO NOT output JSON tool calls, function_call, or tool_use structures\n"
362
- "- Output ONLY plain text reasoning\n"
363
- "- IMPORTANT: Think in the SAME LANGUAGE as the user's request\n\n"
364
- "Think about:\n"
365
- "1. Break down the problem into components\n"
366
- "2. Consider multiple approaches and perspectives\n"
367
- "3. Evaluate trade-offs and edge cases\n"
368
- "4. Plan what actions/tools would be needed (without executing)\n"
369
- "5. Synthesize into a coherent strategy\n\n"
370
- f"Current request: {user_content}"
371
  )
372
 
373
 
 
333
  budget_str = ""
334
  if budget_tokens:
335
  budget_str = f" (Budget: {budget_tokens} tokens)"
336
+
337
+ language_instruction = ""
338
+ if user_content and any("\u4e00" <= c <= "\u9fff" for c in user_content):
339
+ language_instruction = "你必须用中文进行思考和推理。输出必须是中文,不要使用英文。"
340
+ elif user_content:
341
+ language_instruction = "Your reasoning MUST be in the same language as the user's message."
342
+
343
+ common_rules = (
344
+ f"[Internal Reasoning - Not Visible to User]{budget_str}\n\n"
345
+ "Role: This is the THINKING/PLANNING phase. It is ONLY for internal reasoning before producing the final answer.\n"
346
+ "This text will be injected as hidden context to improve the next response.\n\n"
347
+ "Hard rules (must follow):\n"
348
+ "1) Output plain-text reasoning ONLY. Do NOT output any structured tags/markup.\n"
349
+ "2) Do NOT output any tool calls or tool-call formats (e.g. <tool_use>, tool_use, function_call, Bash, TodoWrite, JSON action blocks).\n"
350
+ "3) Do NOT promise or describe executing commands/tools. Only analyze, break down, plan, and assess risks.\n"
351
+ f"4) {language_instruction}\n"
352
+ )
353
+
354
  if has_tool_results:
355
  return (
356
+ f"{common_rules}\n\n"
357
+ "Task: Analyze the tool results in the conversation history above. Summarize what you learned and plan next steps.\n"
358
+ "Suggested structure:\n"
359
+ "- Key findings\n"
360
+ "- Unknowns / missing info\n"
361
+ "- Next-step plan (plan only; do not write tool calls)"
 
 
 
 
 
 
 
 
362
  )
363
+
364
  return (
365
+ f"{common_rules}\n\n"
366
+ "Task: Analyze the user's request and plan your approach (planning only; do not execute).\n"
367
+ f"User input: {user_content}"
 
 
 
 
 
 
 
 
 
 
 
368
  )
369
 
370