MCPcopy
hub / github.com/PromtEngineer/localGPT / get_sessions

Method get_sessions

backend/database.py:124–139  ·  view source on GitHub ↗

Get all chat sessions, ordered by most recent

(self, limit: int = 50)

Source from the content-addressed store, hash-verified

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"""

Callers 2

database.pyFile · 0.80
handle_get_sessionsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected