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

Method do_GET

backend/server.py:49–82  ·  view source on GitHub ↗

Handle GET requests

(self)

Source from the content-addressed store, hash-verified

47 self.end_headers()
48
49 def do_GET(self):
50 """Handle GET requests"""
51 parsed_path = urlparse(self.path)
52
53 if parsed_path.path == '/health':
54 self.send_json_response({
55 "status": "ok",
56 "ollama_running": self.ollama_client.is_ollama_running(),
57 "available_models": self.ollama_client.list_models(),
58 "database_stats": db.get_stats()
59 })
60 elif parsed_path.path == '/sessions':
61 self.handle_get_sessions()
62 elif parsed_path.path == '/sessions/cleanup':
63 self.handle_cleanup_sessions()
64 elif parsed_path.path == '/models':
65 self.handle_get_models()
66 elif parsed_path.path == '/indexes':
67 self.handle_get_indexes()
68 elif parsed_path.path.startswith('/indexes/') and parsed_path.path.count('/') == 2:
69 index_id = parsed_path.path.split('/')[-1]
70 self.handle_get_index(index_id)
71 elif parsed_path.path.startswith('/sessions/') and parsed_path.path.endswith('/documents'):
72 session_id = parsed_path.path.split('/')[-2]
73 self.handle_get_session_documents(session_id)
74 elif parsed_path.path.startswith('/sessions/') and parsed_path.path.endswith('/indexes'):
75 session_id = parsed_path.path.split('/')[-2]
76 self.handle_get_session_indexes(session_id)
77 elif parsed_path.path.startswith('/sessions/') and parsed_path.path.count('/') == 2:
78 session_id = parsed_path.path.split('/')[-1]
79 self.handle_get_session(session_id)
80 else:
81 self.send_response(404)
82 self.end_headers()
83
84 def do_POST(self):
85 """Handle POST requests"""

Callers

nothing calls this directly

Calls 12

send_json_responseMethod · 0.95
handle_get_sessionsMethod · 0.95
handle_get_modelsMethod · 0.95
handle_get_indexesMethod · 0.95
handle_get_indexMethod · 0.95
handle_get_sessionMethod · 0.95
is_ollama_runningMethod · 0.80
list_modelsMethod · 0.80
get_statsMethod · 0.80

Tested by

no test coverage detected