mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-06-26 06:10:19 +00:00
4b4d13ae72
* wip * server: (router) add SSE realtime updates API * nits * wip * add download API * add download api * update docs * add delete endpoint * fix std::terminate * fix crash * fix 2 * add tests * nits
36 lines
775 B
C++
36 lines
775 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
// Ref: https://huggingface.co/docs/hub/local-cache.md
|
|
|
|
namespace hf_cache {
|
|
|
|
struct hf_file {
|
|
std::string path;
|
|
std::string url;
|
|
std::string local_path;
|
|
std::string final_path;
|
|
std::string oid;
|
|
std::string repo_id;
|
|
};
|
|
|
|
using hf_files = std::vector<hf_file>;
|
|
|
|
// Get files from HF API
|
|
hf_files get_repo_files(
|
|
const std::string & repo_id,
|
|
const std::string & token
|
|
);
|
|
|
|
hf_files get_cached_files(const std::string & repo_id = {});
|
|
|
|
// Create snapshot path (link or move/copy) and return it
|
|
std::string finalize_file(const hf_file & file);
|
|
|
|
// Remove the entire cached directory for a repo, returns true if removed
|
|
bool remove_cached_repo(const std::string & repo_id);
|
|
|
|
} // namespace hf_cache
|