change agent.py

pull/741/head
Occupying-Mars 3 months ago
parent b408fafba8
commit 780ab3be0c

@ -1579,10 +1579,7 @@ class Agent:
""" """
try: try:
# Reinitialize conversation if needed # Reinitialize conversation if needed
if ( if not hasattr(self, "short_memory") or self.short_memory is None:
not hasattr(self, "short_memory")
or self.short_memory is None
):
self.short_memory = Conversation( self.short_memory = Conversation(
system_prompt=self.system_prompt, system_prompt=self.system_prompt,
time_enabled=True, time_enabled=True,
@ -1590,11 +1587,8 @@ class Agent:
rules=self.rules, rules=self.rules,
) )
# Reinitialize executor if needed # Always create a new executor, ignoring any saved state
if not hasattr(self, "executor") or self.executor is None: self.executor = ThreadPoolExecutor(max_workers=os.cpu_count())
self.executor = ThreadPoolExecutor(
max_workers=os.cpu_count()
)
# # Reinitialize tool structure if needed # # Reinitialize tool structure if needed
# if hasattr(self, 'tools') and (self.tools or getattr(self, 'list_base_models', None)): # if hasattr(self, 'tools') and (self.tools or getattr(self, 'list_base_models', None)):

Loading…
Cancel
Save