From 845a2da4e2e3242b5edf6abc65e2f8baf138205d Mon Sep 17 00:00:00 2001 From: Mery-Sanz Date: Mon, 16 Jun 2025 12:56:45 +0200 Subject: [PATCH 1/2] fix toolbar error --- src/cai/repl/commands/memory.py | 3 ++- src/cai/repl/ui/toolbar.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cai/repl/commands/memory.py b/src/cai/repl/commands/memory.py index 67c6bfd6..f69c8600 100644 --- a/src/cai/repl/commands/memory.py +++ b/src/cai/repl/commands/memory.py @@ -906,7 +906,8 @@ Model: {get_compact_model() or os.environ.get("CAI_MODEL", "gpt-4")} # Register the memory in the index self._register_memory(memory_id, memory_name) - + + os.environ['CAI_MEMORY'] = 'true' console.print(f"[green]✓ Saved memory: {memory_name} (ID: {memory_id})[/green]") # Automatically apply the memory to the agent's system prompt diff --git a/src/cai/repl/ui/toolbar.py b/src/cai/repl/ui/toolbar.py index b073dc75..06b1e70f 100644 --- a/src/cai/repl/ui/toolbar.py +++ b/src/cai/repl/ui/toolbar.py @@ -157,8 +157,8 @@ def update_toolbar_in_background(): auto_compact_color = "ansired" # Get memory status - memory_enabled = os.getenv('CAI_MEMORY', 'false').lower() != 'false' - memory_str = os.getenv('CAI_MEMORY', 'false') if memory_enabled else "✗" + memory_enabled = os.getenv('CAI_MEMORY', 'false').lower() == 'true' + memory_str = "✓" if memory_enabled else "✗" memory_color = "ansigreen" if memory_enabled else "ansigray" # Get streaming status From 9a55d6ef32059447dc9cdba37079eea8e52d8756 Mon Sep 17 00:00:00 2001 From: Mery-Sanz Date: Mon, 16 Jun 2025 13:19:29 +0200 Subject: [PATCH 2/2] add in apply --- src/cai/repl/commands/memory.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cai/repl/commands/memory.py b/src/cai/repl/commands/memory.py index f69c8600..54ef4c32 100644 --- a/src/cai/repl/commands/memory.py +++ b/src/cai/repl/commands/memory.py @@ -438,6 +438,7 @@ Model: {get_compact_model() or os.environ.get("CAI_MODEL", "gpt-4")} COMPACTED_SUMMARIES[agent_name] = summary APPLIED_MEMORY_IDS[agent_name] = memory_id console.print(f"[green]✓ Memory {memory_id} automatically applied to {agent_name}'s system prompt[/green]") + os.environ['CAI_MEMORY'] = 'true' # Reload the agent with the new memory self._reload_agent_with_memory(agent_name) @@ -566,6 +567,7 @@ Model: {get_compact_model() or os.environ.get("CAI_MODEL", "gpt-4")} console.print(f"[red]Error applying memory to {agent_name}: {e}[/red]") if success_count > 0: + os.environ['CAI_MEMORY'] = 'true' console.print("[dim]The memory will be included in the agents' system prompts[/dim]") # Show summary with ID if available (only once) @@ -1007,7 +1009,7 @@ Model: {get_compact_model() or os.environ.get("CAI_MODEL", "gpt-4")} self._register_memory(memory_id, memory_name) console.print(f"[green]✓ Saved memory: {memory_name} (ID: {memory_id})[/green]") - + os.environ['CAI_MEMORY'] = 'true' # Automatically apply the memory to the agent's system prompt COMPACTED_SUMMARIES[agent_name] = summary APPLIED_MEMORY_IDS[agent_name] = memory_id