diff --git a/tools/server/server-models.cpp b/tools/server/server-models.cpp index ae2b78efba..2b6505c410 100644 --- a/tools/server/server-models.cpp +++ b/tools/server/server-models.cpp @@ -4,6 +4,7 @@ #include "download.h" #include +#include #include #include @@ -12,7 +13,6 @@ #include #include #include -#include #ifdef _WIN32 #include @@ -84,7 +84,7 @@ static std::vector list_local_models(const std::string & dir) { } std::vector models; - auto scan_subdir = [&models](const std::string & subdir_path, const std::string name) { + auto scan_subdir = [&models](const std::string & subdir_path, const std::string & name) { auto files = fs_list(subdir_path, false); common_file_info model_file; common_file_info first_shard_file; @@ -292,6 +292,7 @@ static std::vector to_char_ptr_array(const std::vector & ve std::vector server_models::get_all_meta() { std::lock_guard lk(mutex); std::vector result; + result.reserve(mapping.size()); for (const auto & [name, inst] : mapping) { result.push_back(inst.meta); } @@ -363,7 +364,7 @@ void server_models::load(const std::string & name, bool auto_load) { inst.subproc = std::make_shared(); { - std::string exec_path = get_server_exec_path().string(); + //std::string exec_path = get_server_exec_path().string(); SRV_INF("spawning server instance with name=%s on port %d\n", inst.meta.name.c_str(), inst.meta.port); std::vector child_args; diff --git a/tools/server/server-models.h b/tools/server/server-models.h index 029ba2fad8..b9bec983ef 100644 --- a/tools/server/server-models.h +++ b/tools/server/server-models.h @@ -3,9 +3,6 @@ #include "common.h" #include "server-http.h" -#include - -#include #include #include #include @@ -30,13 +27,14 @@ enum server_model_status { static server_model_status server_model_status_from_string(const std::string & status_str) { if (status_str == "unloaded") { return SERVER_MODEL_STATUS_UNLOADED; - } else if (status_str == "loading") { - return SERVER_MODEL_STATUS_LOADING; - } else if (status_str == "loaded") { - return SERVER_MODEL_STATUS_LOADED; - } else { - throw std::runtime_error("invalid server model status"); } + if (status_str == "loading") { + return SERVER_MODEL_STATUS_LOADING; + } + if (status_str == "loaded") { + return SERVER_MODEL_STATUS_LOADED; + } + throw std::runtime_error("invalid server model status"); } static std::string server_model_status_to_string(server_model_status status) { @@ -68,6 +66,8 @@ struct server_model_meta { } }; +struct subprocess_s; + struct server_models { private: struct instance_t {