mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-05-17 04:09:19 +00:00
* 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>
270 lines
8.4 KiB
TypeScript
270 lines
8.4 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { ModelsService } from '$lib/services/models.service';
|
|
|
|
const { parseModelId } = ModelsService;
|
|
|
|
describe('parseModelId', () => {
|
|
it('handles unknown patterns correctly', () => {
|
|
expect(parseModelId('model-name-1')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'model-name-1',
|
|
orgName: null,
|
|
params: null,
|
|
quantization: null,
|
|
raw: 'model-name-1',
|
|
tags: []
|
|
});
|
|
|
|
expect(parseModelId('org/model-name-2')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'model-name-2',
|
|
orgName: 'org',
|
|
params: null,
|
|
quantization: null,
|
|
raw: 'org/model-name-2',
|
|
tags: []
|
|
});
|
|
});
|
|
|
|
it('extracts model parameters correctly', () => {
|
|
expect(parseModelId('model-100B-BF16')).toMatchObject({ params: '100B' });
|
|
expect(parseModelId('model-100B:Q4_K_M')).toMatchObject({ params: '100B' });
|
|
});
|
|
|
|
it('extracts model parameters correctly in lowercase', () => {
|
|
expect(parseModelId('model-100b-bf16')).toMatchObject({ params: '100B' });
|
|
expect(parseModelId('model-100b:q4_k_m')).toMatchObject({ params: '100B' });
|
|
});
|
|
|
|
it('extracts activated parameters correctly', () => {
|
|
expect(parseModelId('model-100B-A10B-BF16')).toMatchObject({ activatedParams: 'A10B' });
|
|
expect(parseModelId('model-100B-A10B:Q4_K_M')).toMatchObject({ activatedParams: 'A10B' });
|
|
});
|
|
|
|
it('extracts activated parameters correctly in lowercase', () => {
|
|
expect(parseModelId('model-100b-a10b-bf16')).toMatchObject({ activatedParams: 'A10B' });
|
|
expect(parseModelId('model-100b-a10b:q4_k_m')).toMatchObject({ activatedParams: 'A10B' });
|
|
});
|
|
|
|
it('extracts quantization correctly', () => {
|
|
// Dash-separated quantization
|
|
expect(parseModelId('model-100B-UD-IQ1_S')).toMatchObject({ quantization: 'UD-IQ1_S' });
|
|
expect(parseModelId('model-100B-IQ4_XS')).toMatchObject({ quantization: 'IQ4_XS' });
|
|
expect(parseModelId('model-100B-Q4_K_M')).toMatchObject({ quantization: 'Q4_K_M' });
|
|
expect(parseModelId('model-100B-Q8_0')).toMatchObject({ quantization: 'Q8_0' });
|
|
expect(parseModelId('model-100B-UD-Q8_K_XL')).toMatchObject({ quantization: 'UD-Q8_K_XL' });
|
|
expect(parseModelId('model-100B-F16')).toMatchObject({ quantization: 'F16' });
|
|
expect(parseModelId('model-100B-BF16')).toMatchObject({ quantization: 'BF16' });
|
|
expect(parseModelId('model-100B-MXFP4')).toMatchObject({ quantization: 'MXFP4' });
|
|
|
|
// Colon-separated quantization
|
|
expect(parseModelId('model-100B:UD-IQ1_S')).toMatchObject({ quantization: 'UD-IQ1_S' });
|
|
expect(parseModelId('model-100B:IQ4_XS')).toMatchObject({ quantization: 'IQ4_XS' });
|
|
expect(parseModelId('model-100B:Q4_K_M')).toMatchObject({ quantization: 'Q4_K_M' });
|
|
expect(parseModelId('model-100B:Q8_0')).toMatchObject({ quantization: 'Q8_0' });
|
|
expect(parseModelId('model-100B:UD-Q8_K_XL')).toMatchObject({ quantization: 'UD-Q8_K_XL' });
|
|
expect(parseModelId('model-100B:F16')).toMatchObject({ quantization: 'F16' });
|
|
expect(parseModelId('model-100B:BF16')).toMatchObject({ quantization: 'BF16' });
|
|
expect(parseModelId('model-100B:MXFP4')).toMatchObject({ quantization: 'MXFP4' });
|
|
|
|
// Dot-separated quantization
|
|
expect(parseModelId('nomic-embed-text-v2-moe.Q4_K_M')).toMatchObject({
|
|
quantization: 'Q4_K_M'
|
|
});
|
|
});
|
|
|
|
it('extracts additional tags correctly', () => {
|
|
expect(parseModelId('model-100B-foobar-Q4_K_M')).toMatchObject({ tags: ['foobar'] });
|
|
expect(parseModelId('model-100B-A10B-foobar-1M-BF16')).toMatchObject({
|
|
tags: ['foobar', '1M']
|
|
});
|
|
expect(parseModelId('model-100B-1M-foobar:UD-Q8_K_XL')).toMatchObject({
|
|
tags: ['1M', 'foobar']
|
|
});
|
|
});
|
|
|
|
it('filters out container format segments from tags', () => {
|
|
expect(parseModelId('model-100B-GGUF-Instruct-BF16')).toMatchObject({
|
|
tags: ['Instruct']
|
|
});
|
|
expect(parseModelId('model-100B-GGML-Instruct:Q4_K_M')).toMatchObject({
|
|
tags: ['Instruct']
|
|
});
|
|
});
|
|
|
|
it('handles real-world examples correctly', () => {
|
|
expect(parseModelId('meta-llama/Llama-3.1-8B')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'Llama-3.1',
|
|
orgName: 'meta-llama',
|
|
params: '8B',
|
|
quantization: null,
|
|
raw: 'meta-llama/Llama-3.1-8B',
|
|
tags: []
|
|
});
|
|
|
|
expect(parseModelId('openai/gpt-oss-120b-MXFP4')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'gpt-oss',
|
|
orgName: 'openai',
|
|
params: '120B',
|
|
quantization: 'MXFP4',
|
|
raw: 'openai/gpt-oss-120b-MXFP4',
|
|
tags: []
|
|
});
|
|
|
|
expect(parseModelId('openai/gpt-oss-20b:Q4_K_M')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'gpt-oss',
|
|
orgName: 'openai',
|
|
params: '20B',
|
|
quantization: 'Q4_K_M',
|
|
raw: 'openai/gpt-oss-20b:Q4_K_M',
|
|
tags: []
|
|
});
|
|
|
|
expect(parseModelId('Qwen/Qwen3-Coder-30B-A3B-Instruct-1M-BF16')).toStrictEqual({
|
|
activatedParams: 'A3B',
|
|
modelName: 'Qwen3-Coder',
|
|
orgName: 'Qwen',
|
|
params: '30B',
|
|
quantization: 'BF16',
|
|
raw: 'Qwen/Qwen3-Coder-30B-A3B-Instruct-1M-BF16',
|
|
tags: ['Instruct', '1M']
|
|
});
|
|
});
|
|
|
|
it('handles real-world examples with quantization in segments', () => {
|
|
expect(parseModelId('meta-llama/Llama-4-Scout-17B-16E-Instruct-Q4_K_M')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'Llama-4-Scout',
|
|
orgName: 'meta-llama',
|
|
params: '17B',
|
|
quantization: 'Q4_K_M',
|
|
raw: 'meta-llama/Llama-4-Scout-17B-16E-Instruct-Q4_K_M',
|
|
tags: ['16E', 'Instruct']
|
|
});
|
|
|
|
expect(parseModelId('MiniMaxAI/MiniMax-M2-IQ4_XS')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'MiniMax-M2',
|
|
orgName: 'MiniMaxAI',
|
|
params: null,
|
|
quantization: 'IQ4_XS',
|
|
raw: 'MiniMaxAI/MiniMax-M2-IQ4_XS',
|
|
tags: []
|
|
});
|
|
|
|
expect(parseModelId('MiniMaxAI/MiniMax-M2-UD-Q3_K_XL')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'MiniMax-M2',
|
|
orgName: 'MiniMaxAI',
|
|
params: null,
|
|
quantization: 'UD-Q3_K_XL',
|
|
raw: 'MiniMaxAI/MiniMax-M2-UD-Q3_K_XL',
|
|
tags: []
|
|
});
|
|
|
|
expect(parseModelId('mistralai/Devstral-2-123B-Instruct-2512-Q4_K_M')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'Devstral-2',
|
|
orgName: 'mistralai',
|
|
params: '123B',
|
|
quantization: 'Q4_K_M',
|
|
raw: 'mistralai/Devstral-2-123B-Instruct-2512-Q4_K_M',
|
|
tags: ['Instruct', '2512']
|
|
});
|
|
|
|
expect(parseModelId('mistralai/Devstral-Small-2-24B-Instruct-2512-Q8_0')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'Devstral-Small-2',
|
|
orgName: 'mistralai',
|
|
params: '24B',
|
|
quantization: 'Q8_0',
|
|
raw: 'mistralai/Devstral-Small-2-24B-Instruct-2512-Q8_0',
|
|
tags: ['Instruct', '2512']
|
|
});
|
|
|
|
expect(parseModelId('noctrex/GLM-4.7-Flash-MXFP4_MOE')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'GLM-4.7-Flash',
|
|
orgName: 'noctrex',
|
|
params: null,
|
|
quantization: 'MXFP4_MOE',
|
|
raw: 'noctrex/GLM-4.7-Flash-MXFP4_MOE',
|
|
tags: []
|
|
});
|
|
|
|
expect(parseModelId('Qwen/Qwen3-Coder-Next-Q4_K_M')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'Qwen3-Coder-Next',
|
|
orgName: 'Qwen',
|
|
params: null,
|
|
quantization: 'Q4_K_M',
|
|
raw: 'Qwen/Qwen3-Coder-Next-Q4_K_M',
|
|
tags: []
|
|
});
|
|
|
|
expect(parseModelId('openai/gpt-oss-120b-Q4_K_M')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'gpt-oss',
|
|
orgName: 'openai',
|
|
params: '120B',
|
|
quantization: 'Q4_K_M',
|
|
raw: 'openai/gpt-oss-120b-Q4_K_M',
|
|
tags: []
|
|
});
|
|
|
|
expect(parseModelId('openai/gpt-oss-20b-F16')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'gpt-oss',
|
|
orgName: 'openai',
|
|
params: '20B',
|
|
quantization: 'F16',
|
|
raw: 'openai/gpt-oss-20b-F16',
|
|
tags: []
|
|
});
|
|
|
|
expect(parseModelId('nomic-embed-text-v2-moe.Q4_K_M')).toStrictEqual({
|
|
activatedParams: null,
|
|
modelName: 'nomic-embed-text-v2-moe',
|
|
orgName: null,
|
|
params: null,
|
|
quantization: 'Q4_K_M',
|
|
raw: 'nomic-embed-text-v2-moe.Q4_K_M',
|
|
tags: []
|
|
});
|
|
});
|
|
|
|
it('handles ambiguous model names', () => {
|
|
// Qwen3.5 Instruct vs Thinking — tags should distinguish them
|
|
expect(parseModelId('Qwen/Qwen3.5-30B-A3B-Instruct')).toMatchObject({
|
|
modelName: 'Qwen3.5',
|
|
params: '30B',
|
|
activatedParams: 'A3B',
|
|
tags: ['Instruct']
|
|
});
|
|
|
|
expect(parseModelId('Qwen/Qwen3.5-30B-A3B-Thinking')).toMatchObject({
|
|
modelName: 'Qwen3.5',
|
|
params: '30B',
|
|
activatedParams: 'A3B',
|
|
tags: ['Thinking']
|
|
});
|
|
|
|
// Dot-separated quantization with variant suffixes
|
|
expect(parseModelId('gemma-3-27b-it-heretic-v2.Q8_0')).toMatchObject({
|
|
modelName: 'gemma-3',
|
|
params: '27B',
|
|
quantization: 'Q8_0',
|
|
tags: ['it', 'heretic', 'v2']
|
|
});
|
|
|
|
expect(parseModelId('gemma-3-27b-it.Q8_0')).toMatchObject({
|
|
modelName: 'gemma-3',
|
|
params: '27B',
|
|
quantization: 'Q8_0',
|
|
tags: ['it']
|
|
});
|
|
});
|
|
});
|