Skip to content

Commit 6e2ec57

Browse files
committed
fix: restore model from saved session on resume
When resuming a session, the saved model name was loaded but never applied to the LLM instance, so it always fell back to the default. Now the model is restored unless explicitly overridden via -m flag. Closes #2
1 parent d4f8da7 commit 6e2ec57

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

nanocoder/cli.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ def main():
7575
loaded = load_session(args.resume)
7676
if loaded:
7777
agent.messages, loaded_model = loaded
78-
console.print(f"[green]Resumed session: {args.resume}[/green]")
78+
# restore the model from the saved session unless overridden by CLI
79+
if not args.model:
80+
agent.llm.model = loaded_model
81+
config.model = loaded_model
82+
console.print(f"[green]Resumed session: {args.resume} (model: {agent.llm.model})[/green]")
7983
else:
8084
console.print(f"[red]Session '{args.resume}' not found.[/red]")
8185
sys.exit(1)

0 commit comments

Comments
 (0)