fix(confidence-engine): decouple app health from provider

This commit is contained in:
2026-09-09 20:00:52 +01:00
parent 00d7593ffd
commit 96b47d16a3
2 changed files with 6 additions and 41 deletions
+1 -31
View File
@@ -1,33 +1,3 @@
import { getConfig } from "@/lib/config";
export async function GET() {
try {
const result = getConfig();
if (!result.ok) {
return Response.json({ healthy: false }, { status: 500 });
}
const { OLLAMA_BASE_URL, OLLAMA_MODEL } = result.config;
// Test reachability with a short timeout
let reachable = false;
try {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 3000);
const res = await fetch(`${OLLAMA_BASE_URL}/api/tags`, {
signal: controller.signal
});
clearTimeout(timeout);
reachable = res.ok;
} catch {
reachable = false;
}
return Response.json({ healthy: reachable }, { status: reachable ? 200 : 503 });
} catch {
return Response.json({ healthy: false }, { status: 500 });
}
return Response.json({ healthy: true }, { status: 200 });
}