Return documents and basic info for a session.
(self, session_id: str)
| 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""" |
no test coverage detected