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,