fix build

This commit is contained in:
Concedo 2026-06-19 15:10:34 +08:00
parent 7780cf7288
commit 98236505e5

View file

@ -1002,75 +1002,6 @@ std::vector<common_cached_model_info> common_list_cached_models() {
}
#else
// common_hf_file_res common_get_hf_file(const std::string &, const std::string &, bool, const common_header_list &) {
// throw std::runtime_error("download functionality is not enabled in this build");
// }
common_download_model_result common_download_model(const common_params_model & model,
const common_download_opts & opts) {
throw std::runtime_error("download functionality is not enabled in this build");
}
std::string common_docker_resolve_model(const std::string &) {
throw std::runtime_error("download functionality is not enabled in this build");
}
int common_download_file_single(const std::string & url,
const std::string & path,
const common_download_opts & opts,
bool skip_etag) {
throw std::runtime_error("download functionality is not enabled in this build");
}
std::pair<long, std::vector<char>> common_remote_get_content(const std::string & url,
const common_remote_params & params) {
throw std::runtime_error("download functionality is not enabled in this build");
}
struct gguf_split_info {
std::string prefix; // tag included
std::string tag;
int index;
int count;
};
static gguf_split_info get_gguf_split_info(const std::string & path) {
static const std::regex re_split("^(.+)-([0-9]{5})-of-([0-9]{5})$", std::regex::icase);
static const std::regex re_tag("[-.]([A-Z0-9_]+)$", std::regex::icase);
std::smatch m;
std::string prefix = path;
string_remove_suffix(prefix, ".gguf");
int index = 1;
int count = 1;
if (std::regex_match(prefix, m, re_split)) {
index = std::stoi(m[2].str());
count = std::stoi(m[3].str());
prefix = m[1].str();
}
std::string tag;
if (std::regex_search(prefix, m, re_tag)) {
tag = m[1].str();
for (char & c : tag) {
c = std::toupper((unsigned char)c);
}
}
return {std::move(prefix), std::move(tag), index, count};
}
std::vector<common_cached_model_info> common_list_cached_models() {
std::vector<common_cached_model_info> result;
return result;
}
#endif // defined(LLAMA_USE_HTTPLIB)
bool common_download_remove(const std::string & hf_repo_with_tag) {
namespace fs = std::filesystem;
@ -1156,3 +1087,79 @@ bool common_download_remove(const std::string & hf_repo_with_tag) {
}
#else
// common_hf_file_res common_get_hf_file(const std::string &, const std::string &, bool, const common_header_list &) {
// throw std::runtime_error("download functionality is not enabled in this build");
// }
common_download_model_result common_download_model(const common_params_model & model,
const common_download_opts & opts) {
throw std::runtime_error("download functionality is not enabled in this build");
}
std::string common_docker_resolve_model(const std::string &) {
throw std::runtime_error("download functionality is not enabled in this build");
}
int common_download_file_single(const std::string & url,
const std::string & path,
const common_download_opts & opts,
bool skip_etag) {
throw std::runtime_error("download functionality is not enabled in this build");
}
std::pair<long, std::vector<char>> common_remote_get_content(const std::string & url,
const common_remote_params & params) {
throw std::runtime_error("download functionality is not enabled in this build");
}
struct gguf_split_info {
std::string prefix; // tag included
std::string tag;
int index;
int count;
};
static gguf_split_info get_gguf_split_info(const std::string & path) {
static const std::regex re_split("^(.+)-([0-9]{5})-of-([0-9]{5})$", std::regex::icase);
static const std::regex re_tag("[-.]([A-Z0-9_]+)$", std::regex::icase);
std::smatch m;
std::string prefix = path;
string_remove_suffix(prefix, ".gguf");
int index = 1;
int count = 1;
if (std::regex_match(prefix, m, re_split)) {
index = std::stoi(m[2].str());
count = std::stoi(m[3].str());
prefix = m[1].str();
}
std::string tag;
if (std::regex_search(prefix, m, re_tag)) {
tag = m[1].str();
for (char & c : tag) {
c = std::toupper((unsigned char)c);
}
}
return {std::move(prefix), std::move(tag), index, count};
}
std::vector<common_cached_model_info> common_list_cached_models() {
std::vector<common_cached_model_info> result;
return result;
}
bool common_download_remove(const std::string & hf_repo_with_tag) {
return true;
}
#endif // defined(LLAMA_USE_HTTPLIB)