feat: add model files endpoint#2437
Conversation
bong-water-water-bong
left a comment
There was a problem hiding this comment.
Two issues that should be addressed:
1. HIGH — Missing /api/v0 and /v0 route variants: Every other model endpoint follows the quad-prefix convention (/api/v0, /api/v1, /v0, /v1). This endpoint only registers under /api/v1 and /v1. Requests to /api/v0/models/foo/files will fall through to the generic model-by-id route and return "Model not found."
2. HIGH — Absolute filesystem paths exposed in API response: The existing model_info_to_json deliberately omits resolved_paths. This new endpoint exposes full paths like /home/user/.cache/huggingface/hub/models--..., revealing home directories, usernames, and cache layout. If absolute paths are truly needed by the GUI, at minimum document this in the API docs as intentional info disclosure.
Minor: TOCTOU gap between model_exists() check and list_model_files() call (pre-existing pattern, but worth wrapping in try-catch for 404). Missing #include <vector> in model_manager.h.
d3884d6 to
4dc5e8c
Compare
* feat(ui): implement Files tab with model file listing (#2428) Wire the model-detail Files tab to GET /api/v1/models/{id}/files (PR #2437). Renders backing files (name, role badge, human-readable size, download status) in an accessible table with column headers and a caption, plus loading/empty/error states. Adds getModelFiles() + ModelFilesResponse to the API client, dark-theme CSS, and Playwright a11y tests A180-A184. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(ui): align Size column header and normalize row heights (#2428) Addresses fl0rianr's review feedback on PR #2538: - Size column now left-aligned so header sits directly above values - Table rows have uniform 40px height Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Adds a backend-owned per-model file inventory endpoint for the GUI Files tab:
This is intentionally separate from storage/system metrics. Storage endpoints
answer drive/system usage questions; this endpoint answers which resolved local
files belong to one selected model.
Response shape
{ "model_id": "Qwen3-4B", "files": [ { "name": "model.gguf", "path": "/abs/path/model.gguf", "role": "main", "size_bytes": 123456789, "exists": true } ] }Implementation notes
std::filesystem::exists/existing safe filesystem helpers and the existing resolved-path size helper.Validation
PR 2 backend smoke test:
/models/{id}/filesworks for Gemma-4-E2B-it-GGUFValidated both public route variants: