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

Method handle_get_session_documents

backend/server.py:224–243  ·  view source on GitHub ↗

Return documents and basic info for a session.

(self, session_id: str)

Source from the content-addressed store, hash-verified

222 }, status_code=500)
223
224 def handle_get_session_documents(self, session_id: str):
225 """Return documents and basic info for a session."""
226 try:
227 session = db.get_session(session_id)
228 if not session:
229 self.send_json_response({"error": "Session not found"}, status_code=404)
230 return
231
232 docs = db.get_documents_for_session(session_id)
233
234 # Extract original filenames from stored paths
235 filenames = [os.path.basename(p).split('_', 1)[-1] if '_' in os.path.basename(p) else os.path.basename(p) for p in docs]
236
237 self.send_json_response({
238 "session": session,
239 "files": filenames,
240 "file_count": len(docs)
241 })
242 except Exception as e:
243 self.send_json_response({"error": f"Failed to get documents: {str(e)}"}, status_code=500)
244
245 def handle_create_session(self):
246 """Create a new chat session"""

Callers 1

do_GETMethod · 0.95

Calls 3

send_json_responseMethod · 0.95
get_sessionMethod · 0.80

Tested by

no test coverage detected