Get all chat sessions, ordered by most recent
(self, limit: int = 50)
| 122 | return session_id |
| 123 | |
| 124 | def get_sessions(self, limit: int = 50) -> List[Dict]: |
| 125 | """Get all chat sessions, ordered by most recent""" |
| 126 | conn = sqlite3.connect(self.db_path) |
| 127 | conn.row_factory = sqlite3.Row |
| 128 | |
| 129 | cursor = conn.execute(''' |
| 130 | SELECT id, title, created_at, updated_at, model_used, message_count |
| 131 | FROM sessions |
| 132 | ORDER BY updated_at DESC |
| 133 | LIMIT ? |
| 134 | ''', (limit,)) |
| 135 | |
| 136 | sessions = [dict(row) for row in cursor.fetchall()] |
| 137 | conn.close() |
| 138 | |
| 139 | return sessions |
| 140 | |
| 141 | def get_session(self, session_id: str) -> Optional[Dict]: |
| 142 | """Get a specific session""" |
no outgoing calls
no test coverage detected