diff --git a/api/app/services/app_chat_service.py b/api/app/services/app_chat_service.py index ec046013..56400c92 100644 --- a/api/app/services/app_chat_service.py +++ b/api/app/services/app_chat_service.py @@ -113,8 +113,8 @@ class AppChatService: web_tools = config.tools web_search_choice = web_tools.get("web_search", {}) web_search_enable = web_search_choice.get("enabled", False) - if web_search == True: - if web_search_enable == True: + if web_search: + if web_search_enable: search_tool = create_web_search_tool({}) tools.append(search_tool) @@ -263,8 +263,8 @@ class AppChatService: web_tools = config.tools web_search_choice = web_tools.get("web_search", {}) web_search_enable = web_search_choice.get("enabled", False) - if web_search == True: - if web_search_enable == True: + if web_search: + if web_search_enable: search_tool = create_web_search_tool({}) tools.append(search_tool) diff --git a/api/app/services/draft_run_service.py b/api/app/services/draft_run_service.py index cdbb213e..6f89eaa9 100644 --- a/api/app/services/draft_run_service.py +++ b/api/app/services/draft_run_service.py @@ -315,8 +315,8 @@ class DraftRunService: web_tools = agent_config.tools web_search_choice = web_tools.get("web_search", {}) web_search_enable = web_search_choice.get("enabled", False) - if web_search == True: - if web_search_enable == True: + if web_search: + if web_search_enable: search_tool = create_web_search_tool({}) tools.append(search_tool) @@ -523,7 +523,7 @@ class DraftRunService: tool_service = ToolService(self.db) # 从配置中获取启用的工具 - if hasattr(agent_config, 'tools') and agent_config.tools and isinstance(agent_config.tools, dict): + if hasattr(agent_config, 'tools') and agent_config.tools and isinstance(agent_config.tools, list): for tool_config in agent_config.tools: if tool_config.get("enabled", False): # 根据工具名称查找工具实例 @@ -540,8 +540,8 @@ class DraftRunService: web_tools = agent_config.tools web_search_choice = web_tools.get("web_search", {}) web_search_enable = web_search_choice.get("enabled", False) - if web_search == True: - if web_search_enable == True: + if web_search: + if web_search_enable: search_tool = create_web_search_tool({}) tools.append(search_tool) diff --git a/api/app/services/shared_chat_service.py b/api/app/services/shared_chat_service.py index 6bf96eb5..e5247e5e 100644 --- a/api/app/services/shared_chat_service.py +++ b/api/app/services/shared_chat_service.py @@ -209,7 +209,7 @@ class SharedChatService: # 添加长期记忆工具 memory_flag=False - if memory==True: + if memory: memory_config = config.get("memory", {}) if memory_config.get("enabled") and user_id: memory_flag=True @@ -219,8 +219,8 @@ class SharedChatService: web_tools=config.get("tools") web_search_choice = web_tools.get("web_search", {}) web_search_enable = web_search_choice.get("enabled",False) - if web_search==True: - if web_search_enable==True: + if web_search: + if web_search_enable: search_tool = create_web_search_tool({}) tools.append(search_tool) @@ -413,8 +413,8 @@ class SharedChatService: web_tools = config.get("tools") web_search_choice = web_tools.get("web_search", {}) web_search_enable = web_search_choice.get("enabled", False) - if web_search == True: - if web_search_enable == True: + if web_search: + if web_search_enable: search_tool = create_web_search_tool({}) tools.append(search_tool)