Files
llama.cpp/ui/apps/chat/demo/playwright.config.ts
T
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

89 lines
3.1 KiB
TypeScript

import { DEMO_MCP_PORT } from './fixtures/demo-config.ts';
import { defineConfig, devices } from '@playwright/test';
import { existsSync } from 'node:fs';
import { resolve } from 'node:path';
const ENV_FILE = resolve(import.meta.dirname, '../.env');
if (existsSync(ENV_FILE)) process.loadEnvFile(ENV_FILE);
/**
* Demo video recordings.
*
* 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)
* DEMO_COLOR_SCHEME light | dark (default: light)
*/
// Playwright clears outputDir when a run starts, so concurrent recordings each get
// their own; workers inherit the env, so they resolve the same directory
process.env.DEMO_RUN_ID ??= String(process.pid);
const UI_DIR = resolve(process.env.DEMO_UI_DIR ?? resolve(import.meta.dirname, '..'));
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');
export const VIEWPORT = { height: 900, width: 1440 };
/** Device pixel ratio the demos render and record at. */
const SCALE = Number(process.env.DEMO_SCALE ?? 2);
export default defineConfig({
expect: {
timeout: 10000
},
fullyParallel: false,
outputDir: `test-results/${process.env.DEMO_RUN_ID}`,
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'], deviceScaleFactor: SCALE, viewport: VIEWPORT }
}
],
reporter: 'line',
retries: 0,
testDir: '.',
testMatch: ['**/*.demo.ts'],
timeout: 120000,
use: {
actionTimeout: 10000,
baseURL: `http://localhost:${UI_PORT}`,
colorScheme: process.env.DEMO_COLOR_SCHEME === 'dark' ? 'dark' : 'light',
// headless Chromium screencasts at 1x unless the scale is forced at launch; the sandbox
// is on since a PR demo runs that PR's code (Playwright turns it off by default). Not the
// installed Chrome: its headless mode screencasts a window that ignores the viewport
launchOptions: { args: [`--force-device-scale-factor=${SCALE}`], chromiumSandbox: true },
// recorded through the screencast in recorder.ts, at the device pixel ratio
video: 'off',
viewport: VIEWPORT
},
webServer: [
{
command: `node ${resolve(import.meta.dirname, 'fixtures/mcp-servers.ts')}`,
reuseExistingServer: true,
url: `http://localhost:${DEMO_MCP_PORT}/health`
},
{
command: `${LLAMA_SERVER} --host 127.0.0.1 --port ${SERVER_PORT} --tools all`,
reuseExistingServer: true,
timeout: 60000,
url: `${SERVER_ORIGIN}/health`
},
{
command: `npx vite dev --port ${UI_PORT} --strictPort`,
cwd: UI_DIR,
env: { VITE_PUBLIC_SERVER_ORIGIN: SERVER_ORIGIN },
reuseExistingServer: true,
timeout: 120000,
url: `http://localhost:${UI_PORT}`
}
],
workers: 1
});