From f8710a2ef9a314f4cd02137168eee673f301ccce Mon Sep 17 00:00:00 2001 From: Charles Packer Date: Thu, 21 Dec 2023 01:04:05 -0800 Subject: [PATCH] feat: added /summarize command (#667) * added /summarize command * patch and test --- memgpt/main.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/memgpt/main.py b/memgpt/main.py index af2033b143..d456bf925d 100644 --- a/memgpt/main.py +++ b/memgpt/main.py @@ -21,6 +21,7 @@ import memgpt.agent as agent import memgpt.system as system import memgpt.constants as constants +import memgpt.errors as errors from memgpt.cli.cli import run, attach, version, server, open_folder, quickstart from memgpt.cli.cli_config import configure, list, add from memgpt.cli.cli_load import app as load_app @@ -205,6 +206,22 @@ def run_agent_loop(memgpt_agent, first, no_verify=False, cfg=None, strip_ui=Fals break continue + elif user_input.lower() == "/summarize": + try: + memgpt_agent.summarize_messages_inplace() + typer.secho( + f"/summarize succeeded", + fg=typer.colors.GREEN, + bold=True, + ) + except errors.LLMError as e: + typer.secho( + f"/summarize failed:\n{e}", + fg=typer.colors.RED, + bold=True, + ) + continue + # No skip options elif user_input.lower() == "/wipe": memgpt_agent = agent.Agent(interface)