Spaces:
Sleeping
Sleeping
Claude Code commited on
Commit ·
c5a48eb
1
Parent(s): 12a0875
Claude Code: fix: add error handling to /api/status endpoint
Browse files
app.py
CHANGED
|
@@ -105,14 +105,18 @@ async def interact(request: InteractRequest):
|
|
| 105 |
@app.get("/api/status")
|
| 106 |
async def status():
|
| 107 |
"""Detailed status endpoint."""
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
# ========== Startup ==========
|
| 118 |
@app.on_event("startup")
|
|
|
|
| 105 |
@app.get("/api/status")
|
| 106 |
async def status():
|
| 107 |
"""Detailed status endpoint."""
|
| 108 |
+
try:
|
| 109 |
+
status_data = get_system_status()
|
| 110 |
+
status_data["endpoints"] = [
|
| 111 |
+
{"path": "/", "method": "GET", "description": "System status"},
|
| 112 |
+
{"path": "/health", "method": "GET", "description": "Health check"},
|
| 113 |
+
{"path": "/api/interact", "method": "POST", "description": "Chat interaction"},
|
| 114 |
+
{"path": "/api/status", "method": "GET", "description": "Detailed status"}
|
| 115 |
+
]
|
| 116 |
+
return status_data
|
| 117 |
+
except Exception as e:
|
| 118 |
+
logger.error(f"Status error: {e}")
|
| 119 |
+
raise HTTPException(status_code=500, detail="Failed to get status")
|
| 120 |
|
| 121 |
# ========== Startup ==========
|
| 122 |
@app.on_event("startup")
|