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:
parent
984630eb45
commit
1552006feb
@ -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' });
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -122,11 +122,9 @@ export default function Dashboard() {
|
|||||||
setMemoryHistory(prev => [...prev.slice(-29), sRes.value.memory.appMemory]);
|
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 {
|
try {
|
||||||
const eRes = await fetch('http://localhost:4005/health', {
|
const eRes = await fetch('/api/extraction/health');
|
||||||
signal: AbortSignal.timeout(2000),
|
|
||||||
});
|
|
||||||
if (eRes.ok) setExtractionHealth(await eRes.json());
|
if (eRes.ok) setExtractionHealth(await eRes.json());
|
||||||
else setExtractionHealth({ status: 'error' });
|
else setExtractionHealth({ status: 'error' });
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user