1
0
mirror of https://github.com/ggerganov/whisper.cpp.git synced 2025-06-30 14:30:15 +02:00

feat: add health check endpoint to server ()

This commit is contained in:
Sacha Arbonel
2025-03-31 10:03:41 +02:00
committed by GitHub
parent f92bd59951
commit 88d13a17a7

@ -1024,6 +1024,11 @@ int main(int argc, char ** argv) {
// check if the model is in the file system // check if the model is in the file system
}); });
svr.Get(sparams.request_path + "/health", [&](const Request &, Response &res){
const std::string health_response = "{\"status\":\"ok\"}";
res.set_content(health_response, "application/json");
});
svr.set_exception_handler([](const Request &, Response &res, std::exception_ptr ep) { svr.set_exception_handler([](const Request &, Response &res, std::exception_ptr ep) {
const char fmt[] = "500 Internal Server Error\n%s"; const char fmt[] = "500 Internal Server Error\n%s";
char buf[BUFSIZ]; char buf[BUFSIZ];