Skip to content

cmake/ui : improve UI build to better handle many assets#24551

Closed
aldehir wants to merge 6 commits into
ggml-org:masterfrom
aldehir:improve-ui-build
Closed

cmake/ui : improve UI build to better handle many assets#24551
aldehir wants to merge 6 commits into
ggml-org:masterfrom
aldehir:improve-ui-build

Conversation

@aldehir

@aldehir aldehir commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Overview

The #23871 PR added a slew of new assets. This PR updates the asset embedding to better handle this. Additionally, there are a few bug fixes in here.

Additional information

ui-build.yml

  • Pass build number as LLAMA_BUILD_VERSION from LLAMA_UI_VERSION
  • Package UI in a single dist.tar.gz with an accompanying dist.tar.gz.sha256 checksum file.

scripts/ui-assets.cmake

  • Bump to cmake 3.18 for file(ARCHIVE_EXTRACT)
  • Replace ASSETS with REQUIRED_ASSETS used only for validation
  • Download dist.tar.gz from HF bucket and extract instead of individually downloading every asset file.

tools/ui/CMakeLists.txt

  • Default LLAMA_UI_HF_BUCKET to include the namespace (ggml-org/llama-ui). Did this so I can test against my own bucket.

tools/ui/embed.cpp

  • Refactored to accept a directory and embed every file recursively.
  • Generated ui sources now supports enumerating assets and includes MIME type.

tools/server/server-http.cpp

  • Iterate through embedded ui assets instead of hardcoding paths.

tools/ui/scripts/vite-plugin-build-info.ts

  • Default build version to b0000, so a build.json file is always created. The lack of the file fails the asset validation checks in cmake.

On top of this, I am further refactoring the build to better align with @ngxson's vision where npm build is an opt-in fallback.

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: Yes, honestly it was mostly AI generated.

@aldehir aldehir requested review from a team as code owners June 13, 2026 00:35
@github-actions github-actions Bot added script Script related examples devops improvements to build systems and github actions server server/ui labels Jun 13, 2026
@ngxson

ngxson commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

scripts/ui-assets.cmake
* Bump to cmake 3.18 for file(ARCHIVE_EXTRACT)
* Replace ASSETS with REQUIRED_ASSETS used only for validation
* Download dist.tar.gz from HF bucket and extract instead of individually downloading every asset file.

IMO this is mostly to circumvent the fact that some asset files now have hash in the file name. I think the original PR add quite a lot of code to handle it which is quite overkill.

I'm trying to simply the whole thing in #24550 , simply rename the file back to static bundle.js|css and have the server to route them correctly.

Would you mind having a look on my version instead? It's still missing the build.json stuff I think, I don't quite understand what it does

@aldehir

aldehir commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

IMO this is mostly to circumvent the fact that some asset files now have hash in the file name. I think the original PR add quite a lot of code to handle it which is quite overkill.

Well, yes but also there's over 60 files to embed now. I think enumerating them seems error-prone. I would rather just serve up whatever the Vite build spits out. That said, we'll do whatever you think is best.

@ngxson

ngxson commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Well, yes but also there's over 60 files to embed now. I think enumerating them seems error-prone.

ah yes that's a good point, I didn't notice that. It's fine to keep the ARCHIVE_EXTRACT then

I think I've done my work on the other PR, would you mind adapting your change accordingly? you can also push directly to my PR if you want, I'm going AFK now

@aldehir aldehir closed this Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops improvements to build systems and github actions examples script Script related server/ui server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants