Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fixed load loading from wrong directory (#237)

Charles Packer8e35c44881ee
diff --git a/memgpt/main.py b/memgpt/main.py
index bd984c92e..2df984619 100644
--- a/memgpt/main.py
+++ b/memgpt/main.py
@@ -97,12 +97,14 @@ def load(memgpt_agent, filename):
print(f"Loading {filename} failed with: {e}")
else:
# Load the latest file
- print(f"/load warning: no checkpoint specified, loading most recent checkpoint instead")
- json_files = glob.glob("saved_state/*.json") # This will list all .json files in the current directory.
+ save_path = f"{constants.MEMGPT_DIR}/saved_state"
+ print(f"/load warning: no checkpoint specified, loading most recent checkpoint from {save_path} instead")
+ json_files = glob.glob(f"{save_path}/*.json") # This will list all .json files in the current directory.
# Check if there are any json files.
if not json_files:
print(f"/load error: no .json checkpoint files found")
+ return
else:
# Sort files based on modified timestamp, with the latest file being the first.
filename = max(json_files, key=os.path.getmtime)