mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-11-26 23:29:34 +00:00
ui: move the web UI to ui/apps/chat and call it Llama Chat (#32032)
* ui: move tools/ui to ui/apps/chat The chat app moves to its own root folder, ui/apps/chat, as the first step of splitting the UI into one library (ui/lib) and the apps built on it (ui/apps). The code is unchanged; every path that pointed at tools/ui now points at ui/apps/chat: CMake adds it from tools/, and the Dockerfiles, the Nix package, the workflows, the labeler, CODEOWNERS, .editorconfig, the git hooks, the dev and demo scripts and the docs follow it. Assisted-by: Claude (Opus 5.5 Medium) * ui: name Llama Chat's package @ggml-org/llama-chat It was still called llama-ui, the name of the library that now sits beside it in ui/lib (@ggml-org/llama-ui). The package stays private; the app's display name and the llama-ui.zip build artifact are unchanged. Assisted-by: Claude (Opus 5.5 Medium) * ui: call the built-in web UI Llama Chat in docs, help text and comments The app in tools/ui is Llama Chat; Llama UI is the component library it is built from. Prose that said "Web UI", "web UI" or "WebUI" for the app now names it: the READMEs, SECURITY.md, the --ui help text, the CMake option description, one server log line, code comments and the Storybook intro. Names that others depend on are unchanged: the deprecated --webui flag aliases, the LLAMA_*_WEBUI CMake and environment names, the webui_settings field, the storage migration keys and the Nix attributes. Assisted-by: Claude (Opus 5.5 Medium) * ui: name tools/ui as a former path of Llama Chat in the code-review skill Changes under the old tools/ui path, as well as tools/server/webui, still get the Llama Chat checklist. Assisted-by: Claude (Opus 5.5 Medium) * ui: name Llama Chat's path in the security policy's exclusions Llama Chat no longer lives under tools/server/, so the exclusion listed under it now names ui/apps/chat. What is covered stays the same. Assisted-by: Claude (Opus 5.5 Medium)
This commit is contained in:
parent
e8698ac163
commit
3a7660371d
1041 changed files with 193 additions and 192 deletions
|
|
@ -19,12 +19,12 @@ FROM docker.io/node:$NODE_VERSION AS web
|
|||
|
||||
ARG APP_VERSION
|
||||
|
||||
WORKDIR /app/tools/ui
|
||||
WORKDIR /app/ui/apps/chat
|
||||
|
||||
COPY tools/ui/package.json tools/ui/package-lock.json ./
|
||||
COPY ui/apps/chat/package.json ui/apps/chat/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY tools/ui/ ./
|
||||
COPY ui/apps/chat/ ./
|
||||
RUN LLAMA_BUILD_NUMBER="$APP_VERSION" npm run build
|
||||
|
||||
FROM ${CANN_BASE_IMAGE} AS build
|
||||
|
|
@ -40,7 +40,7 @@ WORKDIR /app
|
|||
# -- Copy project files --
|
||||
COPY . .
|
||||
|
||||
COPY --from=web /app/tools/ui/dist tools/ui/dist
|
||||
COPY --from=web /app/ui/apps/chat/dist ui/apps/chat/dist
|
||||
|
||||
# -- Set CANN environment variables (required for compilation) --
|
||||
# Using ENV instead of `source` allows environment variables to persist across the entire image layer
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ FROM docker.io/node:$NODE_VERSION AS web
|
|||
|
||||
ARG APP_VERSION
|
||||
|
||||
WORKDIR /app/tools/ui
|
||||
WORKDIR /app/ui/apps/chat
|
||||
|
||||
COPY tools/ui/package.json tools/ui/package-lock.json ./
|
||||
COPY ui/apps/chat/package.json ui/apps/chat/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY tools/ui/ ./
|
||||
COPY ui/apps/chat/ ./
|
||||
RUN LLAMA_BUILD_NUMBER="$APP_VERSION" npm run build
|
||||
|
||||
FROM docker.io/ubuntu:$UBUNTU_VERSION AS build
|
||||
|
|
@ -28,7 +28,7 @@ WORKDIR /app
|
|||
|
||||
COPY . .
|
||||
|
||||
COPY --from=web /app/tools/ui/dist tools/ui/dist
|
||||
COPY --from=web /app/ui/apps/chat/dist ui/apps/chat/dist
|
||||
|
||||
RUN if [ "$TARGETARCH" = "amd64" ] || [ "$TARGETARCH" = "arm64" ]; then \
|
||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DLLAMA_BUILD_TESTS=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON; \
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ FROM docker.io/node:$NODE_VERSION AS web
|
|||
|
||||
ARG APP_VERSION
|
||||
|
||||
WORKDIR /app/tools/ui
|
||||
WORKDIR /app/ui/apps/chat
|
||||
|
||||
COPY tools/ui/package.json tools/ui/package-lock.json ./
|
||||
COPY ui/apps/chat/package.json ui/apps/chat/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY tools/ui/ ./
|
||||
COPY ui/apps/chat/ ./
|
||||
RUN LLAMA_BUILD_NUMBER="$APP_VERSION" npm run build
|
||||
|
||||
FROM ${BASE_CUDA_DEV_CONTAINER} AS build
|
||||
|
|
@ -40,7 +40,7 @@ WORKDIR /app
|
|||
|
||||
COPY . .
|
||||
|
||||
COPY --from=web /app/tools/ui/dist tools/ui/dist
|
||||
COPY --from=web /app/ui/apps/chat/dist ui/apps/chat/dist
|
||||
|
||||
RUN if [ "${CUDA_DOCKER_ARCH}" != "default" ]; then \
|
||||
export CMAKE_ARGS="-DCMAKE_CUDA_ARCHITECTURES=${CUDA_DOCKER_ARCH}"; \
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ FROM docker.io/node:$NODE_VERSION AS web
|
|||
|
||||
ARG APP_VERSION
|
||||
|
||||
WORKDIR /app/tools/ui
|
||||
WORKDIR /app/ui/apps/chat
|
||||
|
||||
COPY tools/ui/package.json tools/ui/package-lock.json ./
|
||||
COPY ui/apps/chat/package.json ui/apps/chat/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY tools/ui/ ./
|
||||
COPY ui/apps/chat/ ./
|
||||
RUN LLAMA_BUILD_NUMBER="$APP_VERSION" npm run build
|
||||
|
||||
FROM docker.io/intel/deep-learning-essentials:$ONEAPI_VERSION AS build
|
||||
|
|
@ -41,7 +41,7 @@ WORKDIR /app
|
|||
|
||||
COPY . .
|
||||
|
||||
COPY --from=web /app/tools/ui/dist tools/ui/dist
|
||||
COPY --from=web /app/ui/apps/chat/dist ui/apps/chat/dist
|
||||
|
||||
RUN if [ "${GGML_SYCL_F16}" = "ON" ]; then \
|
||||
echo "GGML_SYCL_F16 is set" \
|
||||
|
|
|
|||
|
|
@ -15,12 +15,12 @@ FROM docker.io/node:$NODE_VERSION AS web
|
|||
|
||||
ARG APP_VERSION
|
||||
|
||||
WORKDIR /app/tools/ui
|
||||
WORKDIR /app/ui/apps/chat
|
||||
|
||||
COPY tools/ui/package.json tools/ui/package-lock.json ./
|
||||
COPY ui/apps/chat/package.json ui/apps/chat/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY tools/ui/ ./
|
||||
COPY ui/apps/chat/ ./
|
||||
RUN LLAMA_BUILD_NUMBER="$APP_VERSION" npm run build
|
||||
|
||||
FROM ${BASE_MUSA_DEV_CONTAINER} AS build
|
||||
|
|
@ -45,7 +45,7 @@ WORKDIR /app
|
|||
|
||||
COPY . .
|
||||
|
||||
COPY --from=web /app/tools/ui/dist tools/ui/dist
|
||||
COPY --from=web /app/ui/apps/chat/dist ui/apps/chat/dist
|
||||
|
||||
RUN if [ "${MUSA_DOCKER_ARCH}" != "default" ]; then \
|
||||
export CMAKE_ARGS="-DMUSA_ARCHITECTURES=${MUSA_DOCKER_ARCH}"; \
|
||||
|
|
|
|||
|
|
@ -133,11 +133,11 @@ effectiveStdenv.mkDerivation (finalAttrs: {
|
|||
src = lib.cleanSource ../../.;
|
||||
};
|
||||
|
||||
# Builds the webui locally, taking care not to require updating any sha256 hash.
|
||||
# Builds Llama Chat locally, taking care not to require updating any sha256 hash.
|
||||
webui = stdenvNoCC.mkDerivation {
|
||||
pname = "webui";
|
||||
version = llamaVersion;
|
||||
src = lib.cleanSource ../../tools/ui;
|
||||
src = lib.cleanSource ../../ui/apps/chat;
|
||||
|
||||
nativeBuildInputs = [
|
||||
nodejs
|
||||
|
|
@ -146,7 +146,7 @@ effectiveStdenv.mkDerivation (finalAttrs: {
|
|||
|
||||
# no sha256 required when using buildNodeModules
|
||||
npmDeps = importNpmLock.buildNodeModules {
|
||||
npmRoot = ../../tools/ui;
|
||||
npmRoot = ../../ui/apps/chat;
|
||||
inherit nodejs;
|
||||
};
|
||||
|
||||
|
|
@ -156,8 +156,8 @@ effectiveStdenv.mkDerivation (finalAttrs: {
|
|||
};
|
||||
|
||||
postPatch = lib.optionalString useWebUi ''
|
||||
cp -r ${finalAttrs.webui} tools/ui/dist
|
||||
chmod -R u+w tools/ui/dist
|
||||
cp -r ${finalAttrs.webui} ui/apps/chat/dist
|
||||
chmod -R u+w ui/apps/chat/dist
|
||||
'';
|
||||
|
||||
# With PR#6015 https://github.com/ggml-org/llama.cpp/pull/6015,
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ FROM docker.io/node:$NODE_VERSION AS web
|
|||
|
||||
ARG APP_VERSION
|
||||
|
||||
WORKDIR /app/tools/ui
|
||||
WORKDIR /app/ui/apps/chat
|
||||
|
||||
COPY tools/ui/package.json tools/ui/package-lock.json ./
|
||||
COPY ui/apps/chat/package.json ui/apps/chat/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY tools/ui/ ./
|
||||
COPY ui/apps/chat/ ./
|
||||
RUN LLAMA_BUILD_NUMBER="$APP_VERSION" npm run build
|
||||
|
||||
## Build Image
|
||||
|
|
@ -83,7 +83,7 @@ WORKDIR /app
|
|||
|
||||
COPY . .
|
||||
|
||||
COPY --from=web /app/tools/ui/dist tools/ui/dist
|
||||
COPY --from=web /app/ui/apps/chat/dist ui/apps/chat/dist
|
||||
|
||||
# Build Stage
|
||||
RUN bash -c "source ${OpenVINO_DIR}/setupvars.sh && \
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ FROM docker.io/node:$NODE_VERSION AS web
|
|||
|
||||
ARG APP_VERSION
|
||||
|
||||
WORKDIR /app/tools/ui
|
||||
WORKDIR /app/ui/apps/chat
|
||||
|
||||
COPY tools/ui/package.json tools/ui/package-lock.json ./
|
||||
COPY ui/apps/chat/package.json ui/apps/chat/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY tools/ui/ ./
|
||||
COPY ui/apps/chat/ ./
|
||||
RUN LLAMA_BUILD_NUMBER="$APP_VERSION" npm run build
|
||||
|
||||
### Build image
|
||||
|
|
@ -52,7 +52,7 @@ WORKDIR /app
|
|||
|
||||
COPY . .
|
||||
|
||||
COPY --from=web /app/tools/ui/dist tools/ui/dist
|
||||
COPY --from=web /app/ui/apps/chat/dist ui/apps/chat/dist
|
||||
|
||||
RUN HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
|
||||
cmake -S . -B build \
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ FROM docker.io/node:$NODE_VERSION AS web
|
|||
|
||||
ARG APP_VERSION
|
||||
|
||||
WORKDIR /app/tools/ui
|
||||
WORKDIR /app/ui/apps/chat
|
||||
|
||||
COPY tools/ui/package.json tools/ui/package-lock.json ./
|
||||
COPY ui/apps/chat/package.json ui/apps/chat/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY tools/ui/ ./
|
||||
COPY ui/apps/chat/ ./
|
||||
RUN LLAMA_BUILD_NUMBER="$APP_VERSION" npm run build
|
||||
|
||||
FROM docker.io/ubuntu:$UBUNTU_VERSION AS build
|
||||
|
|
@ -31,7 +31,7 @@ WORKDIR /app
|
|||
|
||||
COPY . .
|
||||
|
||||
COPY --from=web /app/tools/ui/dist tools/ui/dist
|
||||
COPY --from=web /app/ui/apps/chat/dist ui/apps/chat/dist
|
||||
|
||||
RUN cmake -B build -DGGML_NATIVE=OFF -DGGML_VULKAN=ON -DLLAMA_BUILD_TESTS=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON && \
|
||||
cmake --build build --config Release -j$(nproc)
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ FROM docker.io/node:$NODE_VERSION AS web
|
|||
|
||||
ARG APP_VERSION
|
||||
|
||||
WORKDIR /app/tools/ui
|
||||
WORKDIR /app/ui/apps/chat
|
||||
|
||||
COPY tools/ui/package.json tools/ui/package-lock.json ./
|
||||
COPY ui/apps/chat/package.json ui/apps/chat/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY tools/ui/ ./
|
||||
COPY ui/apps/chat/ ./
|
||||
RUN LLAMA_BUILD_NUMBER="$APP_VERSION" npm run build
|
||||
|
||||
FROM docker.io/ubuntu:$UBUNTU_VERSION AS build
|
||||
|
|
@ -28,7 +28,7 @@ WORKDIR /app
|
|||
|
||||
COPY . .
|
||||
|
||||
COPY --from=web /app/tools/ui/dist tools/ui/dist
|
||||
COPY --from=web /app/ui/apps/chat/dist ui/apps/chat/dist
|
||||
|
||||
RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF -DLLAMA_BUILD_TESTS=OFF -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DGGML_ZENDNN=ON && \
|
||||
cmake --build build -j $(nproc)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
build*/
|
||||
|
||||
tools/ui/node_modules/
|
||||
ui/apps/chat/node_modules/
|
||||
|
||||
models/*
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ insert_final_newline = unset
|
|||
[vendor/**.patch]
|
||||
trim_trailing_whitespace = unset
|
||||
|
||||
[tools/ui/**]
|
||||
[ui/**]
|
||||
indent_style = unset
|
||||
indent_size = unset
|
||||
end_of_line = unset
|
||||
|
|
|
|||
3
.github/labeler.yml
vendored
3
.github/labeler.yml
vendored
|
|
@ -48,7 +48,6 @@ examples:
|
|||
- all-globs-to-all-files:
|
||||
- '!tools/server/**'
|
||||
- '!tools/mtmd/**'
|
||||
- '!tools/ui/**'
|
||||
testing:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
|
|
@ -72,7 +71,7 @@ android:
|
|||
server/ui:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- tools/ui/**
|
||||
- ui/**
|
||||
server:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
|
|
|
|||
2
.github/workflows/docker.yml
vendored
2
.github/workflows/docker.yml
vendored
|
|
@ -182,7 +182,7 @@ jobs:
|
|||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist
|
||||
path: ui/apps/chat/dist
|
||||
|
||||
# - name: Set up QEMU
|
||||
# if: ${{ contains(matrix.config.platforms, 'linux/amd64') }}
|
||||
|
|
|
|||
2
.github/workflows/pr-video-demo-label.yml
vendored
2
.github/workflows/pr-video-demo-label.yml
vendored
|
|
@ -22,7 +22,7 @@ jobs:
|
|||
BODY: ${{ github.event.pull_request.body }}
|
||||
HAS_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'video demo') }}
|
||||
run: |
|
||||
# sections written by demo:pr (see tools/ui/demo/cli.ts): the managed comment
|
||||
# sections written by demo:pr (see ui/apps/chat/demo/cli.ts): the managed comment
|
||||
# markers, or a preview linking to a demo video uploaded for this PR
|
||||
has_demo=false
|
||||
if { grep -qF '<!-- demo:start -->' <<< "$BODY" && grep -qF '<!-- demo:end -->' <<< "$BODY"; } ||
|
||||
|
|
|
|||
24
.github/workflows/release.yml
vendored
24
.github/workflows/release.yml
vendored
|
|
@ -130,7 +130,7 @@ jobs:
|
|||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist
|
||||
path: ui/apps/chat/dist
|
||||
|
||||
- name: ccache
|
||||
uses: ggml-org/ccache-action@v1.2.24
|
||||
|
|
@ -196,7 +196,7 @@ jobs:
|
|||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist
|
||||
path: ui/apps/chat/dist
|
||||
|
||||
- name: Dependencies
|
||||
id: depends
|
||||
|
|
@ -274,7 +274,7 @@ jobs:
|
|||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist
|
||||
path: ui/apps/chat/dist
|
||||
|
||||
- name: Dependencies
|
||||
id: depends
|
||||
|
|
@ -381,7 +381,7 @@ jobs:
|
|||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist
|
||||
path: ui/apps/chat/dist
|
||||
|
||||
- name: Dependencies
|
||||
id: depends
|
||||
|
|
@ -479,7 +479,7 @@ jobs:
|
|||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist
|
||||
path: ui/apps/chat/dist
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v5
|
||||
|
|
@ -571,7 +571,7 @@ jobs:
|
|||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist
|
||||
path: ui/apps/chat/dist
|
||||
|
||||
- name: Build
|
||||
id: cmake_build
|
||||
|
|
@ -624,7 +624,7 @@ jobs:
|
|||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist
|
||||
path: ui/apps/chat/dist
|
||||
|
||||
- name: Build
|
||||
id: cmake_build
|
||||
|
|
@ -672,7 +672,7 @@ jobs:
|
|||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist
|
||||
path: ui/apps/chat/dist
|
||||
|
||||
- name: ccache
|
||||
uses: ggml-org/ccache-action@v1.2.24
|
||||
|
|
@ -894,7 +894,7 @@ jobs:
|
|||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist
|
||||
path: ui/apps/chat/dist
|
||||
|
||||
- name: Install Ninja
|
||||
run: |
|
||||
|
|
@ -1460,7 +1460,7 @@ jobs:
|
|||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist
|
||||
path: ui/apps/chat/dist
|
||||
|
||||
- name: Dependencies
|
||||
id: depends
|
||||
|
|
@ -1532,7 +1532,7 @@ jobs:
|
|||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist
|
||||
path: ui/apps/chat/dist
|
||||
|
||||
- name: Free up disk space
|
||||
uses: ggml-org/free-disk-space@v1.3.1
|
||||
|
|
@ -1647,7 +1647,7 @@ jobs:
|
|||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist
|
||||
path: ui/apps/chat/dist
|
||||
|
||||
- name: Dependencies
|
||||
id: depends
|
||||
|
|
|
|||
8
.github/workflows/ui-build-self-hosted.yml
vendored
8
.github/workflows/ui-build-self-hosted.yml
vendored
|
|
@ -23,20 +23,20 @@ jobs:
|
|||
with:
|
||||
node-version: "24"
|
||||
# cache: "npm"
|
||||
# cache-dependency-path: "tools/ui/package-lock.json"
|
||||
# cache-dependency-path: "ui/apps/chat/package-lock.json"
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Build application
|
||||
run: npm run build
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Upload built UI
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist/
|
||||
path: ui/apps/chat/dist/
|
||||
retention-days: 1
|
||||
|
|
|
|||
10
.github/workflows/ui-build.yml
vendored
10
.github/workflows/ui-build.yml
vendored
|
|
@ -37,26 +37,26 @@ jobs:
|
|||
with:
|
||||
node-version: "24"
|
||||
# cache: "npm"
|
||||
# cache-dependency-path: "tools/ui/package-lock.json"
|
||||
# cache-dependency-path: "ui/apps/chat/package-lock.json"
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Build application
|
||||
env:
|
||||
LLAMA_BUILD_NUMBER: ${{ steps.version.outputs.ui_version }}
|
||||
run: npm run build
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Run PWA unit tests (versioned build output)
|
||||
run: npx vitest --project=unit --run tests/unit/pwa.spec.ts
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Upload built UI
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist/
|
||||
path: ui/apps/chat/dist/
|
||||
retention-days: 1
|
||||
|
|
|
|||
10
.github/workflows/ui-publish.yml
vendored
10
.github/workflows/ui-publish.yml
vendored
|
|
@ -33,15 +33,15 @@ jobs:
|
|||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist/
|
||||
path: ui/apps/chat/dist/
|
||||
run-id: ${{ inputs.run_id }}
|
||||
github-token: ${{ github.token }}
|
||||
|
||||
- name: Create distribution archive
|
||||
run: |
|
||||
tar -czf dist.tar.gz -C tools/ui/dist .
|
||||
tar -czf dist.tar.gz -C ui/apps/chat/dist .
|
||||
sha256sum dist.tar.gz > dist.tar.gz.sha256
|
||||
mv dist.tar.gz dist.tar.gz.sha256 tools/ui/dist/
|
||||
mv dist.tar.gz dist.tar.gz.sha256 ui/apps/chat/dist/
|
||||
|
||||
- name: Install Hugging Face Hub CLI
|
||||
run: pip install -U huggingface_hub
|
||||
|
|
@ -52,12 +52,12 @@ jobs:
|
|||
- name: Sync built files to Hugging Face bucket (version tag)
|
||||
run: |
|
||||
# Upload the built files to the Hugging Face bucket under the release version
|
||||
hf buckets sync tools/ui/dist hf://buckets/ggml-org/${{ env.HF_BUCKET_NAME }}/${{ inputs.version_tag }} --delete --quiet
|
||||
hf buckets sync ui/apps/chat/dist hf://buckets/ggml-org/${{ env.HF_BUCKET_NAME }}/${{ inputs.version_tag }} --delete --quiet
|
||||
|
||||
- name: Sync built files to Hugging Face bucket (latest)
|
||||
run: |
|
||||
# Also upload to the 'latest' directory for fallback downloads
|
||||
hf buckets sync tools/ui/dist hf://buckets/ggml-org/${{ env.HF_BUCKET_NAME }}/latest --delete --quiet
|
||||
hf buckets sync ui/apps/chat/dist hf://buckets/ggml-org/${{ env.HF_BUCKET_NAME }}/latest --delete --quiet
|
||||
|
||||
- name: Verify upload
|
||||
run: |
|
||||
|
|
|
|||
26
.github/workflows/ui-self-hosted.yml
vendored
26
.github/workflows/ui-self-hosted.yml
vendored
|
|
@ -17,7 +17,7 @@ on:
|
|||
paths: [
|
||||
'.github/workflows/ui-self-hosted.yml',
|
||||
'.github/workflows/ui-build-self-hosted.yml',
|
||||
'tools/ui/**.*',
|
||||
'ui/apps/chat/**.*',
|
||||
'tools/server/tests/**.*'
|
||||
]
|
||||
pull_request:
|
||||
|
|
@ -25,7 +25,7 @@ on:
|
|||
paths: [
|
||||
'.github/workflows/ui-self-hosted.yml',
|
||||
'.github/workflows/ui-build-self-hosted.yml',
|
||||
'tools/ui/**.*',
|
||||
'ui/apps/chat/**.*',
|
||||
'tools/server/tests/**.*'
|
||||
]
|
||||
|
||||
|
|
@ -67,33 +67,33 @@ jobs:
|
|||
- name: Install dependencies
|
||||
id: setup
|
||||
run: npm ci
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Download built UI artifacts
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist/
|
||||
path: ui/apps/chat/dist/
|
||||
|
||||
- name: Run type checking
|
||||
if: ${{ always() && steps.setup.conclusion == 'success' }}
|
||||
run: npm run check
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Run linting
|
||||
if: ${{ always() && steps.setup.conclusion == 'success' }}
|
||||
run: npm run lint
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Run Client tests
|
||||
if: ${{ always() && steps.setup.conclusion == 'success' }}
|
||||
run: npm run test:client
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Run Unit tests
|
||||
if: ${{ always() && steps.setup.conclusion == 'success' }}
|
||||
run: npm run test:unit
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
e2e-tests:
|
||||
name: E2E Tests
|
||||
|
|
@ -109,25 +109,25 @@ jobs:
|
|||
- name: Install dependencies
|
||||
id: setup
|
||||
run: npm ci
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Download built UI artifacts
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist/
|
||||
path: ui/apps/chat/dist/
|
||||
|
||||
- name: Build Storybook
|
||||
if: ${{ always() && steps.setup.conclusion == 'success' }}
|
||||
run: npm run build-storybook
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Run UI tests
|
||||
if: ${{ always() && steps.setup.conclusion == 'success' }}
|
||||
run: npm run test:ui -- --testTimeout=60000
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Run E2E tests
|
||||
if: ${{ always() && steps.setup.conclusion == 'success' }}
|
||||
run: npm run test:e2e
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
|
|
|||
34
.github/workflows/ui.yml
vendored
34
.github/workflows/ui.yml
vendored
|
|
@ -13,7 +13,7 @@ on:
|
|||
paths: [
|
||||
'.github/workflows/ui.yml',
|
||||
'.github/workflows/ui-build.yml',
|
||||
'tools/ui/**.*',
|
||||
'ui/apps/chat/**.*',
|
||||
'tools/server/tests/**.*'
|
||||
]
|
||||
pull_request:
|
||||
|
|
@ -21,7 +21,7 @@ on:
|
|||
paths: [
|
||||
'.github/workflows/ui.yml',
|
||||
'.github/workflows/ui-build.yml',
|
||||
'tools/ui/**.*',
|
||||
'ui/apps/chat/**.*',
|
||||
'tools/server/tests/**.*'
|
||||
]
|
||||
|
||||
|
|
@ -66,46 +66,46 @@ jobs:
|
|||
with:
|
||||
node-version: "24"
|
||||
# cache: "npm"
|
||||
# cache-dependency-path: "tools/ui/package-lock.json"
|
||||
# cache-dependency-path: "ui/apps/chat/package-lock.json"
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Download built UI artifacts
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist/
|
||||
path: ui/apps/chat/dist/
|
||||
|
||||
- name: Install dependencies
|
||||
id: setup
|
||||
if: ${{ steps.node.conclusion == 'success' }}
|
||||
run: npm ci
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Run type checking
|
||||
if: ${{ always() && steps.setup.conclusion == 'success' }}
|
||||
run: npm run check
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Run linting
|
||||
if: ${{ always() && steps.setup.conclusion == 'success' }}
|
||||
run: npm run lint
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Install Playwright browsers
|
||||
id: playwright
|
||||
if: ${{ always() && steps.setup.conclusion == 'success' }}
|
||||
run: npx playwright install --with-deps
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Run Client tests
|
||||
if: ${{ always() && steps.playwright.conclusion == 'success' }}
|
||||
run: npm run test:client
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Run Unit tests (uses pre-built dist/ from ui-build)
|
||||
if: ${{ always() && steps.playwright.conclusion == 'success' }}
|
||||
run: npm run test:unit
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
e2e-tests:
|
||||
name: E2E Tests
|
||||
|
|
@ -124,38 +124,38 @@ jobs:
|
|||
with:
|
||||
node-version: "24"
|
||||
# cache: "npm"
|
||||
# cache-dependency-path: "tools/ui/package-lock.json"
|
||||
# cache-dependency-path: "ui/apps/chat/package-lock.json"
|
||||
package-manager-cache: false
|
||||
|
||||
- name: Install dependencies
|
||||
id: setup
|
||||
if: ${{ steps.node.conclusion == 'success' }}
|
||||
run: npm ci
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Download built UI artifacts (reuses ui-build)
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: llama-ui.zip
|
||||
path: tools/ui/dist/
|
||||
path: ui/apps/chat/dist/
|
||||
|
||||
- name: Install Playwright browsers
|
||||
id: playwright
|
||||
if: ${{ always() && steps.setup.conclusion == 'success' }}
|
||||
run: npx playwright install --with-deps
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Build Storybook
|
||||
if: ${{ always() && steps.playwright.conclusion == 'success' }}
|
||||
run: npm run build-storybook
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Run UI tests
|
||||
if: ${{ always() && steps.playwright.conclusion == 'success' }}
|
||||
run: npm run test:ui -- --testTimeout=60000
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
||||
- name: Run E2E tests (uses pre-built dist/ from ui-build)
|
||||
if: ${{ always() && steps.playwright.conclusion == 'success' }}
|
||||
run: npm run test:e2e
|
||||
working-directory: tools/ui
|
||||
working-directory: ui/apps/chat
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ option(LLAMA_BUILD_TOOLS "llama: build tools"
|
|||
option(LLAMA_BUILD_EXAMPLES "llama: build examples" ${LLAMA_STANDALONE})
|
||||
option(LLAMA_BUILD_SERVER "llama: build server example" ${LLAMA_STANDALONE})
|
||||
option(LLAMA_BUILD_APP "llama: build the unified binary" ${LLAMA_STANDALONE})
|
||||
option(LLAMA_BUILD_UI "llama: build the embedded Web UI for server" OFF)
|
||||
option(LLAMA_BUILD_UI "llama: build Llama Chat, the embedded chat app, for server" OFF)
|
||||
option(LLAMA_USE_PREBUILT_UI "llama: use prebuilt UI from HF Bucket when available" ON)
|
||||
option(LLAMA_CONNECT "llama: include the llama-connect tool (downloads a prebuilt binary)" OFF)
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@
|
|||
/tools/rpc/ @ggml-org/ggml-rpc
|
||||
/tools/server/* @ggml-org/llama-server # no subdir
|
||||
/tools/server/tests/ @ggml-org/llama-server
|
||||
/tools/ui/ @ggml-org/llama-ui
|
||||
/ui/ @ggml-org/llama-ui
|
||||
/tools/tokenize/ @ggerganov
|
||||
/tools/tts/ @ggerganov
|
||||
/vendor/ @ggerganov
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF
|
|||
<i>VLM session with <b>llama cli</b></i>
|
||||
</td>
|
||||
<td align="center">
|
||||
<img width="1392" height="958" alt="Built-in web UI against `llama serve` running Qwen 3.6" src="https://github.com/user-attachments/assets/b402f972-2e32-4def-8771-8d849f08cf2e" />
|
||||
<i>Built-in web UI against <b>llama serve</b></i>
|
||||
<img width="1392" height="958" alt="Llama Chat, the built-in chat app, against `llama serve` running Qwen 3.6" src="https://github.com/user-attachments/assets/b402f972-2e32-4def-8771-8d849f08cf2e" />
|
||||
<i>Llama Chat, the built-in chat app, against <b>llama serve</b></i>
|
||||
</td>
|
||||
</tr>
|
||||
<table>
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ Only vulnerabilities that fall within these parts of the project are considered
|
|||
- `ggml/**/*`
|
||||
- `gguf-py/**/*`
|
||||
- `tools/server/*`, **excluding** the following topics:
|
||||
- Web UI
|
||||
- Llama Chat, the built-in chat app (`ui/apps/chat`)
|
||||
- Features marked as experimental
|
||||
- Features not recommended for use in untrusted environments (e.g., router, MCP)
|
||||
- Bugs that can lead to Denial-of-Service attack
|
||||
|
|
|
|||
|
|
@ -3416,7 +3416,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
|
|||
add_opt(common_arg(
|
||||
{"--ui-mcp-proxy", "--webui-mcp-proxy"},
|
||||
{"--no-ui-mcp-proxy", "--no-webui-mcp-proxy"},
|
||||
"experimental: whether to enable MCP CORS proxy, for the Web UI to reach public MCP servers without CORS headers; local and private addresses are refused - do not enable in untrusted environments (default: disabled)\n"
|
||||
"experimental: whether to enable MCP CORS proxy, for Llama Chat to reach public MCP servers without CORS headers; local and private addresses are refused - do not enable in untrusted environments (default: disabled)\n"
|
||||
"note: for security reasons, this will limit --cors-origins to localhost by default",
|
||||
[](common_params & params, bool value) {
|
||||
params.ui_mcp_proxy = value;
|
||||
|
|
@ -3485,7 +3485,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
|
|||
add_opt(common_arg(
|
||||
{"--ui", "--webui"},
|
||||
{"--no-ui", "--no-webui"},
|
||||
string_format("whether to enable the Web UI (default: %s)", params.ui ? "enabled" : "disabled"),
|
||||
string_format("whether to enable Llama Chat, the built-in chat app (default: %s)", params.ui ? "enabled" : "disabled"),
|
||||
[](common_params & params, bool value) {
|
||||
params.ui = value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -692,7 +692,7 @@ llama-openvino:server --no-warmup -c 1024 -m /models/Llama-3.2-1B-Instruct-Q4_K_
|
|||
# Or Using llama-server executable
|
||||
./build/ReleaseOV/bin/llama-server -m ~/models/Llama-3.2-1B-Instruct-Q4_K_M.gguf --port 8080 -c 1024
|
||||
|
||||
# Option 1: Open your browser to http://localhost:8080 to access the web UI for the llama.cpp server.
|
||||
# Option 1: Open your browser to http://localhost:8080 to open Llama Chat, the built-in chat app of the llama.cpp server.
|
||||
# Option 2: In a NEW terminal, test the server with curl
|
||||
|
||||
# If you are behind a proxy, make sure to set NO_PROXY to avoid proxy for localhost
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ Write a summary of the change log in a few sections:
|
|||
|
||||
### UI changes (if applicable)
|
||||
|
||||
[summarize the changes to `/tools/ui/`]
|
||||
[summarize the changes to `/ui/apps/chat/`]
|
||||
|
||||
### ggml changes (if applicable)
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ endfunction()
|
|||
# Generate ui.cpp/ui.h embedding every file of ${dist_dir} (empty table when
|
||||
# it has no index.html), gzip-compressed when LLAMA_UI_GZIP is enabled.
|
||||
function(emit_files dist_dir)
|
||||
set(UI_TEMPLATE_DIR "${LLAMA_SOURCE_DIR}/tools/ui")
|
||||
set(UI_TEMPLATE_DIR "${LLAMA_SOURCE_DIR}/ui/apps/chat")
|
||||
|
||||
# Collect the asset list once and reuse it for the fingerprint,
|
||||
# validation, compression and embedding.
|
||||
|
|
@ -518,7 +518,7 @@ function(hf_download version out_var out_resolved)
|
|||
endfunction()
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 1. Priority 1: pre-built assets supplied in tools/ui/dist
|
||||
# 1. Priority 1: pre-built assets supplied in ui/apps/chat/dist
|
||||
# ---------------------------------------------------------------------------
|
||||
if(EXISTS "${SRC_DIST_DIR}/index.html")
|
||||
message(STATUS "UI: using pre-built assets from ${SRC_DIST_DIR}")
|
||||
|
|
@ -585,7 +585,7 @@ if(NOT provisioned)
|
|||
"In a disconnected environment, download the pre-built UI "
|
||||
"from a llama.cpp release at "
|
||||
"https://github.com/ggml-org/llama.cpp/releases and "
|
||||
"extract to tools/ui/dist.")
|
||||
"extract to ui/apps/chat/dist.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ Identify what actually changed and which area checklists below apply. Run `git d
|
|||
- `ggml/` (any backend, op, or `ggml.h`) -> **ggml / backend**
|
||||
- `include/llama.h` and other public headers -> **Public API**
|
||||
- `tools/server/` -> **Server**
|
||||
- `tools/ui/` (or the legacy `tools/server/webui/`) -> **WebUI**
|
||||
- `ui/apps/chat/` (or the legacy `tools/ui/`, `tools/server/webui/`) -> **Llama Chat**
|
||||
- `tests/`, `tools/server/tests/`, or any other added/changed test -> **Tests**
|
||||
- anything else, plus all of the above -> **General** (always runs)
|
||||
|
||||
|
|
@ -119,9 +119,9 @@ Public API changes carry a higher bar than internal ones (`CONTRIBUTING.md`). Re
|
|||
- Security: don't trust client-supplied headers (e.g. `X-Forwarded-For`) or add footguns; things like IP allowlisting belong at a reverse proxy unless there's a trusted-proxy design.
|
||||
- Wire new behavior into the existing request/response and checkpoint paths correctly; watch for resource leaks across requests.
|
||||
|
||||
## WebUI (`tools/ui/`)
|
||||
## Llama Chat (`ui/apps/chat/`)
|
||||
|
||||
These apply only to changes under `tools/ui/` (formerly `tools/server/webui/`) - the SvelteKit + Svelte 5 frontend. They are frontend conventions, not repo-wide ones, so do not apply them to C++ or other tool code.
|
||||
These apply only to changes under `ui/apps/chat/` (formerly `tools/ui/`, `tools/server/webui/`) - the SvelteKit + Svelte 5 frontend. They are frontend conventions, not repo-wide ones, so do not apply them to C++ or other tool code.
|
||||
|
||||
The dominant review theme in this area is placement: most accepted nits are about putting a value, function, or piece of logic in the layer where it belongs.
|
||||
|
||||
|
|
@ -192,7 +192,7 @@ Adjacent data-shape rule: empty string is not a valid "unset" initial state - us
|
|||
- Sanitize anything rendered from model or remote data: the rehype/`{@html}` pipeline, SVG content, and URLs (use the `$lib/utils` URL sanitizer rather than ad-hoc checks or a third-party lib for trivial cases).
|
||||
- Proxy headers and agent/tool filesystem access are security boundaries - scope enforcement (e.g. browse-root sandboxing) must be validated end-to-end, not just in the UI; loop in server reviewers for the C++ side.
|
||||
|
||||
### PR hygiene specific to `tools/ui`
|
||||
### PR hygiene specific to `ui/apps/chat`
|
||||
|
||||
- Build artifacts are not committed - the UI is built by CI (`.github/workflows/ui-build.yml`) and downloaded/bundled at release time. `npm run build` must still succeed locally; a red UI build job is blocking.
|
||||
- `npm run lint && npm run check` (and `npm run format`) must pass; a failing Storybook test is blocking.
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ else()
|
|||
add_subdirectory(perplexity)
|
||||
add_subdirectory(quantize)
|
||||
if (LLAMA_BUILD_SERVER)
|
||||
add_subdirectory(ui)
|
||||
# the chat app lives in ui/apps/chat, outside tools/
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ui/apps/chat ${CMAKE_BINARY_DIR}/ui/apps/chat)
|
||||
add_subdirectory(cli)
|
||||
add_subdirectory(server)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ In-scope types of feature:
|
|||
- Multimodal input/output
|
||||
- Memory management: save/load state, context checkpoints
|
||||
- Model management
|
||||
- Features that are required by the Web UI
|
||||
- Features that are required by Llama Chat
|
||||
- Frontend:
|
||||
- Chat-oriented features, example: basic chat, image upload, edit messages
|
||||
- Agentic features, example: MCP
|
||||
|
|
@ -182,7 +182,7 @@ For detailed instructions, see the [test documentation](./tests/README.md).
|
|||
|
||||
### API for tools
|
||||
|
||||
This endpoint is intended to be used internally by the Web UI and subject to change or to be removed in the future.
|
||||
This endpoint is intended to be used internally by Llama Chat and subject to change or to be removed in the future.
|
||||
|
||||
**GET /tools**
|
||||
|
||||
|
|
@ -279,7 +279,7 @@ For the direction from router to child:
|
|||
|
||||
Model management API was added via PR [#23976](https://github.com/ggml-org/llama.cpp/pull/23976)
|
||||
|
||||
The main goal of this API is to allow downloading models and/or removing models from the web UI. It relies on the model cache infrastructure under the hood to manage the list of models dynamically.
|
||||
The main goal of this API is to allow downloading models and/or removing models from Llama Chat. It relies on the model cache infrastructure under the hood to manage the list of models dynamically.
|
||||
|
||||
Instead of building everything from the ground up (like what most AI agents will do when you ask them to implement a similar feature), we built on top of existing, already well-engineered components inside the codebase:
|
||||
- Model cache infrastructure as mentioned above (`common/download.h`)
|
||||
|
|
@ -342,11 +342,11 @@ Endpoints created with `create_response(true)` (`/health`, `/props`, `/models`,
|
|||
|
||||
|
||||
|
||||
## Web UI
|
||||
## Llama Chat
|
||||
|
||||
The project includes a web-based user interface for interacting with `llama-server`. It supports both single-model (`MODEL` mode) and multi-model (`ROUTER` mode) operation.
|
||||
The project includes Llama Chat, a web-based chat app for interacting with `llama-server`. It supports both single-model (`MODEL` mode) and multi-model (`ROUTER` mode) operation.
|
||||
|
||||
The SvelteKit-based Web UI is introduced in this PR: https://github.com/ggml-org/llama.cpp/pull/14839
|
||||
The SvelteKit-based app is introduced in this PR: https://github.com/ggml-org/llama.cpp/pull/14839
|
||||
|
||||
### Features
|
||||
|
||||
|
|
@ -378,7 +378,7 @@ Routes → Components → Hooks → Stores → Services → Storage/API
|
|||
- **Services** - stateless API/database communication (`ChatService`, `ModelsService`, `PropsService`, `DatabaseService`)
|
||||
- **Hooks** - reusable logic (`useModelChangeValidation`, `useProcessingState`)
|
||||
|
||||
For detailed architecture diagrams, see [`tools/ui/docs/`](../ui/docs/):
|
||||
For detailed architecture diagrams, see [`ui/apps/chat/docs/`](../../ui/apps/chat/docs/):
|
||||
|
||||
- `high-level-architecture.mmd` - full architecture with all modules
|
||||
- `high-level-architecture-simplified.mmd` - simplified overview
|
||||
|
|
@ -390,7 +390,7 @@ For detailed architecture diagrams, see [`tools/ui/docs/`](../ui/docs/):
|
|||
|
||||
```sh
|
||||
# make sure you have Node.js installed
|
||||
cd tools/ui
|
||||
cd ui/apps/chat
|
||||
npm i
|
||||
|
||||
# run dev server (with hot reload)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Fast, lightweight, pure C/C++ HTTP server based on [httplib](https://github.com/yhirose/cpp-httplib), [nlohmann::json](https://github.com/nlohmann/json) and **llama.cpp**.
|
||||
|
||||
Set of LLM REST APIs and a web UI to interact with llama.cpp.
|
||||
Set of LLM REST APIs and Llama Chat, a built-in chat app, to interact with llama.cpp.
|
||||
|
||||
**Features:**
|
||||
* LLM inference of F16 and quantized models on GPU and CPU
|
||||
|
|
@ -17,7 +17,7 @@ Set of LLM REST APIs and a web UI to interact with llama.cpp.
|
|||
* Prefilling of assistant messages similar to the Claude API
|
||||
* [Function calling](../../docs/function-calling.md) / tool use for ~any model
|
||||
* Speculative decoding
|
||||
* Easy-to-use web UI
|
||||
* Llama Chat, an easy-to-use built-in chat app
|
||||
|
||||
For the full list of features, please refer to [server's changelog](https://github.com/ggml-org/llama.cpp/issues/9291)
|
||||
|
||||
|
|
@ -202,14 +202,14 @@ For the full list of features, please refer to [server's changelog](https://gith
|
|||
| `--api-prefix PREFIX` | prefix path the server serves from, without the trailing slash (default: )<br/>(env: LLAMA_ARG_API_PREFIX) |
|
||||
| `--ui-config, --webui-config JSON` | JSON that provides default UI settings (overrides UI defaults)<br/>(env: LLAMA_ARG_UI_CONFIG) |
|
||||
| `--ui-config-file, --webui-config-file PATH` | JSON file that provides default UI settings (overrides UI defaults)<br/>(env: LLAMA_ARG_UI_CONFIG_FILE) |
|
||||
| `--ui-mcp-proxy, --webui-mcp-proxy, --no-ui-mcp-proxy, --no-webui-mcp-proxy` | experimental: whether to enable MCP CORS proxy, for the Web UI to reach public MCP servers without CORS headers; local and private addresses are refused - do not enable in untrusted environments (default: disabled)<br/>note: for security reasons, this will limit --cors-origins to localhost by default<br/>(env: LLAMA_ARG_UI_MCP_PROXY) |
|
||||
| `--ui-mcp-proxy, --webui-mcp-proxy, --no-ui-mcp-proxy, --no-webui-mcp-proxy` | experimental: whether to enable MCP CORS proxy, for Llama Chat to reach public MCP servers without CORS headers; local and private addresses are refused - do not enable in untrusted environments (default: disabled)<br/>note: for security reasons, this will limit --cors-origins to localhost by default<br/>(env: LLAMA_ARG_UI_MCP_PROXY) |
|
||||
| `--tools TOOL1,TOOL2,...` | experimental: whether to enable built-in tools for AI agents - do not enable in untrusted environments (default: no tools)<br/>specify "all" to enable all tools<br/>available tools: read_file, file_glob_search, grep_search, exec_shell_command, write_file, edit_file, get_info<br/>note: for security reasons, this will limit --cors-origins to localhost by default<br/>(env: LLAMA_ARG_TOOLS) |
|
||||
| `--tools-runtime OPTION` | experimental: run tools in a separate runtime environment (default: none, use host environment)<br/>available options:<br/> 'docker:<image>', 'podman:<image>': spin up a new container and reuse it for all invocations, clean up on server exit<br/> 'docker-container:<id>', 'podman-container:<id>': use an existing container by ID, won't stop on server exit<br/> 'ssh:<target>': run tools on a remote POSIX host over SSH, key-based auth and a trusted host key are required<br/><br/>(env: LLAMA_ARG_TOOLS_RUNTIME) |
|
||||
| `--allow-unauthenticated-tools` | allow server tools, MCP servers or MCP proxy on a non-loopback address without an API key - only for trusted networks (default: disabled)<br/>(env: LLAMA_ARG_ALLOW_UNAUTHENTICATED_TOOLS) |
|
||||
| `--mcp-servers-config PATH` | experimental: path to JSON file with MCP server definitions (Cursor-compatible format) - do not enable in untrusted environments (default: none)<br/>note: for security reasons, this will limit --cors-origins to localhost by default<br/>(env: LLAMA_ARG_MCP_SERVERS_CONFIG) |
|
||||
| `--mcp-servers-json JSON` | experimental: inline JSON with MCP server definitions (Cursor-compatible format) - do not enable in untrusted environments (default: none)<br/>note: for security reasons, this will limit --cors-origins to localhost by default<br/>(env: LLAMA_ARG_MCP_SERVERS_JSON) |
|
||||
| `-ag, --agent, -no-ag, --no-agent` | whether to enable CORS proxy and all built-in tools - do not enable in untrusted environments (default: disabled)<br/>note: for security reasons, this will limit --cors-origins to localhost by default<br/>(env: LLAMA_ARG_AGENT) |
|
||||
| `--ui, --webui, --no-ui, --no-webui` | whether to enable the Web UI (default: enabled)<br/>(env: LLAMA_ARG_UI) |
|
||||
| `--ui, --webui, --no-ui, --no-webui` | whether to enable Llama Chat, the built-in chat app (default: enabled)<br/>(env: LLAMA_ARG_UI) |
|
||||
| `--connect` | (experimental) open a peer-to-peer tunnel for server using llama-connect (default: disabled)<br/>(env: LLAMA_ARG_CONNECT) |
|
||||
| `--connect-code CODE` | manually specify a 40-character code for --connect (default: generate a new one for each run)<br/>(env: LLAMA_ARG_CONNECT_CODE) |
|
||||
| `--embedding, --embeddings` | restrict to only support embedding use case; use only with dedicated embedding models (default: disabled)<br/>(env: LLAMA_ARG_EMBEDDINGS) |
|
||||
|
|
@ -357,7 +357,7 @@ For more details, please refer to [multimodal documentation](../../docs/multimod
|
|||
|
||||
### Server tools support
|
||||
|
||||
The server includes a set of server tools that enable the LLM to access the local file system directly from the Web UI.
|
||||
The server includes a set of server tools that enable the LLM to access the local file system directly from Llama Chat.
|
||||
|
||||
To use this feature, start the server with `--tools all`. You can also enable only specific tools by passing a comma-separated list: `--tools name1,name2,...`. Run `--help` for the full list of available tool names.
|
||||
|
||||
|
|
@ -389,11 +389,11 @@ The same JSON can be passed inline with `--mcp-servers-json`. Each entry under `
|
|||
| `cwd` | working directory of the child process |
|
||||
| `timeout_ms` | per-tool-call timeout (default: 30000) |
|
||||
|
||||
Every server is spawned once at startup to list its tools, then stopped, and respawned on demand when one of its tools is called. Tools are exposed as `<server>_<tool>` alongside the built-in ones: they show up in the Web UI and in `GET /tools`, and the model calls them like any other tool. A name colliding with an already registered tool is skipped. This is independent of `--tools`, MCP servers can be the only tools available.
|
||||
Every server is spawned once at startup to list its tools, then stopped, and respawned on demand when one of its tools is called. Tools are exposed as `<server>_<tool>` alongside the built-in ones: they show up in Llama Chat and in `GET /tools`, and the model calls them like any other tool. A name colliding with an already registered tool is skipped. This is independent of `--tools`, MCP servers can be the only tools available.
|
||||
|
||||
The child process runs with the same privileges as the server, so only declare commands you trust. As with `--tools`, `--cors-origins` then defaults to `localhost`.
|
||||
|
||||
Note: `--ui-mcp-proxy` is unrelated, it only lets the Web UI reach public MCP servers that do not send CORS headers. It refuses local and private addresses (loopback, LAN, link-local); connect to those from the Web UI directly.
|
||||
Note: `--ui-mcp-proxy` is unrelated, it only lets Llama Chat reach public MCP servers that do not send CORS headers. It refuses local and private addresses (loopback, LAN, link-local); connect to those from Llama Chat directly.
|
||||
|
||||
Any server written against the [MCP specification](https://modelcontextprotocol.io) works as is, whether it uses an official SDK or not: the transport is one JSON-RPC message per line on stdio, so a script wrapping an existing program is a valid server too.
|
||||
|
||||
|
|
@ -2044,7 +2044,7 @@ An invalid request returns the error `400`. A model that is not a decision model
|
|||
|
||||
## Server tools
|
||||
|
||||
The server exposes a REST API under `/tools` that allows the Web UI to call server tools. This endpoint is intended to be used internally by the Web UI and subject to change or to be removed in the future.
|
||||
The server exposes a REST API under `/tools` that allows Llama Chat to call server tools. This endpoint is intended to be used internally by Llama Chat and subject to change or to be removed in the future.
|
||||
|
||||
**Please do NOT use this endpoint in a downstream application**
|
||||
|
||||
|
|
@ -2643,9 +2643,9 @@ Apart from error types supported by OAI, we also have custom types that are spec
|
|||
}
|
||||
```
|
||||
|
||||
### Custom default Web UI preferences
|
||||
### Custom default Llama Chat preferences
|
||||
|
||||
You can specify default preferences for the web UI using `--ui-config <JSON config>` or `--ui-config-file <path to JSON config>`. For example, you can disable pasting long text as attachments and enable rendering Markdown in user messages with this command:
|
||||
You can specify default preferences for Llama Chat using `--ui-config <JSON config>` or `--ui-config-file <path to JSON config>`. For example, you can disable pasting long text as attachments and enable rendering Markdown in user messages with this command:
|
||||
|
||||
```bash
|
||||
./llama-server -m model.gguf --ui-config '{"pasteLongTextToFileLen": 0, "renderUserContentAsMarkdown": true}'
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
// share code = room code + pass code, must match llama-connect and the Web UI
|
||||
// share code = room code + pass code, must match llama-connect and Llama Chat
|
||||
// ref: https://github.com/ggml-org/llama-connect/blob/master/src/protocol.rs
|
||||
static constexpr size_t CONNECT_ROOM_CODE_LEN = 8;
|
||||
static constexpr size_t CONNECT_PASS_CODE_LEN = 32;
|
||||
|
|
@ -55,7 +55,7 @@ static std::string format_share_code(const std::string & code) {
|
|||
return out;
|
||||
}
|
||||
|
||||
// whitespace is tolerated, the Web UI shows the code in blocks and users paste it back
|
||||
// whitespace is tolerated, Llama Chat shows the code in blocks and users paste it back
|
||||
// returns an empty string if it is not a valid share code
|
||||
static std::string normalize_share_code(const std::string & key) {
|
||||
std::string code;
|
||||
|
|
@ -242,7 +242,7 @@ bool server_connect::start(const common_params & params, int port) {
|
|||
|
||||
SRV_INF("%s", "-----------------\n");
|
||||
SRV_INF("%s", "remote access is enabled via llama-connect\n");
|
||||
SRV_INF("share code (enter it in the Web UI under Settings -> Remote Access): %s\n",
|
||||
SRV_INF("share code (enter it in Llama Chat under Settings -> Remote Access): %s\n",
|
||||
format_share_code(code).c_str());
|
||||
SRV_WRN("%s", "anyone with this code can use this server, do not share it publicly\n");
|
||||
SRV_INF("%s", "-----------------\n");
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@ bool server_http_context::init_listener(const common_params & params) {
|
|||
};
|
||||
|
||||
//
|
||||
// Web UI setup
|
||||
// Llama Chat setup
|
||||
//
|
||||
|
||||
// Use new `params.ui` field (backed by old `params.webui` for compat)
|
||||
|
|
|
|||
|
|
@ -2058,7 +2058,7 @@ void server_models_routes::init_routes() {
|
|||
// main instance
|
||||
auto res = std::make_unique<server_http_res>();
|
||||
json props = {
|
||||
// TODO: add support for this on web UI
|
||||
// TODO: add support for this in Llama Chat
|
||||
{"role", "router"},
|
||||
{"max_instances", params.models_max},
|
||||
{"models_autoload", params.models_autoload},
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ void server_stream_session_manager_stop();
|
|||
// decoded path would split before the param is captured
|
||||
server_http_context::handler_t server_stream_make_get_handler();
|
||||
// POST /v1/streams/lookup with body {"conversation_ids": [...]}: only answers for ids the
|
||||
// caller already owns (the WebUI passes the convs visible in its sidebar), the server never
|
||||
// caller already owns (Llama Chat passes the convs visible in its sidebar), the server never
|
||||
// lists ids it has not been asked about, so a random caller cannot enumerate live sessions
|
||||
server_http_context::handler_t server_stream_make_lookup_handler();
|
||||
server_http_context::handler_t server_stream_make_delete_handler();
|
||||
|
|
|
|||
|
|
@ -1076,7 +1076,7 @@ struct server_tool_file_glob_search : server_tool {
|
|||
}
|
||||
|
||||
// `base` is always absolute (resolve falls back to the server cwd), so
|
||||
// API clients (e.g. the web UI picker) can join the relative entries
|
||||
// API clients (e.g. the Llama Chat picker) can join the relative entries
|
||||
// into absolute paths. `plain_text_response` is what the model sees;
|
||||
// `entries` is the same data as structured JSON for the UI picker,
|
||||
// which reads `entries`/`base` instead of re-parsing the text.
|
||||
|
|
@ -1953,7 +1953,7 @@ static std::vector<std::unique_ptr<server_tool>> build_tools() {
|
|||
// IMPORTANT: for contributors, please keep this array of tools as minimal as possible
|
||||
// we only accept minimal i/o and shell command tools here
|
||||
// for example, do not add: web search, get date time, etc.
|
||||
// high-level functionality should be added either via MCP or web UI
|
||||
// high-level functionality should be added either via MCP or Llama Chat
|
||||
std::vector<std::unique_ptr<server_tool>> tools;
|
||||
tools.push_back(std::make_unique<server_tool_read_file>());
|
||||
tools.push_back(std::make_unique<server_tool_file_glob_search>());
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ static bool server_setup_features(
|
|||
warn_names.push_back("peer-to-peer tunnel (llama-connect, experimental)");
|
||||
}
|
||||
|
||||
// CORS proxy (EXPERIMENTAL, only used by the Web UI for MCP)
|
||||
// CORS proxy (EXPERIMENTAL, only used by Llama Chat for MCP)
|
||||
if (params.ui_mcp_proxy) {
|
||||
ctx_http.get ("/cors-proxy", ex_wrapper(proxy_handler_get));
|
||||
ctx_http.post("/cors-proxy", ex_wrapper(proxy_handler_post));
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ def test_access_public_endpoint(endpoint: str):
|
|||
|
||||
|
||||
def test_access_static_assets_without_api_key():
|
||||
"""Static web UI assets should not require API key authentication (issue #21229)"""
|
||||
"""Static Llama Chat assets should not require API key authentication (issue #21229)"""
|
||||
global server
|
||||
server.start()
|
||||
for path in ["/", "/sw.js", "/manifest.webmanifest", "/_app/version.json"]:
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ VITE_PUBLIC_SERVER_ORIGIN='http://localhost:8033'
|
|||
# DEMO_TRACES_DATASET='<owner>/<dataset>'
|
||||
# DEMO_GITHUB_REPO='ggml-org/llama.cpp'
|
||||
# DEMO_SERVER_ORIGIN='http://localhost:9931'
|
||||
# DEMO_LLAMA_SERVER='../../build/bin/llama-server'
|
||||
# DEMO_LLAMA_SERVER='../../../build/bin/llama-server'
|
||||
# DEMO_COLOR_SCHEME='light'
|
||||
# Device pixel ratio demos render and record at (1440x900 viewport)
|
||||
# DEMO_SCALE='2'
|
||||
|
|
@ -91,7 +91,7 @@ Llama UI supports two server operation modes:
|
|||
### 1. Install Dependencies
|
||||
|
||||
```bash
|
||||
cd tools/ui
|
||||
cd ui/apps/chat
|
||||
npm ci
|
||||
```
|
||||
|
||||
|
|
@ -192,7 +192,7 @@ npm run build
|
|||
The build process:
|
||||
|
||||
1. **Vite Build** - Bundles all TypeScript, Svelte, and CSS
|
||||
2. **Static Adapter** - Outputs to `../../build/tools/ui/dist` (llama-server's static file directory)
|
||||
2. **Static Adapter** - Outputs to `../../../build/ui/apps/chat/dist` (llama-server's static file directory)
|
||||
3. **Post-Build Script** - Cleans up intermediate files
|
||||
4. **Custom Plugin** - Creates `index.html` with:
|
||||
- Inlined favicon as base64
|
||||
|
|
@ -200,7 +200,7 @@ The build process:
|
|||
- Deterministic output (zeroed timestamps)
|
||||
|
||||
```text
|
||||
tools/ui/ → build → build/tools/ui/dist/
|
||||
ui/apps/chat/ → build → build/ui/apps/chat/dist/
|
||||
├── src/ ├── index.html (served by llama-server)
|
||||
├── static/ └── (favicon inlined)
|
||||
└── ...
|
||||
|
|
@ -211,8 +211,8 @@ tools/ui/ → build → build/tools/ui/dist/
|
|||
```javascript
|
||||
// svelte.config.js
|
||||
adapter: adapter({
|
||||
pages: '../../build/tools/ui/dist', // Output directory
|
||||
assets: '../../build/tools/ui/dist', // Static assets
|
||||
pages: '../../../build/ui/apps/chat/dist', // Output directory
|
||||
assets: '../../../build/ui/apps/chat/dist', // Static assets
|
||||
fallback: 'index.html', // SPA fallback
|
||||
strict: true
|
||||
}),
|
||||
|
|
@ -225,7 +225,7 @@ output: {
|
|||
|
||||
llama-ui is embedded directly into the llama-server binary:
|
||||
|
||||
1. `npm run build` outputs `index.html` to `build/tools/ui/dist/`
|
||||
1. `npm run build` outputs `index.html` to `build/ui/apps/chat/dist/`
|
||||
2. llama-server compiles this into the binary at build time
|
||||
3. When accessing `/`, llama-server serves the bundled HTML
|
||||
|
||||
|
|
@ -745,7 +745,7 @@ npm run check # TypeScript type checking
|
|||
## Project Structure
|
||||
|
||||
```text
|
||||
tools/ui/
|
||||
ui/apps/chat/
|
||||
├── src/
|
||||
│ ├── lib/
|
||||
│ │ ├── components/ # UI components (app/, ui/)
|
||||
|
|
@ -765,6 +765,6 @@ tools/ui/
|
|||
|
||||
## Related Documentation
|
||||
|
||||
- [llama.cpp Server README](../server/README.md) - Full server documentation
|
||||
- [Multimodal Documentation](../../docs/multimodal.md) - Image and audio support
|
||||
- [Function Calling](../../docs/function-calling.md) - Tool use capabilities
|
||||
- [llama.cpp Server README](../../../tools/server/README.md) - Full server documentation
|
||||
- [Multimodal Documentation](../../../docs/multimodal.md) - Image and audio support
|
||||
- [Function Calling](../../../docs/function-calling.md) - Tool use capabilities
|
||||
|
|
@ -40,7 +40,7 @@ The bucket must be public, since GitHub loads the preview from it:
|
|||
hf buckets create <owner>/llama-ui-demos
|
||||
```
|
||||
|
||||
Then set it in `tools/ui/.env` (see `.env.example`):
|
||||
Then set it in `ui/apps/chat/.env` (see `.env.example`):
|
||||
|
||||
```bash
|
||||
DEMO_STORAGE='hf://buckets/<owner>/llama-ui-demos'
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
* node demo/cli.ts docs record every docs/*.demo.ts script in DEMO_STORAGE
|
||||
* node demo/cli.ts traces write the built-in traces, and push them to DEMO_TRACES_DATASET
|
||||
*
|
||||
* Settings come from tools/ui/.env (see .env.example).
|
||||
* Settings come from ui/apps/chat/.env (see .env.example).
|
||||
*/
|
||||
|
||||
import { DEMO_TRACES, generateTrace } from './fixtures/traces.ts';
|
||||
|
|
@ -271,13 +271,13 @@ async function recordPr(number: string, trustedSha?: string): Promise<void> {
|
|||
rmSync(worktree, { force: true, recursive: true });
|
||||
run('git', ['worktree', 'prune']);
|
||||
run('git', ['worktree', 'add', '--detach', worktree, sha]);
|
||||
symlinkSync(join(UI_DIR, 'node_modules'), join(worktree, 'tools/ui/node_modules'));
|
||||
symlinkSync(join(UI_DIR, 'node_modules'), join(worktree, 'ui/apps/chat/node_modules'));
|
||||
|
||||
const name = `pr-${number}`;
|
||||
const script = writeDemoScript(name, source);
|
||||
|
||||
try {
|
||||
const videos = (await record([script], join(worktree, 'tools/ui'))).map((video) => ({
|
||||
const videos = (await record([script], join(worktree, 'ui/apps/chat'))).map((video) => ({
|
||||
...video,
|
||||
gif: makePreview(video.mp4)
|
||||
}));
|
||||
|
|
@ -10,8 +10,8 @@ if (existsSync(ENV_FILE)) process.loadEnvFile(ENV_FILE);
|
|||
/**
|
||||
* Demo video recordings.
|
||||
*
|
||||
* Env (also read from tools/ui/.env):
|
||||
* DEMO_UI_DIR tools/ui checkout to record (default: this one), e.g. a PR worktree
|
||||
* Env (also read from ui/apps/chat/.env):
|
||||
* DEMO_UI_DIR ui/apps/chat checkout to record (default: this one), e.g. a PR worktree
|
||||
* DEMO_UI_PORT port for that checkout's vite dev server (default: 5180)
|
||||
* DEMO_SERVER_ORIGIN llama-server the UI proxies to (default: http://localhost:9931)
|
||||
* DEMO_LLAMA_SERVER llama-server binary started when none runs there (default: build/bin)
|
||||
|
|
@ -27,7 +27,8 @@ const UI_PORT = Number(process.env.DEMO_UI_PORT ?? 5180);
|
|||
const SERVER_ORIGIN = process.env.DEMO_SERVER_ORIGIN ?? 'http://localhost:9931';
|
||||
const SERVER_PORT = Number(new URL(SERVER_ORIGIN).port || 80);
|
||||
const LLAMA_SERVER =
|
||||
process.env.DEMO_LLAMA_SERVER ?? resolve(import.meta.dirname, '../../../build/bin/llama-server');
|
||||
process.env.DEMO_LLAMA_SERVER ??
|
||||
resolve(import.meta.dirname, '../../../../build/bin/llama-server');
|
||||
|
||||
export const VIEWPORT = { height: 900, width: 1440 };
|
||||
/** Device pixel ratio the demos render and record at. */
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"name": "llama-ui",
|
||||
"name": "@ggml-org/llama-chat",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "llama-ui",
|
||||
"name": "@ggml-org/llama-chat",
|
||||
"version": "1.0.0",
|
||||
"devDependencies": {
|
||||
"@chromatic-com/storybook": "5.5.1",
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "llama-ui",
|
||||
"name": "@ggml-org/llama-chat",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
|
|
@ -9,12 +9,12 @@
|
|||
# bash scripts/dev.sh
|
||||
# npm run dev
|
||||
|
||||
cd ../../
|
||||
cd ../../../
|
||||
|
||||
# Ensure node_modules are installed
|
||||
if [ ! -d "tools/ui/node_modules" ]; then
|
||||
if [ ! -d "ui/apps/chat/node_modules" ]; then
|
||||
echo "📦 Installing npm dependencies..."
|
||||
cd tools/ui && npm ci && cd ../../
|
||||
cd ui/apps/chat && npm ci && cd ../../../
|
||||
fi
|
||||
|
||||
# Check and install git hooks if missing
|
||||
|
|
@ -52,7 +52,7 @@ trap cleanup SIGINT SIGTERM
|
|||
|
||||
echo "🚀 Starting development servers..."
|
||||
echo "📝 Note: Make sure to start llama-server separately if needed"
|
||||
cd tools/ui
|
||||
cd ui/apps/chat
|
||||
# Use --insecure-http-parser to handle malformed HTTP responses from llama-server
|
||||
# (some responses have both Content-Length and Transfer-Encoding headers)
|
||||
storybook dev -p 6006 --ci & NODE_OPTIONS="--insecure-http-parser" vite dev --host 0.0.0.0 &
|
||||
|
|
@ -4,12 +4,12 @@
|
|||
# Copies pre-commit and pre-push hooks into the repo's .git/hooks directory.
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/../../../.." && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/../../../../.." && pwd)"
|
||||
HOOKS_DIR="$REPO_ROOT/$(cd "$REPO_ROOT" && git rev-parse --git-path hooks)"
|
||||
|
||||
# Verify package.json exists
|
||||
if [ ! -f "$REPO_ROOT/tools/ui/package.json" ]; then
|
||||
echo "❌ package.json not found in tools/ui"
|
||||
if [ ! -f "$REPO_ROOT/ui/apps/chat/package.json" ]; then
|
||||
echo "❌ package.json not found in ui/apps/chat"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -4,13 +4,13 @@
|
|||
# Runs: format (staged files only) + type-check
|
||||
# Stashes unstaged changes temporarily and restores them after.
|
||||
|
||||
# Only run when there are staged changes in tools/ui/
|
||||
if ! git diff --cached --name-only | grep -q "^tools/ui/"; then
|
||||
# Only run when there are staged changes in ui/apps/chat/
|
||||
if ! git diff --cached --name-only | grep -q "^ui/apps/chat/"; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
cd "$REPO_ROOT/tools/ui"
|
||||
cd "$REPO_ROOT/ui/apps/chat"
|
||||
|
||||
# Check that node_modules exists
|
||||
if [ ! -d "node_modules" ]; then
|
||||
|
|
@ -18,19 +18,19 @@ if [ ! -d "node_modules" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Stash unstaged changes in tools/ui/ so they don't interfere
|
||||
# Stash unstaged changes in ui/apps/chat/ so they don't interfere
|
||||
stash_name="pi-ui-precommit"
|
||||
git stash push --keep-index -u -m "$stash_name" -- tools/ui/ 2>/dev/null || true
|
||||
git stash push --keep-index -u -m "$stash_name" -- ui/apps/chat/ 2>/dev/null || true
|
||||
|
||||
echo "Running pre-commit checks for llama-ui..."
|
||||
|
||||
# Format only staged files
|
||||
staged_ui=$(git diff --cached --name-only -- tools/ui/)
|
||||
staged_ui=$(git diff --cached --name-only -- ui/apps/chat/)
|
||||
if [ -n "$staged_ui" ]; then
|
||||
echo "$staged_ui" | xargs npm run format
|
||||
format_ok=$?
|
||||
# Re-stage formatted files
|
||||
git add tools/ui/
|
||||
git add ui/apps/chat/
|
||||
else
|
||||
format_ok=0
|
||||
fi
|
||||
|
|
@ -15,8 +15,8 @@ while read local_ref local_sha remote_ref remote_sha; do
|
|||
continue
|
||||
fi
|
||||
|
||||
# Check for changes in tools/ui/ between remote and local
|
||||
if git diff --name-only "$remote_sha...$local_sha" -- tools/ui/ | grep -q .; then
|
||||
# Check for changes in ui/apps/chat/ between remote and local
|
||||
if git diff --name-only "$remote_sha...$local_sha" -- ui/apps/chat/ | grep -q .; then
|
||||
needs_check=true
|
||||
fi
|
||||
done
|
||||
|
|
@ -26,7 +26,7 @@ if [ "$needs_check" = false ]; then
|
|||
fi
|
||||
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
cd "$REPO_ROOT/tools/ui"
|
||||
cd "$REPO_ROOT/ui/apps/chat"
|
||||
|
||||
# Check that node_modules exists
|
||||
if [ ! -d "node_modules" ]; then
|
||||
|
|
@ -36,7 +36,7 @@ fi
|
|||
|
||||
# Stash unstaged changes so they don't interfere with checks
|
||||
stash_name="pi-ui-prepush"
|
||||
git stash push -u -m "$stash_name" -- tools/ui/ 2>/dev/null || true
|
||||
git stash push -u -m "$stash_name" -- ui/apps/chat/ 2>/dev/null || true
|
||||
|
||||
echo "Running pre-push checks for llama-ui..."
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue