Skip to content

Commit 6f7d4a0

Browse files
committed
/last now loads logs/last by default
Previous behavior maintained, wherein if /loads <log-path> is provided, then the corresponding <log-path> will be used. Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com>
1 parent 274d682 commit 6f7d4a0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/cai/repl/commands/load.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self):
2525
"""Initialize the load command."""
2626
super().__init__(
2727
name="/load",
28-
description="Load a jsonl into the context of the current session",
28+
description="Load a jsonl into the context of the current session (uses logs/last if no file specified)",
2929
aliases=["/l"]
3030
)
3131

@@ -44,17 +44,18 @@ def handle_load_command(self, args: List[str]) -> bool:
4444
"""Load a jsonl into the context of the current session.
4545
4646
Args:
47-
args: List containing the PID to kill
47+
args: List containing the jsonl file path (optional)
4848
4949
Returns:
5050
bool: True if the jsonl was loaded successfully
5151
"""
52+
# Use logs/last if no arguments provided
5253
if not args:
53-
console.print("[red]Error: No jsonl file specified[/red]")
54-
return False
54+
jsonl_file = "logs/last"
55+
else:
56+
jsonl_file = args[0]
5557

5658
try:
57-
jsonl_file = args[0]
5859
# Try to load the jsonl file
5960
try:
6061
# fetch messages from JSONL file
@@ -64,6 +65,7 @@ def handle_load_command(self, args: List[str]) -> bool:
6465
# If killing the process group fails, try killing just the
6566
# process
6667
console.print(f"[red]Error: Failed to load jsonl file {jsonl_file}[/red]")
68+
return False
6769

6870
# add them to message_history
6971
for message in messages:

0 commit comments

Comments
 (0)