enable_thinking
This commit is contained in:
parent
fc5c1adaaa
commit
c1bf679166
@ -81,6 +81,8 @@ class AgentConfig:
|
|||||||
messages = []
|
messages = []
|
||||||
|
|
||||||
preamble_text, system_prompt = get_preamble_text(request.language, request.system_prompt)
|
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(
|
config = cls(
|
||||||
bot_id=request.bot_id,
|
bot_id=request.bot_id,
|
||||||
api_key=api_key,
|
api_key=api_key,
|
||||||
@ -92,7 +94,7 @@ class AgentConfig:
|
|||||||
robot_type=request.robot_type,
|
robot_type=request.robot_type,
|
||||||
user_identifier=request.user_identifier,
|
user_identifier=request.user_identifier,
|
||||||
session_id=request.session_id,
|
session_id=request.session_id,
|
||||||
enable_thinking=request.enable_thinking,
|
enable_thinking=enable_thinking,
|
||||||
project_dir=project_dir,
|
project_dir=project_dir,
|
||||||
stream=request.stream,
|
stream=request.stream,
|
||||||
tool_response=request.tool_response,
|
tool_response=request.tool_response,
|
||||||
@ -117,6 +119,8 @@ class AgentConfig:
|
|||||||
messages = []
|
messages = []
|
||||||
language = request.language or bot_config.get("language", "zh")
|
language = request.language or bot_config.get("language", "zh")
|
||||||
preamble_text, system_prompt = get_preamble_text(language, bot_config.get("system_prompt"))
|
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(
|
config = cls(
|
||||||
bot_id=request.bot_id,
|
bot_id=request.bot_id,
|
||||||
api_key=bot_config.get("api_key"),
|
api_key=bot_config.get("api_key"),
|
||||||
@ -128,7 +132,7 @@ class AgentConfig:
|
|||||||
robot_type=bot_config.get("robot_type", "general_agent"),
|
robot_type=bot_config.get("robot_type", "general_agent"),
|
||||||
user_identifier=request.user_identifier,
|
user_identifier=request.user_identifier,
|
||||||
session_id=request.session_id,
|
session_id=request.session_id,
|
||||||
enable_thinking=request.enable_thinking,
|
enable_thinking=enable_thinking,
|
||||||
project_dir=project_dir,
|
project_dir=project_dir,
|
||||||
stream=request.stream,
|
stream=request.stream,
|
||||||
tool_response=request.tool_response,
|
tool_response=request.tool_response,
|
||||||
@ -183,4 +187,4 @@ class AgentConfig:
|
|||||||
cache_hash = hashlib.sha256(cache_string.encode('utf-8')).hexdigest()
|
cache_hash = hashlib.sha256(cache_string.encode('utf-8')).hexdigest()
|
||||||
|
|
||||||
# 返回带有前缀的缓存键,便于调试
|
# 返回带有前缀的缓存键,便于调试
|
||||||
return f"agent_cache_{cache_hash[:16]}" # 使用前16位哈希值
|
return f"agent_cache_{cache_hash[:16]}" # 使用前16位哈希值
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user