style(memory): Pref an anomaly in the message null check logic.
This commit is contained in:
@@ -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)
|
count_store.update_sessions_count(end_user_id, is_end_user_id, langchain_messages)
|
||||||
elif int(is_end_user_id) == int(scope):
|
elif int(is_end_user_id) == int(scope):
|
||||||
logger.info('写入长期记忆NEO4J')
|
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)
|
# Get config_id (if memory_config is an object, extract config_id; otherwise use directly)
|
||||||
if hasattr(memory_config, 'config_id'):
|
if hasattr(memory_config, 'config_id'):
|
||||||
config_id = memory_config.config_id
|
config_id = memory_config.config_id
|
||||||
|
|||||||
@@ -357,6 +357,7 @@ class MemoryAgentService:
|
|||||||
if file_object is None:
|
if file_object is None:
|
||||||
continue
|
continue
|
||||||
message["file_content"].append((file_object, file["type"]))
|
message["file_content"].append((file_object, file["type"]))
|
||||||
|
logger.info(messages)
|
||||||
|
|
||||||
message_text = "\n".join([f"{msg['role']}: {msg['content']}" for msg in messages])
|
message_text = "\n".join([f"{msg['role']}: {msg['content']}" for msg in messages])
|
||||||
try:
|
try:
|
||||||
@@ -606,7 +607,7 @@ class MemoryAgentService:
|
|||||||
retrieved_content.append({query: statements})
|
retrieved_content.append({query: statements})
|
||||||
|
|
||||||
# 如果 retrieved_content 为空,设置为空字符串
|
# 如果 retrieved_content 为空,设置为空字符串
|
||||||
if retrieved_content == []:
|
if not retrieved_content:
|
||||||
retrieved_content = ''
|
retrieved_content = ''
|
||||||
|
|
||||||
# 只有当回答不是"信息不足"且不是快速检索时才保存
|
# 只有当回答不是"信息不足"且不是快速检索时才保存
|
||||||
|
|||||||
Reference in New Issue
Block a user