From 47a27c99e8639b6194f6ec5b31cbfb49a4e4b3a6 Mon Sep 17 00:00:00 2001 From: Charles Packer Date: Sat, 21 Oct 2023 16:58:05 -0700 Subject: [PATCH] change pop, since agent.messages is locked --- main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 2c3bfa00..121cef5a 100644 --- a/main.py +++ b/main.py @@ -269,7 +269,8 @@ async def main(): command = user_input.strip().split() amount = int(command[1]) if len(command) > 1 and command[1].isdigit() else 2 print(f"Popping last {amount} messages from stack") - memgpt_agent.messages = memgpt_agent.messages[:-amount] + for _ in range(min(amount, len(memgpt_agent.messages))): + memgpt_agent.messages.pop() continue # No skip options