Spaces:
Sleeping
Sleeping
| # modules/sys_diagnostics.py - Minimal Working Version | |
| import psutil | |
| from datetime import datetime | |
| def register_module(app, client, username): | |
| """Register diagnostics module with FastAPI app""" | |
| from fastapi import APIRouter | |
| router = APIRouter(prefix="/system") | |
| async def full_diagnostics(): | |
| """Simple diagnostics check""" | |
| try: | |
| # Just basic CPU check | |
| cpu = psutil.cpu_percent() | |
| return { | |
| "success": True, | |
| "diagnostics": { | |
| "timestamp": datetime.now().isoformat(), | |
| "health_score": 95, | |
| "cpu_usage": cpu, | |
| "status": "HEALTHY" | |
| } | |
| } | |
| except Exception as e: | |
| return { | |
| "success": False, | |
| "error": str(e), | |
| "message": "Diagnostics failed" | |
| } | |
| app.include_router(router) | |
| print("✅ Diagnostics module registered with FastAPI") | |
| return {"status": "registered"} | |
| # Remove all other functions |