From bca1f9ba8c74eefa08be31fb46d264f8b33e28b0 Mon Sep 17 00:00:00 2001 From: Charles Packer Date: Mon, 8 Apr 2024 22:40:11 -0700 Subject: [PATCH] fix: patched pop (#1232) --- memgpt/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/memgpt/main.py b/memgpt/main.py index 5334b4f0..d8d31aae 100644 --- a/memgpt/main.py +++ b/memgpt/main.py @@ -11,6 +11,7 @@ from memgpt.constants import FUNC_FAILED_HEARTBEAT_MESSAGE, JSON_ENSURE_ASCII, J console = Console() +from memgpt.agent import save_agent from memgpt.agent_store.storage import StorageConnector, TableType from memgpt.interface import CLIInterface as interface # for printing to terminal from memgpt.config import MemGPTConfig @@ -192,7 +193,9 @@ def run_agent_loop(memgpt_agent, config: MemGPTConfig, first, ms: MetadataStore, else: print(f"Popping last {pop_amount} messages from stack") for _ in range(min(pop_amount, len(memgpt_agent.messages))): - memgpt_agent.messages.pop() + memgpt_agent._messages.pop() + # Persist the state + save_agent(agent=memgpt_agent, ms=ms) continue elif user_input.lower() == "/retry":