fix(local-llm): proxy extraction health check through API route

Move extraction service health check from direct browser fetch
(http://localhost:4005/health) to server-side /api/extraction/health
proxy. Eliminates ERR_CONNECTION_REFUSED console errors when the
extraction service is not running locally.
This commit is contained in:
saravanakumardb1 2026-02-19 15:53:02 -08:00
parent 984630eb45
commit 1552006feb
2 changed files with 20 additions and 4 deletions

View File

@ -0,0 +1,18 @@
import { NextResponse } from 'next/server';
const EXTRACTION_URL = process.env.EXTRACTION_SERVICE_URL || 'http://localhost:4005';
export async function GET() {
try {
const res = await fetch(`${EXTRACTION_URL}/health`, {
signal: AbortSignal.timeout(2000),
});
if (res.ok) {
const data = await res.json();
return NextResponse.json(data);
}
return NextResponse.json({ status: 'error' });
} catch {
return NextResponse.json({ status: 'offline' });
}
}

View File

@ -122,11 +122,9 @@ export default function Dashboard() {
setMemoryHistory(prev => [...prev.slice(-29), sRes.value.memory.appMemory]);
}
}
// F15: Check extraction service health (best-effort)
// F15: Check extraction service health via server-side proxy (avoids browser CORS/console errors)
try {
const eRes = await fetch('http://localhost:4005/health', {
signal: AbortSignal.timeout(2000),
});
const eRes = await fetch('/api/extraction/health');
if (eRes.ok) setExtractionHealth(await eRes.json());
else setExtractionHealth({ status: 'error' });
} catch {