Files
llama.cpp/ui/apps/chat/demo
Aleksander Grygier 3a7660371d 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)
2026-11-16 17:23:36 +01:00
..

Demo videos

Scripted Playwright walkthroughs of the UI, exported as mp4 with an animated GIF preview, for pull requests and documentation. The harness lives here; the demo scripts don't:

  • PR demos live in the PR description, as a ts demo code block.
  • Docs demos live in the storage target, under scripts/docs/.
demo/
├── cli.ts      demo:pr, demo:docs and demo:traces
├── storage.ts  storage targets (hf://, file://)
├── helpers.ts  `test` with a `demo` fixture: cursor, captions, human-like timing
├── recorder.ts screencast recording and mp4 export
├── fixtures/   fixture MCP servers, seeded settings and demo conversations
└── videos/     output (git-ignored)

Setup

Tools

Tool Used for
Node 22.18+ runs demo/cli.ts directly (TypeScript type stripping)
npx playwright install chromium the browser demos record in, with its sandbox on
ffmpeg mp4 encoding and the GIF preview
gh, logged in reads the PR description and writes the ## Demo section, so you need edit rights on the PR
hf, logged in with a write token (hf auth login) uploads to the bucket and the traces dataset
llama-server build/bin/llama-server, or one already running at DEMO_SERVER_ORIGIN (default :9931). It runs in router mode, so demos can pick any model in the local cache; scripts that send messages need at least one.

gh is only needed for demo:pr, and hf only with the bucket or dataset below. Without them, the video stays in demo/videos/.

Videos are recorded through Chromium's screencast at DEMO_SCALE (2x by default, so 2880x1800) and 60 fps, starting once the page has settled.

Hugging Face bucket (videos, previews, scripts)

The bucket must be public, since GitHub loads the preview from it:

hf buckets create <owner>/llama-ui-demos

Then set it in ui/apps/chat/.env (see .env.example):

DEMO_STORAGE='hf://buckets/<owner>/llama-ui-demos'
DEMO_STORAGE_PUBLIC_URL='https://huggingface.co/buckets/<owner>/llama-ui-demos/resolve'

Layout: videos/pr/<number>/<sha>.{mp4,gif,demo.ts}, videos/docs/<name>.{mp4,gif} and scripts/docs/*.demo.ts (the docs scripts). Without DEMO_STORAGE_PUBLIC_URL, videos are uploaded but not linked in the PR. DEMO_STORAGE='file:///some/dir' stores them in a local folder instead.

Hugging Face dataset (conversations, optional)

Only needed for demos that import conversations other than the built-in ones, or to publish the built-in ones with npm run demo:traces. It can be private: it is read with your hf login.

hf repos create <owner>/llama-ui-demo-traces --repo-type dataset --private
DEMO_TRACES_DATASET='<owner>/llama-ui-demo-traces'

Other storage

Only Hugging Face buckets and file:// folders are supported for now. S3, R2 or similar would be one more class in storage.ts (upload and downloadDir) plus the matching DEMO_STORAGE_PUBLIC_URL.

Recording a pull request

Add the script to the PR description:

<details>
<summary>Demo script</summary>

```ts demo
test('demo', async ({ demo, page }) => {
	await demo.click(page.getByRole('button', { exact: true, name: 'Settings' }));
	await demo.caption('What this shows');
});
```

</details>

Then run:

npm run demo:pr -- 31303

A PR by someone else runs its code and demo script on your machine, with your gh and hf logins, so demo:pr refuses it until you've read its diff and demo block and pass the head commit you read: npm run demo:pr -- 31303 --trust <sha>. If the PR gets new commits, it refuses again.

It checks out the PR head in a temporary worktree, records the script against it, uploads videos/pr/<number>/<sha>.{mp4,gif,demo.ts} and adds or updates a ## Demo section in the PR description with the preview linking to the video.

A large PR can show its changes in several shorter videos: each test() in the block is recorded as its own video (<sha>-1.mp4, <sha>-2.mp4, ...), and the ## Demo section shows their previews in a table, each headed by its test's title: up to four portrait (phone) videos to a row, or two landscape ones. Helpers and test.use at the top of the block are shared by all of them.

test('Header and safe areas', async ({ demo, page }) => {
	// ...
});

test('Sidebar gestures', async ({ demo, page }) => {
	// ...
});
``` GitHub has no API for attachments, so for an inline player drag `demo/videos/pr-<number>.mp4` into the description instead.

## Recording docs

```bash
npm run demo:docs

Records every scripts/docs/*.demo.ts from the storage target and uploads videos/docs/<name>.{mp4,gif}.

Writing a demo

Scripts get test and expect from helpers.ts without importing them. demo.click, demo.hover and demo.type glide a visible cursor to the target before acting, with timing varied like a person's (seeded per demo, so re-takes match); demo.scroll turns the mouse wheel over a target; demo.zoom pinches in on a control or a point to show a detail too small to read in the frame, holds, and pinches back out (with the fingertips drawn on a touch device); demo.caption shows a caption at the top of the frame. Use test.use({ settings, startPath }) to seed other settings or start on another route.

Conversations

Demos that need existing chats import them with test.use({ traces: ['long-chat'] }), through Settings > Import/Export before the video starts. Traces use the export format (llama.app JSONL), so the Hub shows them as Llama traces:

  • fixtures/traces.ts generates the built-in ones: long-chat (36 tall exchanges) and agentic-debugging (long reasoning, shell output and code blocks).
  • Any other name is downloaded as <name>.jsonl from DEMO_TRACES_DATASET, e.g. an exported conversation uploaded there.

npm run demo:traces writes the built-in traces to demo/traces/ and pushes them to DEMO_TRACES_DATASET.

Trying a script locally

To try a script locally, put it in demo/ as <name>.demo.ts, importing from ./helpers.ts, and run npm run demo:record -- demo/<name>. npm run demo:codegen opens Playwright codegen against :5180 for a first draft.

The config starts, or reuses when already running, the fixture MCP servers on :8765, llama-server on :9931 (router mode, --tools all) and the UI's vite dev server.