ui : Add Hugging Face Hub data layer - #27947
Open
allozaur wants to merge 4 commits into
Open
Conversation
allozaur
force-pushed
the
allozaur/ui/hf-data-layer
branch
2 times, most recently
from
August 29, 2026 10:08
8dc9904 to
8371db2
Compare
allozaur
commented
Aug 29, 2026
allozaur
commented
Aug 29, 2026
allozaur
marked this pull request as ready for review
August 29, 2026 12:03
Contributor
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds a Hugging Face Hub “data layer” to llama-ui, including types/enums/constants and a new HuggingFaceService for searching/browsing GGUF repos, fetching detail/readme/tree data, and providing GGUF filename/shard parsing helpers.
Changes:
- Introduces
HuggingFaceServicewith HF API + llama.app catalog fetching, retry logic (for search), and GGUF parsing/formatting utilities. - Adds new Hugging Face API types (
huggingface.d.ts) and enums (huggingface.enums.ts) and exports them via existingindex.tsbarrels. - Adds
huggingface.constants.tsandmodels-discover.constants.tsfor URLs, regexes, limits, and formatting units.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/ui/src/lib/types/index.ts | Re-exports new Hugging Face types for app-wide consumption. |
| tools/ui/src/lib/types/huggingface.d.ts | Adds TS declaration types for HF REST API and llama.app catalog responses. |
| tools/ui/src/lib/services/index.ts | Re-exports HuggingFaceService from the services barrel. |
| tools/ui/src/lib/services/huggingface.service.ts | Implements HF browsing/searching plus GGUF parsing/format helpers. |
| tools/ui/src/lib/enums/index.ts | Re-exports new HF enums. |
| tools/ui/src/lib/enums/huggingface.enums.ts | Defines enums mirroring HF API sort and tree-entry type strings. |
| tools/ui/src/lib/constants/models-discover.constants.ts | Adds llama.app catalog URL constant. |
| tools/ui/src/lib/constants/index.ts | Re-exports new constants modules. |
| tools/ui/src/lib/constants/huggingface.constants.ts | Adds HF URL/regex/limits/retry/formatting constants used by the service. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+243
to
+253
| static formatDownloads(downloads: number): string { | ||
| if (downloads >= MEGABYTE) { | ||
| return `${(downloads / MEGABYTE).toFixed(1)}${MEGA_LABEL}`; | ||
| } | ||
|
|
||
| if (downloads >= KILOBYTE) { | ||
| return `${(downloads / KILOBYTE).toFixed(1)}${KILO_LABEL}`; | ||
| } | ||
|
|
||
| return downloads.toString(); | ||
| } |
Comment on lines
+288
to
+309
| static formatRelativeTime(timestamp: string): string { | ||
| const date = new Date(timestamp); | ||
| const now = new Date(); | ||
| const diffMs = now.getTime() - date.getTime(); | ||
| const diffDays = Math.floor(diffMs / MS_PER_DAY); | ||
|
|
||
| if (diffDays === 0) return TODAY_LABEL; | ||
|
|
||
| if (diffDays === 1) return YESTERDAY_LABEL; | ||
|
|
||
| if (diffDays < DAYS_PER_WEEK) return `${diffDays} ${DAYS_AGO_LABEL}`; | ||
|
|
||
| if (diffDays < DAYS_PER_MONTH) { | ||
| return `${Math.floor(diffDays / DAYS_PER_WEEK)} ${WEEKS_AGO_LABEL}`; | ||
| } | ||
|
|
||
| if (diffDays < DAYS_PER_YEAR) { | ||
| return `${Math.floor(diffDays / DAYS_PER_MONTH)} ${MONTHS_AGO_LABEL}`; | ||
| } | ||
|
|
||
| return `${Math.floor(diffDays / DAYS_PER_YEAR)} ${YEARS_AGO_LABEL}`; | ||
| } |
Comment on lines
+446
to
+452
| static async getDetails(modelId: string): Promise<HfModelDetailInfo | null> { | ||
| // Do not encode the modelId, it contains slashes for author/name. | ||
| // `full=true` includes cardData (description, base_model) and safetensors. | ||
| const url = `${HF_API_MODELS_URL}${PATH_SEPARATOR}${modelId}?${HF_FULL_DETAIL_PARAM}`; | ||
|
|
||
| try { | ||
| const response = await fetch(url); |
Comment on lines
+148
to
+149
| */ | ||
| export const HF_CACHE_PATH_REGEX = /models--(.+?)\/snapshots\/[^/]+\/(.+)$/; |
allozaur
force-pushed
the
allozaur/ui/hf-data-layer
branch
from
August 30, 2026 06:36
15ef6e7 to
eb1e29b
Compare
allozaur
force-pushed
the
allozaur/ui/hf-data-layer
branch
from
August 31, 2026 10:56
eb1e29b to
8972a1f
Compare
allozaur
force-pushed
the
allozaur/ui/hf-data-layer
branch
2 times, most recently
from
August 31, 2026 15:41
9b5a2ba to
e8cbf97
Compare
allozaur
force-pushed
the
allozaur/ui/hf-data-layer
branch
from
August 31, 2026 21:46
e8cbf97 to
c2dffb8
Compare
Add HuggingFaceService for browsing and searching GGUF models on the HF Hub: catalog/model search, model details, repo file tree, raw README fetch, and the llama.app model catalog. Includes GGUF file analysis helpers - extractQuantMeta (quant token plus sidecar type and its form, prefix or suffix), shard collapsing, quant bit-depth lookup, and download/size/likes formatting. Add the HF API types and the curated model list shown in the Discover Models sidebar. Assisted-by: pi
Assisted-by: pi
Address review on the HF data layer: - replace the HfModelSort / SidecarForm / sibling entry type string unions with enums (HfModelSort, SidecarForm, HfEntryType) - move URLs, query params, regexes, limits, retry settings, shard file conventions, tag tokens and formatting units into a dedicated huggingface.constants.ts; reuse the existing PATH_SEPARATOR - drop the task label / pipeline icon / library display maps: the discover UI only presents GGUF models, so keep the task tags for logic use only (parseTags) - drop the hardcoded curated model list; the discover dialog gets its default list from the llama.app /v1/catalog.json endpoint, which is an acceptable online-only source since the feature requires internet access anyway Assisted-by: pi
Address review follow-up: the llama.app catalog endpoint belongs to the models-discover feature, not the HF constants. Use Number() for shard index parsing and name the UD-quant prefix segment lookup. Assisted-by: pi
allozaur
force-pushed
the
allozaur/ui/hf-data-layer
branch
from
August 31, 2026 22:50
c2dffb8 to
548acc2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds the Hugging Face Hub data layer for
llama-ui(only business logic layer, UI will be added in follow ups):HuggingFaceServicefor browsing/searching GGUF models on HF Hub:full=true), repo file tree (recursive, cursor pagination)/v1/catalog.json) as the default list for the Discover dialogModel-00001-of-00015.gguf) into one entry with total sizeUD-aware)HfModelSort/SidecarForm/HfEntryTypeenumshuggingface.constants.ts(URLs, regexes, retry settings, limits)Requirements
pi:zai-org/GLM-5.3-Flash+llama-ui:unsloth/Qwen3.8-27B-GGUF:UD-Q4_K_XL