From 1552006febcf9188465991acbe855cb32df4e3ab Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Thu, 19 Feb 2026 15:53:02 -0800 Subject: [PATCH] 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. --- .../src/app/api/extraction/health/route.ts | 18 ++++++++++++++++++ __LOCAL_LLMs/dashboard/src/app/page.tsx | 6 ++---- 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 __LOCAL_LLMs/dashboard/src/app/api/extraction/health/route.ts diff --git a/__LOCAL_LLMs/dashboard/src/app/api/extraction/health/route.ts b/__LOCAL_LLMs/dashboard/src/app/api/extraction/health/route.ts new file mode 100644 index 00000000..f0e3b051 --- /dev/null +++ b/__LOCAL_LLMs/dashboard/src/app/api/extraction/health/route.ts @@ -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' }); + } +} diff --git a/__LOCAL_LLMs/dashboard/src/app/page.tsx b/__LOCAL_LLMs/dashboard/src/app/page.tsx index 5b1419b3..1c2aa328 100644 --- a/__LOCAL_LLMs/dashboard/src/app/page.tsx +++ b/__LOCAL_LLMs/dashboard/src/app/page.tsx @@ -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 {