fix: update Swapper endpoints (/health, /models), remove upload size limits, auto-convert images

This commit is contained in:
Apple
2025-12-01 03:03:27 -08:00
parent 9c79b6e526
commit b3e3c6417d
15 changed files with 61 additions and 46 deletions

View File

@@ -200,21 +200,26 @@ class NodeGuardian:
# Collect Swapper Metrics
swapper_url = os.getenv("SWAPPER_URL", "http://swapper-service:8890")
try:
# Check healthz
# Check health (Swapper uses /health, not /healthz)
try:
r = await self.client.get(f"{swapper_url}/healthz", timeout=3.0)
metrics["swapper_healthy"] = (r.status_code == 200)
r = await self.client.get(f"{swapper_url}/health", timeout=3.0)
if r.status_code == 200:
health_data = r.json()
metrics["swapper_healthy"] = health_data.get("status") == "healthy"
else:
metrics["swapper_healthy"] = False
except Exception:
metrics["swapper_healthy"] = False
# Check models
# Check models (Swapper uses /models, not /v1/models)
try:
r = await self.client.get(f"{swapper_url}/v1/models", timeout=5.0)
r = await self.client.get(f"{swapper_url}/models", timeout=5.0)
if r.status_code == 200:
data = r.json()
models = data.get("models", [])
metrics["swapper_models_total"] = len(models)
metrics["swapper_models_loaded"] = sum(1 for m in models if m.get("loaded") is True)
# Swapper uses "status": "loaded" not "loaded": true
metrics["swapper_models_loaded"] = sum(1 for m in models if m.get("status") == "loaded")
metrics["swapper_state"] = data
except Exception as e:
# logger.warning(f"Failed to fetch Swapper models: {e}")