From 16564943c66ce14cb49b638ac3430a26608300ec Mon Sep 17 00:00:00 2001 From: jorgeantonio21 Date: Mon, 21 Oct 2024 21:16:05 +0100 Subject: [PATCH] first commit --- server/src/server.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/server/src/server.rs b/server/src/server.rs index 6bbd3c81..77a223ca 100644 --- a/server/src/server.rs +++ b/server/src/server.rs @@ -184,6 +184,25 @@ impl IntoResponse for ChatResponse { } } +/// Handles health check requests. +/// +/// This endpoint allows external services to check if the server is up and running. +/// It always returns a 200 OK status with a simple JSON message. +/// +/// # Returns +/// +/// Returns a JSON response with a "status" field set to "ok". +#[utoipa::path( + get, + path = "/healthz", + responses( + (status = 200, description = "Server is healthy", body = serde_json::Value) + ) +)] +async fn healthz() -> impl IntoResponse { + Json(json!({"status": "ok"})) +} + /// Handles chat completion requests by processing the input, sending it to the LLM service, /// and returning the generated response. ///