记忆模块全部测试完毕

This commit is contained in:
didi 2023-10-04 23:19:47 +08:00
parent 11bef70fd7
commit 4e4a3bce58
2 changed files with 11 additions and 11 deletions

View file

@ -174,18 +174,16 @@ class AgentMemory(Memory):
poignancy = node_details["poignancy"]
keywords = set(node_details["keywords"])
filling = node_details["filling"]
# print(node_type)
if node_type == "event":
self.add_event(created, expiration, s, p, o,
description, keywords, poignancy, embedding_pair, filling)
elif node_type == "chat":
# cause_by = node_details["cause_by"]
logger.info(f"{node_id}")
self.add_chat(created, expiration, s, p, o,
description, keywords, poignancy, embedding_pair, filling)
elif node_type == "thought":
if node_details["type"] == "thought":
self.add_thought(created, expiration, s, p, o,
description, keywords, poignancy, embedding_pair, filling)
if node_details["type"] == "event":
self.add_event(created, expiration, s, p, o,
description, keywords, poignancy, embedding_pair, filling)
if node_details["type"] == "chat":
self.add_chat(created, expiration, s, p, o,
description, keywords, poignancy, embedding_pair, filling)
strength_keywords_load = json.load(open(memory_saved + "/kw_strength.json"))
if strength_keywords_load["kw_strength_event"]:
@ -209,6 +207,7 @@ class AgentMemory(Memory):
return
if memory_basic.memory_type == "event":
self.event_list[0:0] = [memory_basic]
return
def add_chat(self, created, expiration, s, p, o,
content, keywords, poignancy,
@ -250,7 +249,7 @@ class AgentMemory(Memory):
"""
memory_count = len(self.storage) + 1
type_count = len(self.thought_list) + 1
memory_type = "event"
memory_type = "thought"
memory_id = f"node_{str(memory_count)}"
depth = 1

View file

@ -44,6 +44,7 @@ class TestAgentMemory:
def test_summary_function(self, agent_memory):
logger.info(f"event长度为{len(agent_memory.event_list)}")
logger.info(f"thought长度为{len(agent_memory.thought_list)}")
logger.info(f"chat长度为{len(agent_memory.chat_list)}")
result1 = agent_memory.get_summarized_latest_events(4)
logger.info(f"总结最近事件结果为:{result1}")
def test_get_last_chat_function(self,agent_memory):