From ff51b620a939e10b1f2adde611d1ecead5657f72 Mon Sep 17 00:00:00 2001 From: Occupying-Mars Date: Tue, 3 Dec 2024 11:24:18 +0530 Subject: [PATCH] bug fix --- swarms/structs/agent.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/swarms/structs/agent.py b/swarms/structs/agent.py index 48c4ff63..c9160b1b 100644 --- a/swarms/structs/agent.py +++ b/swarms/structs/agent.py @@ -1621,11 +1621,16 @@ class Agent: files = os.listdir(self.docs_folder) # Extract the text from the files + # Process each file and combine their contents + all_text = "" for file in files: - text = data_to_text(file) + file_path = os.path.join(self.docs_folder, file) + text = data_to_text(file_path) + all_text += f"\nContent from {file}:\n{text}\n" + # Add the combined content to memory return self.short_memory.add( - role=self.user_name, content=text + role=self.user_name, content=all_text ) except Exception as error: logger.error(