Get the latest session ID. Returns: Session ID or empty string if none found
(working_dir: Path)
| 80 | |
| 81 | |
| 82 | def load_latest_session(working_dir: Path) -> str: |
| 83 | """ |
| 84 | Get the latest session ID. |
| 85 | |
| 86 | Returns: |
| 87 | Session ID or empty string if none found |
| 88 | """ |
| 89 | session_manager = SessionManager(working_dir) |
| 90 | sessions = session_manager.list_sessions() |
| 91 | |
| 92 | if not sessions: |
| 93 | show_warning("No saved sessions found") |
| 94 | return "" |
| 95 | |
| 96 | # Sort by modified date |
| 97 | sorted_sessions = sorted(sessions, key=lambda s: s.metadata.modified_at, reverse=True) |
| 98 | latest = sorted_sessions[0] |
| 99 | |
| 100 | show_success(f"Continuing session: {latest.metadata.name}") |
| 101 | console.print(f"[dim]Last modified: {latest.metadata.modified_at.strftime('%Y-%m-%d %H:%M')}[/dim]") |
| 102 | console.print(f"[dim]Messages: {latest.metadata.message_count}[/dim]\n") |
| 103 | |
| 104 | return latest.id |
| 105 | |
| 106 | |
| 107 | def detect_gpu_info(): |
no test coverage detected