Browse Source

clean_agent

丁云鹏 5 days ago
parent
commit
948fdb6fbb
1 changed files with 7 additions and 2 deletions
  1. 7 2
      agents/clean_agent/agent.py

+ 7 - 2
agents/clean_agent/agent.py

@@ -10,6 +10,10 @@ from langgraph.prebuilt import ToolNode, tools_condition
 from langgraph.checkpoint.memory import InMemorySaver
 import requests
 from dotenv import load_dotenv
+from utils.logging_config import get_logger
+
+# 配置日志
+logger = get_logger('CleanAgent')
 
 # 加载环境变量
 load_dotenv()
@@ -85,9 +89,10 @@ def execute_agent_with_api(user_input: str):
                 graph_builder.add_edge("tools", "chatbot")
                 graph_builder.add_edge(START, "chatbot")
                 
-                memory = InMemorySaver()
-                graph = graph_builder.compile(checkpointer=memory)
+                # memory = InMemorySaver()
+                # graph = graph_builder.compile(checkpointer=memory)
             except Exception as e:
+                logger.error(f"初始化Agent失败: {str(e)}")
                 return f"初始化Agent失败: {str(e)}"
         
         # 生成唯一的线程ID