INNER CODE UNIT · Python
get_model_metrics
GifariKemal/xaubot-ai · web-dashboard/api/main.py:277
async def get_model_metrics():
"""Read model metrics from JSON file (written by bot on startup/retrain)."""
for path in [MODEL_METRICS_FILE, Path("data/model_metrics.json")]:
if path.exists():
try:
return json.loads(path.read_text())
except (json.JSONDecodeError, OSError):
continue
return {"featureImportance": [], "trainAuc": 0, "testAuc": 0, "sampleCount": 0, "updatedAt": None}
@app.get("/api/model/training-history")
async def get_training_history():
"""Get model training run history."""
if not db.is_available():
return {"runs": []}
rows = db.query(