Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -484,6 +484,13 @@ def calculate_token_cost(username: str, duration_ms: float) -> str:
|
|
| 484 |
return json.dumps({
|
| 485 |
"success": False,
|
| 486 |
"error": str(e),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 487 |
logger.info(f"[BACKEND-HEALTH] Checking backend health status...")
|
| 488 |
logger.info(f"[BACKEND-HEALTH] Current prompt cache size: {len(prompt_cache)} entries")
|
| 489 |
logger.info(f"[BACKEND-HEALTH] Current response cache size: {len(response_cache)} entries")
|
|
|
|
| 484 |
return json.dumps({
|
| 485 |
"success": False,
|
| 486 |
"error": str(e),
|
| 487 |
+
"error_type": type(e).__name__,
|
| 488 |
+
"processing_time_ms": round(processing_time * 1000, 2),
|
| 489 |
+
"timestamp": datetime.datetime.now(pytz.UTC).isoformat()
|
| 490 |
+
}, indent=2)
|
| 491 |
+
|
| 492 |
+
def get_backend_health() -> str:
|
| 493 |
+
"""SPEED-OPTIMIZED backend health status with hard-coded RAM"""
|
| 494 |
logger.info(f"[BACKEND-HEALTH] Checking backend health status...")
|
| 495 |
logger.info(f"[BACKEND-HEALTH] Current prompt cache size: {len(prompt_cache)} entries")
|
| 496 |
logger.info(f"[BACKEND-HEALTH] Current response cache size: {len(response_cache)} entries")
|