From 513b9e72fc77fde26c82b04359532a1be84ded4c Mon Sep 17 00:00:00 2001 From: Accusys Date: Thu, 14 May 2026 17:01:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20health/detailed=20=E2=80=94=20add=20pip?= =?UTF-8?q?eline=20status=20section=20(scripts,=20models,=20ffmpeg,=20embe?= =?UTF-8?q?d,=20gdino,=20llm)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/server.rs | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/src/api/server.rs b/src/api/server.rs index bd0eef8..35cf9c3 100644 --- a/src/api/server.rs +++ b/src/api/server.rs @@ -377,6 +377,20 @@ struct DetailedHealthResponse { uptime_ms: u64, services: ServiceHealth, resources: ResourceStatus, + pipeline: PipelineStatus, +} + +#[derive(Debug, Serialize)] +struct PipelineStatus { + scripts: bool, + models: bool, + ffmpeg: bool, + /// Embedding server (port 11436) + embedding_server: ServiceStatus, + /// GDINO API (port 8080) + gdino_api: ServiceStatus, + /// LLM via llama.cpp (port 8082) + llm: ServiceStatus, } #[derive(Debug, Serialize)] @@ -450,6 +464,13 @@ async fn health_detailed(State(state): State) -> Json) -> Json ServiceStatus { } } +async fn check_http(url: &str) -> ServiceStatus { + let start = Instant::now(); + match reqwest::get(url).await { + Ok(resp) => { + if resp.status().is_success() { + ServiceStatus { + status: "ok".to_string(), + latency_ms: Some(start.elapsed().as_millis() as u64), + error: None, + } + } else { + ServiceStatus { + status: "error".to_string(), + latency_ms: Some(start.elapsed().as_millis() as u64), + error: Some(format!("HTTP {}", resp.status())), + } + } + } + Err(e) => ServiceStatus { + status: "error".to_string(), + latency_ms: Some(start.elapsed().as_millis() as u64), + error: Some(e.to_string()), + }, + } +} + fn generate_query_hash(query: &str, uuid: Option<&str>, limit: usize) -> String { let data = serde_json::json!({ "query": query,