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:
Aleksander Grygier
2026-05-16 02:02:40 +02:00
committed by GitHub
co-authored by Xuan Son Nguyen
parent 49d1701bd2
commit 59778f0196
565 changed files with 1610 additions and 694 deletions
+18
View File
@@ -0,0 +1,18 @@
/**
* OpenAI-compatible tool call type.
*/
export enum ToolCallType {
FUNCTION = 'function'
}
/**
* Types of sections in agentic content display.
*/
export enum AgenticSectionType {
TEXT = 'text',
TOOL_CALL = 'tool_call',
TOOL_CALL_PENDING = 'tool_call_pending',
TOOL_CALL_STREAMING = 'tool_call_streaming',
REASONING = 'reasoning',
REASONING_PENDING = 'reasoning_pending'
}
+53
View File
@@ -0,0 +1,53 @@
/**
* Attachment type enum for database message extras
*/
export enum AttachmentType {
AUDIO = 'AUDIO',
IMAGE = 'IMAGE',
MCP_PROMPT = 'MCP_PROMPT',
MCP_RESOURCE = 'MCP_RESOURCE',
PDF = 'PDF',
TEXT = 'TEXT',
LEGACY_CONTEXT = 'context' // Legacy attachment type for backward compatibility
}
/**
* Unique identifiers for attachment menu items in the chat form action dropdowns.
* Used to select which file upload or attachment action is triggered.
*/
export enum AttachmentMenuItemId {
IMAGES = 'images',
AUDIO = 'audio',
TEXT = 'text',
PDF = 'pdf',
SYSTEM_MESSAGE = 'system-message',
MCP_PROMPT = 'mcp-prompt',
MCP_RESOURCES = 'mcp-resources'
}
/**
* Defines when an attachment menu item should be enabled.
*/
export enum AttachmentItemEnabledWhen {
ALWAYS = 'always',
HAS_VISION_MODALITY = 'hasVisionModality',
HAS_AUDIO_MODALITY = 'hasAudioModality'
}
/**
* Defines the callback action triggered when an attachment menu item is clicked.
*/
export enum AttachmentAction {
FILE_UPLOAD = 'onFileUpload',
SYSTEM_PROMPT_CLICK = 'onSystemPromptClick',
MCP_PROMPT_CLICK = 'onMcpPromptClick',
MCP_RESOURCES_CLICK = 'onMcpResourcesClick'
}
/**
* Visibility conditions for attachment menu items.
*/
export enum AttachmentItemVisibleWhen {
HAS_MCP_PROMPTS_SUPPORT = 'hasMcpPromptsSupport',
HAS_MCP_RESOURCES_SUPPORT = 'hasMcpResourcesSupport'
}
+64
View File
@@ -0,0 +1,64 @@
export enum ChatMessageStatsView {
GENERATION = 'generation',
READING = 'reading',
TOOLS = 'tools',
SUMMARY = 'summary'
}
/**
* Reasoning format options for API requests.
*/
export enum ReasoningFormat {
NONE = 'none',
AUTO = 'auto'
}
/**
* Message roles for chat messages.
*/
export enum MessageRole {
USER = 'user',
ASSISTANT = 'assistant',
SYSTEM = 'system',
TOOL = 'tool'
}
/**
* Message types for different content kinds.
*/
export enum MessageType {
ROOT = 'root',
TEXT = 'text',
THINK = 'think',
SYSTEM = 'system'
}
/**
* Content part types for API chat message content.
*/
export enum ContentPartType {
TEXT = 'text',
IMAGE_URL = 'image_url',
INPUT_AUDIO = 'input_audio'
}
/**
* Error dialog types for displaying server/timeout errors.
*/
export enum ErrorDialogType {
TIMEOUT = 'timeout',
SERVER = 'server'
}
export enum ConversationSelectionMode {
EXPORT = 'export',
IMPORT = 'import'
}
/**
* PDF view mode options for previewing PDF attachments.
*/
export enum PdfViewMode {
TEXT = 'text',
PAGES = 'pages'
}
+235
View File
@@ -0,0 +1,235 @@
/**
* Comprehensive dictionary of all supported file types in llama-ui
* Organized by category with TypeScript enums for better type safety
*/
// File type category enum
export enum FileTypeCategory {
IMAGE = 'image',
AUDIO = 'audio',
PDF = 'pdf',
TEXT = 'text'
}
/**
* Special file types for internal use (not MIME types)
*/
export enum SpecialFileType {
MCP_PROMPT = 'mcp-prompt'
}
// Specific file type enums for each category
export enum FileTypeImage {
JPEG = 'jpeg',
PNG = 'png',
GIF = 'gif',
WEBP = 'webp',
SVG = 'svg'
}
export enum FileTypeAudio {
MP3 = 'mp3',
WAV = 'wav',
WEBM = 'webm'
}
export enum FileTypePdf {
PDF = 'pdf'
}
export enum FileTypeText {
PLAIN_TEXT = 'plainText',
MARKDOWN = 'md',
ASCIIDOC = 'asciidoc',
JAVASCRIPT = 'js',
TYPESCRIPT = 'ts',
JSX = 'jsx',
TSX = 'tsx',
CSS = 'css',
HTML = 'html',
JSON = 'json',
XML = 'xml',
YAML = 'yaml',
CSV = 'csv',
LOG = 'log',
PYTHON = 'python',
JAVA = 'java',
CPP = 'cpp',
PHP = 'php',
RUBY = 'ruby',
GO = 'go',
RUST = 'rust',
SHELL = 'shell',
SQL = 'sql',
R = 'r',
SCALA = 'scala',
KOTLIN = 'kotlin',
SWIFT = 'swift',
DART = 'dart',
VUE = 'vue',
SVELTE = 'svelte',
LATEX = 'latex',
BIBTEX = 'bibtex',
CUDA = 'cuda',
VULKAN = 'vulkan',
HASKELL = 'haskell',
CSHARP = 'csharp',
PROPERTIES = 'properties'
}
// File extension enums
export enum FileExtensionImage {
JPG = '.jpg',
JPEG = '.jpeg',
PNG = '.png',
GIF = '.gif',
WEBP = '.webp',
SVG = '.svg'
}
export enum FileExtensionAudio {
MP3 = '.mp3',
WAV = '.wav'
}
export enum FileExtensionPdf {
PDF = '.pdf'
}
export enum FileExtensionText {
TXT = '.txt',
MD = '.md',
ADOC = '.adoc',
JS = '.js',
TS = '.ts',
JSX = '.jsx',
TSX = '.tsx',
CSS = '.css',
HTML = '.html',
HTM = '.htm',
JSON = '.json',
XML = '.xml',
YAML = '.yaml',
YML = '.yml',
CSV = '.csv',
LOG = '.log',
PY = '.py',
JAVA = '.java',
CPP = '.cpp',
C = '.c',
H = '.h',
PHP = '.php',
RB = '.rb',
GO = '.go',
RS = '.rs',
SH = '.sh',
BAT = '.bat',
SQL = '.sql',
R = '.r',
SCALA = '.scala',
KT = '.kt',
SWIFT = '.swift',
DART = '.dart',
VUE = '.vue',
SVELTE = '.svelte',
TEX = '.tex',
BIB = '.bib',
CU = '.cu',
CUH = '.cuh',
COMP = '.comp',
HPP = '.hpp',
HS = '.hs',
PROPERTIES = '.properties',
CS = '.cs'
}
// MIME type prefixes and includes for content detection
export enum MimeTypePrefix {
IMAGE = 'image/',
TEXT = 'text'
}
export enum MimeTypeIncludes {
JSON = 'json',
JAVASCRIPT = 'javascript',
TYPESCRIPT = 'typescript'
}
// URI patterns for content detection
export enum UriPattern {
DATABASE_KEYWORD = 'database',
DATABASE_SCHEME = 'db://'
}
// MIME type enums
export enum MimeTypeApplication {
PDF = 'application/pdf',
OCTET_STREAM = 'application/octet-stream'
}
export enum MimeTypeAudio {
MP3_MPEG = 'audio/mpeg',
MP3 = 'audio/mp3',
MP4 = 'audio/mp4',
WAV = 'audio/wav',
WEBM = 'audio/webm',
WEBM_OPUS = 'audio/webm;codecs=opus'
}
export enum MimeTypeImage {
JPEG = 'image/jpeg',
JPG = 'image/jpg',
PNG = 'image/png',
GIF = 'image/gif',
WEBP = 'image/webp',
SVG = 'image/svg+xml',
ICO = 'image/x-icon',
ICO_MICROSOFT = 'image/vnd.microsoft.icon'
}
export enum MimeTypeText {
PLAIN = 'text/plain',
MARKDOWN = 'text/markdown',
ASCIIDOC = 'text/asciidoc',
JAVASCRIPT = 'text/javascript',
JAVASCRIPT_APP = 'application/javascript',
TYPESCRIPT = 'text/typescript',
JSX = 'text/jsx',
TSX = 'text/tsx',
CSS = 'text/css',
HTML = 'text/html',
JSON = 'application/json',
XML_TEXT = 'text/xml',
XML_APP = 'application/xml',
YAML_TEXT = 'text/yaml',
YAML_APP = 'application/yaml',
CSV = 'text/csv',
PYTHON = 'text/x-python',
JAVA = 'text/x-java-source',
CPP_HDR = 'text/x-c++hdr',
CPP_SRC = 'text/x-c++src',
CSHARP = 'text/x-csharp',
HASKELL = 'text/x-haskell',
C_SRC = 'text/x-csrc',
C_HDR = 'text/x-chdr',
PHP = 'text/x-php',
RUBY = 'text/x-ruby',
GO = 'text/x-go',
RUST = 'text/x-rust',
SHELL = 'text/x-shellscript',
BAT = 'application/x-bat',
SQL = 'text/x-sql',
R = 'text/x-r',
SCALA = 'text/x-scala',
KOTLIN = 'text/x-kotlin',
SWIFT = 'text/x-swift',
DART = 'text/x-dart',
VUE = 'text/x-vue',
SVELTE = 'text/x-svelte',
TEX = 'text/x-tex',
TEX_APP = 'application/x-tex',
LATEX = 'application/x-latex',
BIBTEX = 'text/x-bibtex',
CUDA = 'text/x-cuda',
PROPERTIES = 'text/properties'
}
+62
View File
@@ -0,0 +1,62 @@
export {
AttachmentType,
AttachmentMenuItemId,
AttachmentItemEnabledWhen,
AttachmentAction,
AttachmentItemVisibleWhen
} from './attachment';
export { AgenticSectionType, ToolCallType } from './agentic';
export {
ChatMessageStatsView,
ContentPartType,
ConversationSelectionMode,
ErrorDialogType,
MessageRole,
MessageType,
PdfViewMode,
ReasoningFormat
} from './chat';
export {
FileTypeCategory,
FileTypeImage,
FileTypeAudio,
FileTypePdf,
FileTypeText,
FileExtensionImage,
FileExtensionAudio,
FileExtensionPdf,
FileExtensionText,
MimeTypePrefix,
MimeTypeIncludes,
UriPattern,
MimeTypeApplication,
MimeTypeAudio,
MimeTypeImage,
MimeTypeText,
SpecialFileType
} from './files';
export {
MCPConnectionPhase,
MCPLogLevel,
MCPTransportType,
HealthCheckStatus,
MCPContentType,
MCPRefType,
JsonSchemaType
} from './mcp';
export { ModelModality } from './model';
export { ServerRole, ServerModelStatus } from './server';
export { ParameterSource, SyncableParameterType, SettingsFieldType } from './settings';
export { ColorMode, HtmlInputType, McpPromptVariant, TooltipSide, UrlProtocol } from './ui';
export { KeyboardKey } from './keyboard';
export { ToolSource, ToolPermissionDecision, ToolResponseField } from './tools';
+19
View File
@@ -0,0 +1,19 @@
/**
* Keyboard key names for event handling
*/
export enum KeyboardKey {
ENTER = 'Enter',
ESCAPE = 'Escape',
ARROW_UP = 'ArrowUp',
ARROW_DOWN = 'ArrowDown',
ARROW_LEFT = 'ArrowLeft',
ARROW_RIGHT = 'ArrowRight',
TAB = 'Tab',
D_LOWER = 'd',
D_UPPER = 'D',
E_UPPER = 'E',
K_LOWER = 'k',
O_LOWER = 'o',
O_UPPER = 'O',
SPACE = ' '
}
+66
View File
@@ -0,0 +1,66 @@
/**
* Connection lifecycle phases for MCP protocol
*/
export enum MCPConnectionPhase {
IDLE = 'idle',
TRANSPORT_CREATING = 'transport_creating',
TRANSPORT_READY = 'transport_ready',
INITIALIZING = 'initializing',
CAPABILITIES_EXCHANGED = 'capabilities_exchanged',
LISTING_TOOLS = 'listing_tools',
CONNECTED = 'connected',
ERROR = 'error',
DISCONNECTED = 'disconnected'
}
/**
* Log level for connection events
*/
export enum MCPLogLevel {
INFO = 'info',
WARN = 'warn',
ERROR = 'error'
}
/**
* Transport types for MCP connections
*/
export enum MCPTransportType {
WEBSOCKET = 'websocket',
STREAMABLE_HTTP = 'streamable_http',
SSE = 'sse'
}
/**
* Health check status for MCP servers
*/
export enum HealthCheckStatus {
IDLE = 'idle',
CONNECTING = 'connecting',
SUCCESS = 'success',
ERROR = 'error'
}
/**
* Content types for MCP tool results
*/
export enum MCPContentType {
TEXT = 'text',
IMAGE = 'image',
RESOURCE = 'resource'
}
/**
* JSON Schema types used in MCP tool definitions
*/
export enum JsonSchemaType {
OBJECT = 'object'
}
/**
* Reference types for MCP completions
*/
export enum MCPRefType {
PROMPT = 'ref/prompt',
RESOURCE = 'ref/resource'
}
+5
View File
@@ -0,0 +1,5 @@
export enum ModelModality {
TEXT = 'TEXT',
AUDIO = 'AUDIO',
VISION = 'VISION'
}
+21
View File
@@ -0,0 +1,21 @@
/**
* Server role enum - used for single/multi-model mode
*/
export enum ServerRole {
/** Single model mode - server running with a specific model loaded */
MODEL = 'model',
/** Router mode - server managing multiple model instances */
ROUTER = 'router'
}
/**
* Model status enum - matches tools/server/server-models.h from C++ server
* Used as the `value` field in the status object from /models endpoint
*/
export enum ServerModelStatus {
UNLOADED = 'unloaded',
LOADING = 'loading',
LOADED = 'loaded',
SLEEPING = 'sleeping',
FAILED = 'failed'
}
+26
View File
@@ -0,0 +1,26 @@
/**
* Parameter source - indicates whether a parameter uses default or custom value
*/
export enum ParameterSource {
DEFAULT = 'default',
CUSTOM = 'custom'
}
/**
* Syncable parameter type - data types for parameters that can be synced with server
*/
export enum SyncableParameterType {
NUMBER = 'number',
STRING = 'string',
BOOLEAN = 'boolean'
}
/**
* Settings field type - defines the input type for settings fields
*/
export enum SettingsFieldType {
INPUT = 'input',
TEXTAREA = 'textarea',
CHECKBOX = 'checkbox',
SELECT = 'select'
}
+17
View File
@@ -0,0 +1,17 @@
export enum ToolSource {
BUILTIN = 'builtin',
MCP = 'mcp',
CUSTOM = 'custom'
}
export enum ToolPermissionDecision {
ALWAYS = 'always',
ALWAYS_SERVER = 'always_server',
ONCE = 'once',
DENY = 'deny'
}
export enum ToolResponseField {
PLAIN_TEXT = 'plain_text_response',
ERROR = 'error'
}
+35
View File
@@ -0,0 +1,35 @@
export enum ColorMode {
LIGHT = 'light',
DARK = 'dark',
SYSTEM = 'system'
}
export enum TooltipSide {
TOP = 'top',
RIGHT = 'right',
BOTTOM = 'bottom',
LEFT = 'left'
}
/**
* MCP prompt display variant
*/
export enum McpPromptVariant {
MESSAGE = 'message',
ATTACHMENT = 'attachment'
}
/**
* URL prefixes for protocol detection
*/
export enum UrlProtocol {
DATA = 'data:',
HTTP = 'http:',
HTTPS = 'https:',
WEBSOCKET = 'ws:',
WEBSOCKET_SECURE = 'wss:'
}
export enum HtmlInputType {
FILE = 'file'
}