mirror of
https://github.com/tcsenpai/agenticSeek.git
synced 2025-06-07 11:35:29 +00:00
fix : memory recovery bug
This commit is contained in:
parent
24329aa3d2
commit
697bc882c7
@ -33,7 +33,6 @@ class Agent():
|
|||||||
def __init__(self, name: str,
|
def __init__(self, name: str,
|
||||||
prompt_path:str,
|
prompt_path:str,
|
||||||
provider,
|
provider,
|
||||||
recover_last_session=True,
|
|
||||||
verbose=False,
|
verbose=False,
|
||||||
browser=None) -> None:
|
browser=None) -> None:
|
||||||
"""
|
"""
|
||||||
@ -53,7 +52,7 @@ class Agent():
|
|||||||
self.current_directory = os.getcwd()
|
self.current_directory = os.getcwd()
|
||||||
self.llm = provider
|
self.llm = provider
|
||||||
self.memory = Memory(self.load_prompt(prompt_path),
|
self.memory = Memory(self.load_prompt(prompt_path),
|
||||||
recover_last_session=recover_last_session,
|
recover_last_session=False, # session recovery in handled by the interaction class
|
||||||
memory_compression=False)
|
memory_compression=False)
|
||||||
self.tools = {}
|
self.tools = {}
|
||||||
self.blocks_result = []
|
self.blocks_result = []
|
||||||
|
@ -28,7 +28,7 @@ class Interaction:
|
|||||||
if tts_enabled:
|
if tts_enabled:
|
||||||
self.speech.speak("Hello, we are online and ready. What can I do for you ?")
|
self.speech.speak("Hello, we are online and ready. What can I do for you ?")
|
||||||
if recover_last_session:
|
if recover_last_session:
|
||||||
self.recover_last_session()
|
self.load_last_session()
|
||||||
|
|
||||||
def find_ai_name(self) -> str:
|
def find_ai_name(self) -> str:
|
||||||
"""Find the name of the default AI. It is required for STT as a trigger word."""
|
"""Find the name of the default AI. It is required for STT as a trigger word."""
|
||||||
@ -39,7 +39,7 @@ class Interaction:
|
|||||||
break
|
break
|
||||||
return ai_name
|
return ai_name
|
||||||
|
|
||||||
def recover_last_session(self):
|
def load_last_session(self):
|
||||||
"""Recover the last session."""
|
"""Recover the last session."""
|
||||||
for agent in self.agents:
|
for agent in self.agents:
|
||||||
agent.memory.load_memory(agent.type)
|
agent.memory.load_memory(agent.type)
|
||||||
|
@ -25,8 +25,10 @@ class Memory():
|
|||||||
self.session_time = datetime.datetime.now()
|
self.session_time = datetime.datetime.now()
|
||||||
self.session_id = str(uuid.uuid4())
|
self.session_id = str(uuid.uuid4())
|
||||||
self.conversation_folder = f"conversations/"
|
self.conversation_folder = f"conversations/"
|
||||||
|
self.session_recovered = False
|
||||||
if recover_last_session:
|
if recover_last_session:
|
||||||
self.load_memory()
|
self.load_memory()
|
||||||
|
self.session_recovered = True
|
||||||
# memory compression system
|
# memory compression system
|
||||||
self.model = "pszemraj/led-base-book-summary"
|
self.model = "pszemraj/led-base-book-summary"
|
||||||
self.device = self.get_cuda_device()
|
self.device = self.get_cuda_device()
|
||||||
@ -65,6 +67,8 @@ class Memory():
|
|||||||
|
|
||||||
def load_memory(self, agent_type: str = "casual_agent") -> None:
|
def load_memory(self, agent_type: str = "casual_agent") -> None:
|
||||||
"""Load the memory from the last session."""
|
"""Load the memory from the last session."""
|
||||||
|
if self.session_recovered == True:
|
||||||
|
return
|
||||||
save_path = os.path.join(self.conversation_folder, agent_type)
|
save_path = os.path.join(self.conversation_folder, agent_type)
|
||||||
if not os.path.exists(save_path):
|
if not os.path.exists(save_path):
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user