diff --git a/agent/agent_config.py b/agent/agent_config.py index 2ffa312..a7fbb62 100644 --- a/agent/agent_config.py +++ b/agent/agent_config.py @@ -81,6 +81,8 @@ class AgentConfig: messages = [] preamble_text, system_prompt = get_preamble_text(request.language, request.system_prompt) + enable_thinking = request.enable_thinking and "```guideline" in request.system_prompt + config = cls( bot_id=request.bot_id, api_key=api_key, @@ -92,7 +94,7 @@ class AgentConfig: robot_type=request.robot_type, user_identifier=request.user_identifier, session_id=request.session_id, - enable_thinking=request.enable_thinking, + enable_thinking=enable_thinking, project_dir=project_dir, stream=request.stream, tool_response=request.tool_response, @@ -117,6 +119,8 @@ class AgentConfig: messages = [] language = request.language or bot_config.get("language", "zh") preamble_text, system_prompt = get_preamble_text(language, bot_config.get("system_prompt")) + enable_thinking = request.enable_thinking and "```guideline" in request.system_prompt + config = cls( bot_id=request.bot_id, api_key=bot_config.get("api_key"), @@ -128,7 +132,7 @@ class AgentConfig: robot_type=bot_config.get("robot_type", "general_agent"), user_identifier=request.user_identifier, session_id=request.session_id, - enable_thinking=request.enable_thinking, + enable_thinking=enable_thinking, project_dir=project_dir, stream=request.stream, tool_response=request.tool_response, @@ -183,4 +187,4 @@ class AgentConfig: cache_hash = hashlib.sha256(cache_string.encode('utf-8')).hexdigest() # 返回带有前缀的缓存键,便于调试 - return f"agent_cache_{cache_hash[:16]}" # 使用前16位哈希值 \ No newline at end of file + return f"agent_cache_{cache_hash[:16]}" # 使用前16位哈希值