Skip to content

Commit 3e81c75

Browse files
committed
keep saved conversations loadable and out of the working directory
1 parent c7c5be5 commit 3e81c75

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

swarms/structs/conversation.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,14 @@ def setup_file_path(self):
163163
extension = (
164164
".json" if self.export_method == "json" else ".yaml"
165165
)
166-
self.save_filepath = (
167-
f"conversation_{self.name}{extension}"
166+
# Under conversations_dir, not the process's working directory:
167+
# a bare relative name dropped conversation_<name>.json wherever
168+
# the program happened to run from, and two conversations sharing
169+
# a name in different directories silently loaded each other's
170+
# history.
171+
self.save_filepath = os.path.join(
172+
self.conversations_dir or get_conversation_dir(),
173+
f"conversation_{self.name}{extension}",
168174
)
169175
logger.debug(
170176
f"Setting default save filepath to: {self.save_filepath}"

0 commit comments

Comments
 (0)