From 4d4a780ab7b60254ba0422b74cd30a10d8e86718 Mon Sep 17 00:00:00 2001 From: Eternity <1533512157@qq.com> Date: Thu, 26 Mar 2026 12:05:53 +0800 Subject: [PATCH] style(memory): Pref an anomaly in the message null check logic. --- .../core/memory/agent/langgraph_graph/routing/write_router.py | 2 +- api/app/services/memory_agent_service.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/api/app/core/memory/agent/langgraph_graph/routing/write_router.py b/api/app/core/memory/agent/langgraph_graph/routing/write_router.py index 6176caf5..2074b6ca 100644 --- a/api/app/core/memory/agent/langgraph_graph/routing/write_router.py +++ b/api/app/core/memory/agent/langgraph_graph/routing/write_router.py @@ -178,7 +178,7 @@ async def window_dialogue(end_user_id, langchain_messages, memory_config, scope) count_store.update_sessions_count(end_user_id, is_end_user_id, langchain_messages) elif int(is_end_user_id) == int(scope): logger.info('写入长期记忆NEO4J') - formatted_messages = (redis_messages) + formatted_messages = redis_messages # Get config_id (if memory_config is an object, extract config_id; otherwise use directly) if hasattr(memory_config, 'config_id'): config_id = memory_config.config_id diff --git a/api/app/services/memory_agent_service.py b/api/app/services/memory_agent_service.py index e5c34492..289fd74c 100644 --- a/api/app/services/memory_agent_service.py +++ b/api/app/services/memory_agent_service.py @@ -357,6 +357,7 @@ class MemoryAgentService: if file_object is None: continue message["file_content"].append((file_object, file["type"])) + logger.info(messages) message_text = "\n".join([f"{msg['role']}: {msg['content']}" for msg in messages]) try: @@ -606,7 +607,7 @@ class MemoryAgentService: retrieved_content.append({query: statements}) # 如果 retrieved_content 为空,设置为空字符串 - if retrieved_content == []: + if not retrieved_content: retrieved_content = '' # 只有当回答不是"信息不足"且不是快速检索时才保存