diff --git a/api/app/core/memory/agent/langgraph_graph/write_graph.py b/api/app/core/memory/agent/langgraph_graph/write_graph.py index 5101fa29..9547c866 100644 --- a/api/app/core/memory/agent/langgraph_graph/write_graph.py +++ b/api/app/core/memory/agent/langgraph_graph/write_graph.py @@ -49,7 +49,7 @@ async def long_term_storage(long_term_type:str="chunk",langchain_messages:list=[ db_session = next(get_db()) config_service = MemoryConfigService(db_session) memory_config = config_service.load_memory_config( - config_id="08ed205c-0f05-49c3-8e0c-a580d28f5fd4", # 改为整数 + config_id=memory_config, # 改为整数 service_name="MemoryAgentService" ) if long_term_type=='chunk': @@ -59,7 +59,6 @@ async def long_term_storage(long_term_type:str="chunk",langchain_messages:list=[ """时间""" await memory_long_term_storage(end_user_id, memory_config,5) if long_term_type=='aggregate': - """方案三:聚合判断""" await aggregate_judgment(end_user_id, langchain_messages, memory_config) diff --git a/api/app/services/draft_run_service.py b/api/app/services/draft_run_service.py index 9a3e1d37..43073555 100644 --- a/api/app/services/draft_run_service.py +++ b/api/app/services/draft_run_service.py @@ -110,6 +110,8 @@ def create_long_term_memory_tool(memory_config: Dict[str, Any], end_user_id: str result = task_service.get_task_memory_read_result(task.id) status = result.get("status") logger.info(f"读取任务状态:{status}") + if memory_content: + memory_content = memory_content['answer'] finally: db.close() @@ -123,7 +125,6 @@ def create_long_term_memory_tool(memory_config: Dict[str, Any], end_user_id: str "content_length": len(str(memory_content)) } ) - return f"检索到以下历史记忆:\n\n{memory_content}" except Exception as e: logger.error("长期记忆检索失败", extra={"error": str(e), "error_type": type(e).__name__})