MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / router_validate_model

Function router_validate_model

tools/server/server-models.cpp:894–915  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

892}
893
894static bool router_validate_model(std::string & name, server_models & models, bool models_autoload, std::unique_ptr<server_http_res> & res) {
895 if (name.empty()) {
896 res_err(res, format_error_response("model name is missing from the request", ERROR_TYPE_INVALID_REQUEST));
897 return false;
898 }
899 auto meta = models.get_meta(name);
900 if (!meta.has_value()) {
901 res_err(res, format_error_response(string_format("model '%s' not found", name.c_str()), ERROR_TYPE_INVALID_REQUEST));
902 return false;
903 }
904 // resolve alias to canonical model name
905 name = meta->name;
906 if (models_autoload) {
907 models.ensure_model_ready(name);
908 } else {
909 if (!meta->is_running()) {
910 res_err(res, format_error_response("model is not loaded", ERROR_TYPE_INVALID_REQUEST));
911 return false;
912 }
913 }
914 return true;
915}
916
917static bool is_autoload(const common_params & params, const server_http_req & req) {
918 std::string autoload = req.get_param("autoload");

Callers 1

init_routesMethod · 0.85

Calls 7

res_errFunction · 0.85
format_error_responseFunction · 0.85
ensure_model_readyMethod · 0.80
is_runningMethod · 0.80
string_formatFunction · 0.50
emptyMethod · 0.45
get_metaMethod · 0.45

Tested by

no test coverage detected