mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-05-18 23:49:46 +00:00
ui: Restructure repo to use tools/ui folder and ui / UI / llama-ui / LLAMA_UI naming (#23064)
* webui: Move static build output from `tools/server/public` to `build/ui` directory * refactor: Move to `tools/ui` * refactor: rename CMake variables and preprocessor defines - Rename LLAMA_BUILD_WEBUI -> LLAMA_BUILD_UI (old kept as deprecated) - Rename LLAMA_USE_PREBUILT_WEBUI -> LLAMA_USE_PREBUILT_UI (old kept as deprecated) - Backward compat: old vars auto-forward to new ones with DEPRECATION warning - Rename internal vars: WEBUI_SOURCE -> UI_SOURCE, WEBUI_SOURCE_DIR -> UI_SOURCE_DIR, etc. - Rename HF bucket: LLAMA_WEBUI_HF_BUCKET -> LLAMA_UI_HF_BUCKET - Emit both LLAMA_BUILD_WEBUI and LLAMA_BUILD_UI preprocessor defines - Emit both LLAMA_WEBUI_DEFAULT_ENABLED and LLAMA_UI_DEFAULT_ENABLED * refactor: rename CLI flags (--webui -> --ui) with backward compat - Add --ui/--no-ui (old --webui/--no-webui kept as deprecated aliases) - Add --ui-config (old --webui-config kept as deprecated alias) - Add --ui-config-file (old --webui-config-file kept as deprecated alias) - Add --ui-mcp-proxy/--no-ui-mcp-proxy (old --webui-mcp-proxy kept as deprecated) - Add new env vars: LLAMA_ARG_UI, LLAMA_ARG_UI_CONFIG, LLAMA_ARG_UI_CONFIG_FILE, LLAMA_ARG_UI_MCP_PROXY - C++ struct fields: params.ui, params.ui_config_json, params.ui_mcp_proxy added alongside old fields - Backward compat: old fields synced to new ones in g_params_to_internals * refactor: update C++ server internals with backward compat - Rename json_webui_settings -> json_ui_settings (both kept in server_context_meta) - Rename params.webui usage -> params.ui (both synced, old still works) - JSON API emits both "ui"/"ui_settings" and "webui"/"webui_settings" keys - Server routes use params.ui_mcp_proxy || params.webui_mcp_proxy - Preprocessor guards use #if defined(LLAMA_BUILD_UI) || defined(LLAMA_BUILD_WEBUI) * refactor: rename CI/CD workflows, artifacts, and build script - Rename webui-build.yml -> ui-build.yml; artifact webui-build -> ui-build - Rename webui-publish.yml -> ui-publish.yml; var HF_BUCKET_WEBUI_STATIC_OUTPUT -> HF_BUCKET_UI_STATIC_OUTPUT - Rename server-webui.yml -> server-ui.yml; job webui-build/checks -> ui-build/checks - Update server.yml: job/artifact refs webui-build -> ui-build - Update release.yml: all webui-build/publish refs -> ui-build/publish; HF_TOKEN_WEBUI_STATIC_OUTPUT -> HF_TOKEN_UI_STATIC_OUTPUT - Update server-self-hosted.yml: webui-build -> ui-build - Update build-self-hosted.yml: HF_WEBUI_VERSION -> HF_UI_VERSION - Rename webui-download.cmake -> ui-download.cmake (internal refs updated) - Update labeler.yml: server/webui -> server/ui path label * docs: update CODEOWNERS and server README docs - Update CODEOWNERS: team ggml-org/llama-webui -> ggml-org/llama-ui, path /tools/server/webui/ -> /tools/ui/ - Update server README.md: CLI tables show --ui flags with deprecated --webui aliases - Update server README-dev.md: "WebUI" -> "UI", paths updated to tools/ui/ * fix: Small fixes for UI build * fix: CMake.txt syntax * chore: Formatting * fix: `.editorconfig` for llama-ui * chore: Formatting * refactor: Use `APP_NAME` in Error route * refactor: Cleanup * refactor: Single migration service * make llama-ui a linkable target * fix: UI Build output * fix: Missing change * fix: separate llama-ui npm build output into build/tools/ui/dist subfolder + use cmake npm build instead of downloading ui-build.yml artifacts in CI * refactor: UI workflows cleanup --------- Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
This commit is contained in:
parent
49d1701bd2
commit
59778f0196
565 changed files with 1610 additions and 694 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# Download webui assets from Hugging Face Bucket at build time
|
||||
# Usage: cmake -DPUBLIC_DIR=... -DHF_BUCKET=... -DHF_VERSION=... -DASSETS="a;b;c" -P scripts/webui-download.cmake
|
||||
# Download UI assets from Hugging Face Bucket at build time
|
||||
# Usage: cmake -DPUBLIC_DIR=... -DHF_BUCKET=... -DHF_VERSION=... -DASSETS="a;b;c" -P scripts/ui-download.cmake
|
||||
#
|
||||
# Asset provisioning priority:
|
||||
# 1. Pre-built assets already in PUBLIC_DIR (cached from a previous run)
|
||||
|
|
@ -14,7 +14,7 @@ set(HF_VERSION "" CACHE STRING "Version to download (empty = resolve from git)
|
|||
set(ASSETS "" CACHE STRING "Plus-separated list of asset filenames (+)")
|
||||
set(STAMP_FILE "" CACHE STRING "Stamp file to create on success (optional)")
|
||||
set(SOURCE_DIR "" CACHE STRING "Project source root (to resolve version from git)")
|
||||
set(NPM_DIR "" CACHE STRING "WebUI source directory (to run npm build)")
|
||||
set(NPM_DIR "" CACHE STRING "UI source directory (to run npm build)")
|
||||
set(HF_ENABLED "" CACHE STRING "Whether to allow HF Bucket download (ON/OFF)")
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
@ -25,8 +25,8 @@ if("${RESOLVED_VERSION}" STREQUAL "" AND NOT "${SOURCE_DIR}" STREQUAL "")
|
|||
if(EXISTS "${SOURCE_DIR}/cmake/build-info.cmake")
|
||||
include("${SOURCE_DIR}/cmake/build-info.cmake")
|
||||
if(NOT "${BUILD_NUMBER}" STREQUAL "" AND NOT BUILD_NUMBER EQUAL 0)
|
||||
set(RESOLVED_VERSION "${BUILD_NUMBER}")
|
||||
message(STATUS "WebUI: resolved version from git: ${RESOLVED_VERSION}")
|
||||
set(RESOLVED_VERSION "b${BUILD_NUMBER}")
|
||||
message(STATUS "UI: resolved version from git: ${RESOLVED_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -43,7 +43,7 @@ if(NOT "${STAMP_FILE}" STREQUAL "" AND EXISTS "${STAMP_FILE}")
|
|||
file(READ "${STAMP_FILE}" STAMPED_VERSION)
|
||||
string(STRIP "${STAMPED_VERSION}" STAMPED_VERSION)
|
||||
if(NOT "${STAMPED_VERSION}" STREQUAL "${RESOLVED_VERSION}")
|
||||
message(STATUS "WebUI: version changed (${STAMPED_VERSION} -> ${RESOLVED_VERSION}), re-building")
|
||||
message(STATUS "UI: version changed (${STAMPED_VERSION} -> ${RESOLVED_VERSION}), re-building")
|
||||
set(FORCE_REBUILD TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -60,7 +60,7 @@ foreach(asset ${ASSETS})
|
|||
endforeach()
|
||||
|
||||
if(ALL_EXISTS AND NOT FORCE_REBUILD)
|
||||
message(STATUS "WebUI: all assets already exist in ${PUBLIC_DIR}, skipping")
|
||||
message(STATUS "UI: all assets already exist in ${PUBLIC_DIR}, skipping")
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
|
@ -76,27 +76,27 @@ if(NOT PROVISION_SUCCESS AND NOT "${NPM_DIR}" STREQUAL "")
|
|||
# Check if npm is available before attempting npm build
|
||||
find_program(NPM_EXECUTABLE npm)
|
||||
if(NPM_EXECUTABLE)
|
||||
message(STATUS "WebUI: building from source in ${NPM_DIR}")
|
||||
message(STATUS "UI: building from source in ${NPM_DIR}")
|
||||
|
||||
# Run npm install if node_modules is missing
|
||||
if(NOT EXISTS "${NPM_DIR}/node_modules")
|
||||
message(STATUS "WebUI: running npm install (first time)")
|
||||
message(STATUS "UI: running npm install (first time)")
|
||||
execute_process(
|
||||
COMMAND npm install
|
||||
COMMAND ${NPM_EXECUTABLE} install
|
||||
WORKING_DIRECTORY "${NPM_DIR}"
|
||||
RESULT_VARIABLE NPM_INSTALL_RESULT
|
||||
OUTPUT_VARIABLE NPM_OUT
|
||||
ERROR_VARIABLE NPM_ERR
|
||||
)
|
||||
if(NOT NPM_INSTALL_RESULT EQUAL 0)
|
||||
message(STATUS "WebUI: npm install failed (${NPM_INSTALL_RESULT}), falling back to download")
|
||||
message(STATUS "UI: npm install failed (${NPM_INSTALL_RESULT}), falling back to download")
|
||||
message(STATUS " stderr: ${NPM_ERR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Run the build
|
||||
execute_process(
|
||||
COMMAND npm run build
|
||||
COMMAND ${NPM_EXECUTABLE} run build
|
||||
WORKING_DIRECTORY "${NPM_DIR}"
|
||||
RESULT_VARIABLE NPM_BUILD_RESULT
|
||||
OUTPUT_VARIABLE NPM_OUT
|
||||
|
|
@ -114,20 +114,20 @@ if(NOT PROVISION_SUCCESS AND NOT "${NPM_DIR}" STREQUAL "")
|
|||
endforeach()
|
||||
|
||||
if(ALL_BUILT)
|
||||
message(STATUS "WebUI: local npm build succeeded")
|
||||
message(STATUS "UI: local npm build succeeded")
|
||||
set(PROVISION_SUCCESS TRUE)
|
||||
else()
|
||||
message(STATUS "WebUI: npm build completed but assets missing from ${PUBLIC_DIR}, falling back to download")
|
||||
message(STATUS "UI: npm build completed but assets missing from ${PUBLIC_DIR}, falling back to download")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "WebUI: npm build failed (${NPM_BUILD_RESULT}), falling back to download")
|
||||
message(STATUS "UI: npm build failed (${NPM_BUILD_RESULT}), falling back to download")
|
||||
message(STATUS " stderr: ${NPM_ERR}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "WebUI: npm not found, skipping npm build and trying HF Bucket download")
|
||||
message(STATUS "UI: npm not found, skipping npm build and trying HF Bucket download")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "WebUI: NPM_DIR (${NPM_DIR}) has no package.json, skipping npm build")
|
||||
message(STATUS "UI: NPM_DIR (${NPM_DIR}) has no package.json, skipping npm build")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
@ -148,7 +148,7 @@ if(NOT PROVISION_SUCCESS AND HF_ENABLED)
|
|||
string(REGEX REPLACE "^([^:]+):.*$" "\\1" url_label "${entry}")
|
||||
string(REGEX REPLACE "^[^:]+:(.*)$" "\\1" base_url "${entry}")
|
||||
|
||||
message(STATUS "WebUI: downloading assets from ${url_label}: ${base_url}")
|
||||
message(STATUS "UI: downloading assets from ${url_label}: ${base_url}")
|
||||
|
||||
# Download each asset
|
||||
set(ALL_OK TRUE)
|
||||
|
|
@ -161,11 +161,11 @@ if(NOT PROVISION_SUCCESS AND HF_ENABLED)
|
|||
list(GET download_status 0 download_result)
|
||||
if(NOT download_result EQUAL 0)
|
||||
list(GET download_status 1 error_message)
|
||||
message(STATUS "WebUI: failed to download ${asset} from ${url_label}: ${error_message}")
|
||||
message(STATUS "UI: failed to download ${asset} from ${url_label}: ${error_message}")
|
||||
set(ALL_OK FALSE)
|
||||
break()
|
||||
endif()
|
||||
message(STATUS "WebUI: downloaded ${asset}")
|
||||
message(STATUS "UI: downloaded ${asset}")
|
||||
endforeach()
|
||||
|
||||
if(NOT ALL_OK)
|
||||
|
|
@ -179,7 +179,7 @@ if(NOT PROVISION_SUCCESS AND HF_ENABLED)
|
|||
)
|
||||
list(GET checksum_status 0 checksum_result)
|
||||
if(checksum_result EQUAL 0)
|
||||
message(STATUS "WebUI: verifying checksums...")
|
||||
message(STATUS "UI: verifying checksums...")
|
||||
file(STRINGS "${PUBLIC_DIR}/checksums.txt" CHECKSUMS_CONTENT)
|
||||
foreach(asset ${ASSETS})
|
||||
set(download_path "${PUBLIC_DIR}/${asset}")
|
||||
|
|
@ -187,12 +187,13 @@ if(NOT PROVISION_SUCCESS AND HF_ENABLED)
|
|||
string(TOLOWER "${asset_hash}" EXPECTED_HASH_LOWER)
|
||||
string(REGEX MATCH "${EXPECTED_HASH_LOWER}[ \\t]+${asset}" CHECKSUM_LINE "${CHECKSUMS_CONTENT}")
|
||||
if(NOT CHECKSUM_LINE)
|
||||
message(WARNING "WebUI: checksum verification failed for ${asset}")
|
||||
message(WARNING " downloaded file may not match expected checksum, but will be used")
|
||||
message(WARNING "UI: checksum verification failed for ${asset}")
|
||||
set(ALL_OK FALSE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
if(ALL_OK)
|
||||
message(STATUS "WebUI: all checksums verified")
|
||||
message(STATUS "UI: all checksums verified")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
@ -203,9 +204,9 @@ if(NOT PROVISION_SUCCESS AND HF_ENABLED)
|
|||
endforeach()
|
||||
|
||||
if(PROVISION_SUCCESS)
|
||||
message(STATUS "WebUI: provisioning complete")
|
||||
message(STATUS "UI: provisioning complete")
|
||||
else()
|
||||
message(WARNING "WebUI: failed to download assets from HF Bucket (${HF_BUCKET})")
|
||||
message(WARNING "UI: failed to download assets from HF Bucket (${HF_BUCKET})")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
@ -217,6 +218,6 @@ if(PROVISION_SUCCESS)
|
|||
file(WRITE "${STAMP_FILE}" "${RESOLVED_VERSION}")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "WebUI: no source available. Neither local build (${NPM_DIR}) nor HF Bucket download succeeded.")
|
||||
message(WARNING "WebUI: building server without embedded WebUI. Set LLAMA_BUILD_WEBUI=OFF to suppress this warning.")
|
||||
message(WARNING "UI: no source available. Neither local build (${NPM_DIR}) nor HF Bucket download succeeded.")
|
||||
message(WARNING "UI: building server without embedded UI. Set LLAMA_BUILD_UI=OFF to suppress this warning.")
|
||||
endif()
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
# CMake equivalent of `xxd -i ${INPUT} ${OUTPUT}`
|
||||
# Usage: cmake -DINPUT=tools/server/public/index.html -DOUTPUT=tools/server/index.html.hpp -P scripts/xxd.cmake
|
||||
# Usage: cmake -DINPUT=build/tools/ui/dist/index.html -DOUTPUT=build/tools/ui/dist/index.html.hpp -P scripts/xxd.cmake
|
||||
|
||||
SET(INPUT "" CACHE STRING "Input File")
|
||||
SET(OUTPUT "" CACHE STRING "Output File")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue