From b7a332dc53015a9897b3281054559576c463c8b3 Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Mon, 16 Nov 2026 09:17:27 +0100 Subject: [PATCH 01/97] ui: let the dev proxy pass llama-server's cross-origin check llama-server refuses browser requests whose Origin does not match its own host unless --cors-origins allows it, and the Vite proxy forwarded the page's Origin (localhost:5173, or a LAN or Tailscale address). Loading a model, saving tools and /v1 calls failed with 403 under `vite dev`. The proxy now calls the server with its own Host and no Origin, WebSocket upgrades included. Sec-Fetch-Site still passes through, so requests from other sites stay refused. Assisted-by: Claude (Opus 5.5 Medium) --- ui/apps/chat/vite.config.ts | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/ui/apps/chat/vite.config.ts b/ui/apps/chat/vite.config.ts index e88c853dacff..6414b9e8696a 100644 --- a/ui/apps/chat/vite.config.ts +++ b/ui/apps/chat/vite.config.ts @@ -13,7 +13,7 @@ import { playwright } from '@vitest/browser-playwright'; import { mdsvex } from 'mdsvex'; import { dirname, resolve } from 'path'; import { fileURLToPath } from 'url'; -import { defineConfig, loadEnv, searchForWorkspaceRoot } from 'vite'; +import { defineConfig, loadEnv, type ProxyOptions, searchForWorkspaceRoot } from 'vite'; const __dirname = dirname(fileURLToPath(import.meta.url)); // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -35,6 +35,18 @@ const outDir = process.env.LLAMA_UI_OUT_DIR ?? './dist'; export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd(), 'VITE_PUBLIC_'); const SERVER_ORIGIN = env.VITE_PUBLIC_SERVER_ORIGIN || 'http://localhost:9931'; + // llama-server takes cross-origin browser requests only from --cors-origins, so the proxy + // calls it as its own page: the Host of the server and no Origin. Sec-Fetch-Site still + // passes through, so the server keeps refusing requests from other sites. + const toServer = (ws = false): ProxyOptions => ({ + changeOrigin: true, + configure: (proxy) => { + proxy.on('proxyReq', (req) => req.removeHeader('origin')); + proxy.on('proxyReqWs', (req) => req.removeHeader('origin')); + }, + target: SERVER_ORIGIN, + ws + }); return { build: { @@ -90,12 +102,12 @@ export default defineConfig(({ mode }) => { 'Cross-Origin-Opener-Policy': 'same-origin' }, proxy: { - '/cors-proxy': SERVER_ORIGIN, - '/models': SERVER_ORIGIN, - '/props': SERVER_ORIGIN, - '/slots': SERVER_ORIGIN, - '/tools': SERVER_ORIGIN, - '/v1': SERVER_ORIGIN + '/cors-proxy': toServer(), + '/models': toServer(), + '/props': toServer(), + '/slots': toServer(), + '/tools': toServer(), + '/v1': toServer() } }, From f2d83e2f973db19ec6c574bf3651b90b749c3139 Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Mon, 16 Nov 2026 19:30:42 +0100 Subject: [PATCH 02/97] ui: navigate through resolve() with typed route ids ROUTES holds the app's route ids, as page.route.id reports them, in place of hash strings and the separate *_ROUTE_ID constants. Every link and goto() goes through resolve() from $app/paths, which checks the route exists and returns its URL (#/models with the hash router). RouterService resolves the routes that take params: a chat, a project, a project's chat or new chat, and an extension's page. Tab links, sidebar items and extension navigation items carry the resolved URL's type, and checks for the current page compare page.route.id instead of the hash. svelte/no-navigation-without-resolve is on again, with type information for the app's modules so a URL typed as ResolvedPathname passes. Links that leave the app say so with rel="external"; the deep-link cleanups, which change the current page's own query, are marked as such. Assisted-by: Claude (Opus 5.5 Medium) --- ui/apps/chat/eslint.config.js | 7 +++- .../ChatMessage/ChatMessage.svelte | 7 ++-- ...atMessageToolCallBlockSearchResults.svelte | 4 +-- .../app/chat/ChatTabs/ChatTabsItem.svelte | 3 +- .../dialogs/DialogModelNotAvailable.svelte | 1 + .../app/mcp/McpServerIdentity.svelte | 2 +- .../ModelsDiscoverDetailsHeader.svelte | 4 +-- .../SidebarNavigation.svelte | 13 +++++--- .../SidebarNavigationActions.svelte | 6 +--- .../app/servers/ServerErrorSplash.svelte | 3 +- .../app/settings/SettingsMcpServers.svelte | 1 + .../src/lib/constants/routes.constants.ts | 32 +++++++++---------- .../chat/src/lib/constants/ui.constants.ts | 8 ++--- ui/apps/chat/src/lib/services/index.ts | 2 +- .../chat/src/lib/services/router.service.ts | 11 ++++--- .../lib/stores/conversations/index.svelte.ts | 6 ++-- ui/apps/chat/src/lib/stores/tabs.svelte.ts | 9 +++--- ui/apps/chat/src/lib/stores/ui.svelte.ts | 13 ++++---- ui/apps/chat/src/lib/types/navigation.d.ts | 4 ++- ui/apps/chat/src/lib/utils/chat-tabs.ts | 10 +++--- ui/apps/chat/src/routes/(chat)/+page.svelte | 1 + .../src/routes/(chat)/chat/[id]/+page.svelte | 4 ++- ui/apps/chat/src/routes/+error.svelte | 5 +-- ui/apps/chat/src/routes/+layout.svelte | 9 +++--- ui/apps/chat/src/routes/search/+page.svelte | 3 +- .../client/nested-surfaces.svelte.test.ts | 1 - .../chat/tabs/ChatTabsItem.stories.svelte | 13 ++++++-- 27 files changed, 104 insertions(+), 78 deletions(-) diff --git a/ui/apps/chat/eslint.config.js b/ui/apps/chat/eslint.config.js index 330551d9d8d1..edbc71c487a3 100644 --- a/ui/apps/chat/eslint.config.js +++ b/ui/apps/chat/eslint.config.js @@ -266,7 +266,6 @@ export default ts.config( 'simple-import-sort/imports': ['error', { groups: [['.*']] }], 'svelte/no-at-html-tags': 'off', // This app uses hash-based routing (#/) where resolve() from $app/paths does not apply - 'svelte/no-navigation-without-resolve': 'off', // Sort HTML attributes alphabetically in the markup. The Svelte directives // (bind:/use:/animate:/style:/in:/out:/transition:/class:) sort first, @@ -321,6 +320,12 @@ export default ts.config( } } }, + { + // type information for the app's own modules too, so svelte/no-navigation-without-resolve + // accepts a URL typed as ResolvedPathname, such as RouterService.chat(id) + files: ['src/**/*.ts'], + languageOptions: { parserOptions: { projectService: true } } + }, { // Exclude generated build output and Storybook files from ESLint ignores: [ diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessage.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessage.svelte index 0086107eed80..f4172daaf969 100644 --- a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessage.svelte +++ b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessage.svelte @@ -30,6 +30,7 @@ import { parseFilesToMessageExtras } from '#lib/utils/browser-only.ts'; import { deriveAgenticSections } from '#lib/utils/index.ts'; import { goto } from '$app/navigation'; + import { resolve } from '$app/paths'; interface Props { class?: string; @@ -241,7 +242,7 @@ const conversationDeleted = await chatStore.removeSystemPromptPlaceholder(message.id); if (conversationDeleted) { - goto(ROUTES.START); + goto(resolve(ROUTES.START)); } return; @@ -282,7 +283,7 @@ const conversationDeleted = await chatStore.removeSystemPromptPlaceholder(message.id); if (conversationDeleted) { - goto(ROUTES.START); + goto(resolve(ROUTES.START)); } } else { chatActions.delete(message); @@ -362,7 +363,7 @@ isEditing = false; if (conversationDeleted) { - goto(ROUTES.START); + goto(resolve(ROUTES.START)); } else { focusMainChatForm(); } diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockSearchResults.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockSearchResults.svelte index 2ed631a4f4ae..48f3e7dec3d2 100644 --- a/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockSearchResults.svelte +++ b/ui/apps/chat/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockSearchResults.svelte @@ -91,7 +91,7 @@ {#if faviconUrl} @@ -116,7 +116,7 @@ {result.title} diff --git a/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabsItem.svelte b/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabsItem.svelte index c01af20d6f4b..d5c5509568c2 100644 --- a/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabsItem.svelte +++ b/ui/apps/chat/src/lib/components/app/chat/ChatTabs/ChatTabsItem.svelte @@ -10,10 +10,11 @@ TAB_SURFACE_IDLE_CLASS, UI_DATA_ATTRS } from '#lib/constants/index.ts'; + import type { ResolvedPathname } from '$app/types'; import type { Component } from 'svelte'; interface Tab { - href: string; + href: ResolvedPathname; /** Marks the new-chat tab. */ icon?: Component; id: string; diff --git a/ui/apps/chat/src/lib/components/app/dialogs/DialogModelNotAvailable.svelte b/ui/apps/chat/src/lib/components/app/dialogs/DialogModelNotAvailable.svelte index 6d5115a6c067..541db9bec157 100644 --- a/ui/apps/chat/src/lib/components/app/dialogs/DialogModelNotAvailable.svelte +++ b/ui/apps/chat/src/lib/components/app/dialogs/DialogModelNotAvailable.svelte @@ -26,6 +26,7 @@ url.searchParams.set(URL_PARAMS.MODEL, model); handleOpenChange(false); + // eslint-disable-next-line svelte/no-navigation-without-resolve -- the current page's own URL with its query changed, not a link to resolve goto(url.toString()); } diff --git a/ui/apps/chat/src/lib/components/app/mcp/McpServerIdentity.svelte b/ui/apps/chat/src/lib/components/app/mcp/McpServerIdentity.svelte index d55235b55afd..7a0630761683 100644 --- a/ui/apps/chat/src/lib/components/app/mcp/McpServerIdentity.svelte +++ b/ui/apps/chat/src/lib/components/app/mcp/McpServerIdentity.svelte @@ -54,7 +54,7 @@ class="shrink-0 text-muted-foreground hover:text-foreground" href={safeWebsiteUrl} onclick={(e) => e.stopPropagation()} - rel="noopener noreferrer" + rel="external noopener noreferrer" target="_blank" > diff --git a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/ModelsDiscoverDetailsHeader.svelte b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/ModelsDiscoverDetailsHeader.svelte index 136acf32e204..ca6b922920fe 100644 --- a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/ModelsDiscoverDetailsHeader.svelte +++ b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/ModelsDiscoverDetailsHeader.svelte @@ -73,7 +73,7 @@ aria-label="View base model on HuggingFace" class="shrink-0 text-muted-foreground transition-colors hover:text-foreground" href={HuggingFaceService.getModelUrl(baseModels[0])} - rel="noopener noreferrer" + rel="external noopener noreferrer" target="_blank" > @@ -86,7 +86,7 @@ + {/snippet} + + + + + Providers + + {#each backends as backend (backend.id)} + toggleProvider(backend.id, checked)} + > + {@render providerMark(backend)} + + {backend.name} + + {providerCounts[backend.id] ?? 0} + + {/each} + + + {#if providers.length > 0} + + + (providers = [])} + >Show every provider + {/if} + + + {/if} + (contextLimit = Number(value))} type="single" diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelProviders.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelProviders.svelte index a3ee433396b4..9a1d548d63c3 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelProviders.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelProviders.svelte @@ -2,8 +2,9 @@ import { Button } from '@ggml-org/llama-ui/ui/button'; import { Plus } from '@lucide/svelte'; import { BackendCard, DialogBackendForm } from '#lib/components/app/backends/index.ts'; + import { BackendProtocol } from '#lib/constants/index.ts'; import { backendsModelsStore, backendsStore, serverStore } from '#lib/stores/index.ts'; - import type { Backend, BackendProtocol } from '#lib/types/index.ts'; + import type { Backend } from '#lib/types/index.ts'; import { fade } from 'svelte/transition'; interface Props { @@ -20,18 +21,18 @@ : backendsStore.external ); // the bundled server belongs to the list whenever llama.cpp providers are in it - let showsLocal = $derived(protocol === undefined || protocol === 'llama.cpp'); + let showsLocal = $derived(protocol === undefined || protocol === BackendProtocol.COMPAT); let addTitle = $derived( - protocol === 'openai' + protocol === BackendProtocol.OPENAI ? 'Add a backend' - : protocol === 'llama.cpp' + : protocol === BackendProtocol.COMPAT ? 'Add a Llama-compatible backend' : 'Add new provider' ); let addDescription = $derived( - protocol === 'openai' + protocol === BackendProtocol.OPENAI ? 'Connect an OpenAI-compatible endpoint.' - : protocol === 'llama.cpp' + : protocol === BackendProtocol.COMPAT ? 'Point at another llama-server.' : 'External llama-server or connect an OpenAI-compatible API.' ); @@ -66,7 +67,7 @@ void backendsModelsStore.loadAll()} /> diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelRow.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelRow.svelte index 1f25c3a5553c..a1f184f17124 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelRow.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelRow.svelte @@ -6,7 +6,12 @@ import ModelId from '../ModelId.svelte'; import ModelsManagerStatusCell from './ModelsManagerStatusCell.svelte'; import { modelRowActions } from './row-actions'; - import { configuredContext, downloadProgressFor, isRowControlClick } from './utils'; + import { + canLoadOption, + configuredContext, + downloadProgressFor, + isRowControlClick + } from './utils'; import { ModelDownloadProgressBar } from '@ggml-org/llama-ui/models'; import { Heart, MoreHorizontal } from '@lucide/svelte'; import { ContextMenuActions, DropdownMenuActions } from '#lib/components/app/index.ts'; @@ -55,7 +60,13 @@ } // the "more actions" dropdown and the right-click menu offer the same actions - let actions = $derived(modelRowActions(option, favorite, isHidden, onDelete, download)); + let actions = $derived( + modelRowActions( + option, + { canLoad: canLoadOption(option), download, favorite, isHidden }, + { onDelete } + ) + ); let contextMenuOpen = $state(false); diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelsTable.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelsTable.svelte index 1f9bd6046b77..0f5f3ffd7761 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelsTable.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelsTable.svelte @@ -45,9 +45,10 @@ ModelCapability, ModelDownloadConfirmAction, ModelsTableGroupKind, + ModelsTableProviderKind, ModelsTableSortKey } from '#lib/enums/index.ts'; - import { modelsStore, settingsStore } from '#lib/stores/index.ts'; + import { backendsModelsStore, modelsStore, settingsStore } from '#lib/stores/index.ts'; import type { ModelOption } from '#lib/types/models.js'; import { groupModelFamilies, type ModelFamilyGroup } from '#lib/utils/model-families.ts'; import type { Snippet } from 'svelte'; @@ -64,6 +65,10 @@ onSelect: (option: ModelOption) => void; /** Modalities a model must support at least one of. */ modalities?: ModalityKey[]; + /** Backend ids to keep; empty keeps every provider. */ + providers?: string[]; + /** Repos each provider contributes to the current search, for the filter menu. */ + providerCounts?: Record; selectedId: string | null; /** Rendered at the toolbar's right end, past the filters. */ toolbarEnd?: Snippet; @@ -77,12 +82,16 @@ isFavorite, modalities = $bindable([]), onSelect, + providerCounts = {}, + providers = $bindable([]), selectedId, toolbarEnd }: Props = $props(); let isEmpty = $derived(groups.every((group) => group.items.length === 0)); - let hasFilters = $derived(hasActiveFilters(contextLimit, modalities, capabilities)); + let hasFilters = $derived( + hasActiveFilters(contextLimit, modalities, capabilities) || providers.length > 0 + ); /** Noun the show-more row counts in, per unit of the grouped list. */ const SHOW_MORE_NOUNS: Record = { @@ -244,6 +253,7 @@ {onSelect} option={quant} selected={selectedId === quant.id} + showProvider={entry.kind === 'providers'} /> {/each} @@ -348,6 +358,8 @@ bind:contextLimit bind:filter bind:modalities + bind:providers + {providerCounts} {toolbarEnd} /> @@ -382,12 +394,19 @@ {/if} {/snippet} + {@const backendState = group.backendId ? backendsModelsStore.get(group.backendId) : null} + void; onSelect: (option: ModelOption) => void; selected: boolean; + /** Badge the backend name instead of the quant, for a provider group. */ + showProvider?: boolean; /** Left padding in px, from the nesting depth. */ indent?: number; } - let { indent = 0, isFavorite, onDelete, onSelect, option, selected }: Props = $props(); + let { + indent = 0, + isFavorite, + onDelete, + onSelect, + option, + selected, + showProvider = false + }: Props = $props(); let favorite = $derived(isFavorite(option)); let isHidden = $derived(modelsStore.isHidden(option.id)); let quant = $derived(option.parsedId?.quantization ?? option.model); // the "more actions" dropdown and the right-click menu offer the same actions - let actions = $derived(modelRowActions(option, favorite, isHidden, onDelete)); + let actions = $derived( + modelRowActions(option, { canLoad: canLoadOption(option), favorite, isHidden }, { onDelete }) + ); let contextMenuOpen = $state(false); @@ -59,7 +72,9 @@ style="padding-left: {indent}px" type="button" > - {quant} + + {showProvider ? (getBackend(option.backendId)?.name ?? quant) : quant} + !isAuxSidecar(badge.kind))} diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerRepoRow.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerRepoRow.svelte index eee8d9ebba44..231a4c00a020 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerRepoRow.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerRepoRow.svelte @@ -20,10 +20,13 @@ let { entry, expanded, indent = 0, onToggle }: Props = $props(); + let providerCount = $derived(new Set(entry.quants.map((option) => option.backendId ?? '')).size); let groupLabel = $derived( - entry.kind === ModelGroupKind.VARIANTS - ? `${entry.quants.length} variants` - : `${entry.quants.length} quants available` + entry.kind === ModelGroupKind.PROVIDERS + ? `${providerCount} provider${providerCount === 1 ? '' : 's'}` + : entry.kind === ModelGroupKind.VARIANTS + ? `${entry.quants.length} variants` + : `${entry.quants.length} quants available` ); let anyLoaded = $derived(entry.quants.some((quant) => modelsStore.isModelRunning(quant.model))); // a repo row stands for its quants, so it reports what they agree on diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerStatusCell.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerStatusCell.svelte index 7e0eaf5eb746..0ec3a877f229 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerStatusCell.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerStatusCell.svelte @@ -1,6 +1,7 @@ {#if download} -{:else if isRouter} +{:else if canToggleLoad} +{:else if option.backendId && option.backendId !== LOCAL_BACKEND_ID} + {:else} diff --git a/ui/apps/chat/src/lib/stores/models/index.svelte.ts b/ui/apps/chat/src/lib/stores/models/index.svelte.ts index 4be6161d0329..5aba5bcb6625 100644 --- a/ui/apps/chat/src/lib/stores/models/index.svelte.ts +++ b/ui/apps/chat/src/lib/stores/models/index.svelte.ts @@ -11,7 +11,6 @@ import { BackendProtocol, FAVORITE_MODELS_LOCALSTORAGE_KEY, HIDDEN_MODELS_LOCALSTORAGE_KEY, - LOCAL_BACKEND_ID, MODEL_GROUP_OPEN_LOCALSTORAGE_KEY, MODEL_REMOVE_BLOCKED_FALLBACK, MODEL_REMOVE_BLOCKED_REASONS, @@ -478,17 +477,21 @@ class ModelsStore implements ModelPropsHost, ModelStatusHost { * feed, so an external backend answers from its own model listing. */ getModelStatus(modelId: string): ServerModelStatus | null { - const backendId = this.models.find((model) => model.model === modelId)?.backendId; + // the local feed reports the models its router serves: a same-named entry + // on a remote provider must not shadow it + const model = this.routerModels.find((m) => m.id === modelId); - if (backendId && backendId !== LOCAL_BACKEND_ID) { - const option = backendsModelsStore.get(backendId).models.find((m) => m.model === modelId); + if (model) return (model.status?.value as ServerModelStatus) ?? null; - return (option?.status?.value as ServerModelStatus) ?? null; - } + // a model the local router does not serve belongs to a backend, and the + // first enabled backend listing it owns the state + for (const backend of backendsStore.enabled) { + const option = backendsModelsStore.get(backend.id).models.find((m) => m.model === modelId); - const model = this.routerModels.find((m) => m.id === modelId); + if (option) return (option.status?.value as ServerModelStatus) ?? null; + } - return (model?.status?.value as ServerModelStatus) ?? null; + return null; } /** diff --git a/ui/apps/chat/src/lib/stores/models/status.svelte.ts b/ui/apps/chat/src/lib/stores/models/status.svelte.ts index b3cb32b38812..3cfe344426ce 100644 --- a/ui/apps/chat/src/lib/stores/models/status.svelte.ts +++ b/ui/apps/chat/src/lib/stores/models/status.svelte.ts @@ -280,7 +280,9 @@ export class ModelStatusManager { async cancelLoad(modelId: string): Promise { const backendId = this.backendIdFor(modelId); - if (!serverStore.isRouterMode) return; + // the local server takes unload requests in router mode only; a remote + // backend cancels on its own + if (backendId === LOCAL_BACKEND_ID && !serverStore.localIsRouter) return; this.subscribe(); @@ -605,7 +607,9 @@ export class ModelStatusManager { subscribe(): void { if (this.statusReaderActive) return; - if (!serverStore.isRouterMode) return; + // the feed reports the local server's models, so the local server's role + // decides, not the active backend's + if (!serverStore.localIsRouter) return; this.statusReaderActive = true; this.statusAbort = new AbortController(); From de86385fc73b497bdbdacaf6473c98fa90febc84 Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Mon, 19 Oct 2026 12:48:28 +0200 Subject: [PATCH 37/97] ui : keep llama.cpp servers as the only providers Drop the OpenAI-compatible backend dialect from the providers work: every backend now speaks the llama.cpp API, so there is nothing to negotiate. Goes with it: the protocol enum and its capability and wire-quirk tables, the adapter registry (it had a single implementation, and both protocols resolved to it), the chat and models path overrides, the endpoint probe that classified a URL as llama or OpenAI, and the hosted-provider presets with their recommendation block. ChatService now builds llama.cpp requests directly and decodes its stream through chat-wire, keeping the timings the server reports instead of the wall-clock fallback a foreign endpoint needs. The gates that read those capabilities collapse to their llama.cpp branch: load, unload, slots, props, the resumable-stream endpoints and pre-encode are simply available. A row of another server loads through that server, and the switch that keeps local server state now keys on the built-in backend rather than on a protocol. --- .../app/backends/BackendCard.svelte | 9 +- .../app/backends/BackendForm.svelte | 121 +---------- .../app/backends/BackendIcon.svelte | 12 +- .../app/backends/BackendPresetCard.svelte | 41 ---- .../app/backends/BackendPresetIcon.svelte | 34 ---- .../app/backends/DialogBackendForm.svelte | 152 +------------- .../src/lib/components/app/backends/index.ts | 2 - .../components/app/models/ModelAvatar.svelte | 14 +- .../app/models/ModelLoadControl.svelte | 38 +--- .../models/ModelsManager/ModelsManager.svelte | 27 +-- .../ModelsManagerModelConfiguration.svelte | 3 +- ...delsManagerModelConfigurationHeader.svelte | 2 - ...anagerModelConfigurationInformation.svelte | 31 ++- .../ModelsManagerModelProviders.svelte | 34 +--- .../ModelsManagerModelRow.svelte | 15 +- .../ModelsManagerModelsTable.svelte | 3 - .../ModelsManagerQuantRow.svelte | 6 +- .../ModelsManagerStatusCell.svelte | 20 +- .../app/models/ModelsManager/row-actions.ts | 26 +-- .../app/models/ModelsManager/utils.ts | 6 - .../ModelsSelector/ModelsSelector.svelte | 1 - .../ModelsSelectorDropdown.svelte | 1 - .../ModelsSelector/ModelsSelectorList.svelte | 23 +-- .../ModelsSelectorOption.svelte | 15 +- .../src/lib/constants/backend.constants.ts | 109 +--------- .../lib/constants/models-manager.constants.ts | 3 +- ui/apps/chat/src/lib/enums/model.enums.ts | 3 +- .../lib/hooks/use-models-selector.svelte.ts | 76 +------ .../chat/src/lib/services/backends.service.ts | 58 ++---- ui/apps/chat/src/lib/services/chat-wire.ts | 119 +++++++++++ .../chat/src/lib/services/protocols/index.ts | 25 --- .../chat/src/lib/services/protocols/openai.ts | 188 ------------------ .../chat/src/lib/services/protocols/types.ts | 43 ---- .../chat/src/lib/stores/chat/index.svelte.ts | 15 +- .../src/lib/stores/llama-server.svelte.ts | 20 +- .../src/lib/stores/models/index.svelte.ts | 22 +- .../src/lib/stores/models/props.svelte.ts | 3 - ui/apps/chat/src/lib/types/backend.d.ts | 100 ++-------- ui/apps/chat/src/lib/types/index.ts | 8 +- ui/apps/chat/src/lib/utils/api-headers.ts | 11 +- .../chat/src/lib/utils/api-key-validation.ts | 10 +- ui/apps/chat/src/lib/utils/backend.ts | 160 ++------------- ui/apps/chat/src/lib/utils/index.ts | 2 - 43 files changed, 259 insertions(+), 1352 deletions(-) delete mode 100644 ui/apps/chat/src/lib/components/app/backends/BackendPresetCard.svelte delete mode 100644 ui/apps/chat/src/lib/components/app/backends/BackendPresetIcon.svelte create mode 100644 ui/apps/chat/src/lib/services/chat-wire.ts delete mode 100644 ui/apps/chat/src/lib/services/protocols/index.ts delete mode 100644 ui/apps/chat/src/lib/services/protocols/openai.ts delete mode 100644 ui/apps/chat/src/lib/services/protocols/types.ts diff --git a/ui/apps/chat/src/lib/components/app/backends/BackendCard.svelte b/ui/apps/chat/src/lib/components/app/backends/BackendCard.svelte index a85a54ad2a09..b451283abb61 100644 --- a/ui/apps/chat/src/lib/components/app/backends/BackendCard.svelte +++ b/ui/apps/chat/src/lib/components/app/backends/BackendCard.svelte @@ -7,15 +7,9 @@ import * as Tooltip from '@ggml-org/llama-ui/ui/tooltip'; import { Pencil, RotateCw, Server, Trash2 } from '@lucide/svelte'; import { DialogConfirmation } from '#lib/components/app/dialogs/index.ts'; - import { BackendProtocol } from '#lib/constants/index.ts'; import { backendsModelsStore } from '#lib/stores/backendsModels.svelte.ts'; import type { Backend } from '#lib/types/index.ts'; - const PROTOCOL_LABELS: Record = { - [BackendProtocol.COMPAT]: 'Llama-compatible', - [BackendProtocol.OPENAI]: 'OpenAI-compatible' - }; - const CARD_ICON_CLASS = 'h-5 w-5'; interface Props { @@ -29,7 +23,6 @@ let { backend, isLocal = false, onDelete, onEdit, onToggle }: Props = $props(); let showDelete = $state(false); - let protocolLabel = $derived(PROTOCOL_LABELS[backend.protocol]); let displayUrl = $derived(backend.baseUrl || 'This server'); // the model listing doubles as the reachability probe @@ -39,7 +32,7 @@ let isOffline = $derived(backend.enabled && !!modelsState.error); let hasStatus = $derived(isChecking || isOnline || isOffline); let modelCount = $derived(modelsState.models.length); - let metaText = $derived(isLocal ? `Built-in · ${protocolLabel}` : protocolLabel); + let metaText = $derived(isLocal ? 'Built-in' : 'llama.cpp server'); // kick off the probe for backends the prefetch has not covered yet $effect(() => { diff --git a/ui/apps/chat/src/lib/components/app/backends/BackendForm.svelte b/ui/apps/chat/src/lib/components/app/backends/BackendForm.svelte index dbf7ec9ed339..9a4dd9254920 100644 --- a/ui/apps/chat/src/lib/components/app/backends/BackendForm.svelte +++ b/ui/apps/chat/src/lib/components/app/backends/BackendForm.svelte @@ -1,60 +1,17 @@
@@ -74,8 +31,6 @@ {#if urlError}

{urlError}

- {:else if detectionLabel} -

{detectionLabel}

{/if}
@@ -117,78 +72,4 @@

- - - - {#if showAdvanced} - - {:else} - - {/if} - - Advanced - - - -
-
- API format - - - onChange({ compat: undefined, protocol: value as BackendProtocol })} - type="single" - value={backend.protocol} - > - {protocolLabel} - - - {#each PROTOCOL_OPTIONS as option (option.value)} - {option.label} - {/each} - - - -

- Detected from the endpoint. Override it when a server answers unusually. -

-
- -
-
- - - onChange({ chatPath: e.currentTarget.value || undefined })} - placeholder={DEFAULT_BACKEND_CHAT_PATH} - type="text" - value={backend.chatPath ?? ''} - /> -
- -
- - - onChange({ modelsPath: e.currentTarget.value || undefined })} - placeholder={DEFAULT_BACKEND_MODELS_PATH} - type="text" - value={backend.modelsPath ?? ''} - /> -
-
-
-
-
diff --git a/ui/apps/chat/src/lib/components/app/backends/BackendIcon.svelte b/ui/apps/chat/src/lib/components/app/backends/BackendIcon.svelte index a22efe829268..858f5111ea70 100644 --- a/ui/apps/chat/src/lib/components/app/backends/BackendIcon.svelte +++ b/ui/apps/chat/src/lib/components/app/backends/BackendIcon.svelte @@ -1,7 +1,6 @@ -{#if preset} - -{:else if faviconUrl && !failedFavicons.has(faviconUrl)} +{#if faviconUrl && !failedFavicons.has(faviconUrl)} - import BackendPresetIcon from './BackendPresetIcon.svelte'; - import { Badge } from '@ggml-org/llama-ui/ui/badge'; - import * as Card from '@ggml-org/llama-ui/ui/card'; - import { Check } from '@lucide/svelte'; - import type { BackendPreset } from '#lib/types/index.ts'; - - interface Props { - preset: BackendPreset; - onClick?: () => void; - selected?: boolean; - dimmed?: boolean; - /** A backend already points at this provider. */ - added?: boolean; - } - - let { added = false, dimmed = false, onClick, preset, selected = false }: Props = $props(); - - // an added provider is a label, not an action: no hover, no selection - let interactive = $derived(!added && Boolean(onClick)); - - - - {#if added} - - - Added - - {/if} - -
- - -

{preset.name}

-
- -

{preset.description}

-
diff --git a/ui/apps/chat/src/lib/components/app/backends/BackendPresetIcon.svelte b/ui/apps/chat/src/lib/components/app/backends/BackendPresetIcon.svelte deleted file mode 100644 index 2b5fc1850b3d..000000000000 --- a/ui/apps/chat/src/lib/components/app/backends/BackendPresetIcon.svelte +++ /dev/null @@ -1,34 +0,0 @@ - - -{#if iconUrl} - -{:else} - -{/if} diff --git a/ui/apps/chat/src/lib/components/app/backends/DialogBackendForm.svelte b/ui/apps/chat/src/lib/components/app/backends/DialogBackendForm.svelte index d2fca2eb6a6e..4cc52b967bc8 100644 --- a/ui/apps/chat/src/lib/components/app/backends/DialogBackendForm.svelte +++ b/ui/apps/chat/src/lib/components/app/backends/DialogBackendForm.svelte @@ -1,59 +1,28 @@
- {#if !canLoad} - {#if showBackendMark} - - {:else if showRemoteMark} - - - - {#if isBackendFailed} - - {/if} - - {/if} - {:else if isLoading} + {#if isLoading} {:else} diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManager.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManager.svelte index d5f3df9acf96..75e940dfbe36 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManager.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManager.svelte @@ -22,8 +22,6 @@ } from '#lib/enums/index.ts'; import { backendsStore, modelsStore, uiStore } from '#lib/stores/index.ts'; import type { ModelOption } from '#lib/types/models.js'; - import { getBackend } from '#lib/utils/api-base.ts'; - import { getBackendCapabilities } from '#lib/utils/backend.ts'; import { filterModelOptions } from '#lib/utils/index.ts'; import type { Snippet } from 'svelte'; import { SvelteMap } from 'svelte/reactivity'; @@ -125,35 +123,18 @@ let entries = $derived(byRecency(groupModelQuants(visible))); let groups = $derived.by(() => { // a loaded quant is a model of its own: its repo keeps the quants left behind. - // Only llama-compat servers report a load state. - const isLoaded = (option: ModelOption) => - getBackendCapabilities(getBackend(option.backendId)).loadUnload && - modelsStore.isModelLoaded(option.model); + const isLoaded = (option: ModelOption) => modelsStore.isModelLoaded(option.model); // a tracked download stands in its own section, so it is not listed twice const isDownload = (option: ModelOption) => modelsStore.status.isDownloadInProgress(option.model) || modelsStore.status.isDownloadPaused(option.model); - // a compat backend serves the selection itself: its selected model is a - // section of its own, since it never reports a load state - const isProviderSelected = (option: ModelOption) => - option.id === modelsStore.selectedModelId && - !getBackendCapabilities(getBackend(option.backendId)).loadUnload; - const selected: ModelQuantGroup[] = []; const loaded: ModelQuantGroup[] = []; const rest: ModelQuantGroup[] = []; for (const entry of entries) { - const remaining = entry.quants.filter( - (quant) => !isLoaded(quant) && !isDownload(quant) && !isProviderSelected(quant) - ); + const remaining = entry.quants.filter((quant) => !isLoaded(quant) && !isDownload(quant)); for (const quant of entry.quants) { - if (isProviderSelected(quant)) { - selected.push({ ...entry, base: quant, key: quant.id, quants: [quant] }); - - continue; - } - if (!isLoaded(quant)) continue; loaded.push({ ...entry, base: quant, key: quant.id, quants: [quant] }); @@ -197,8 +178,7 @@ } const ordered: ModelsTableGroup[] = []; - // the selected compat model leads the table, then the loaded models, then - // favorites, then one block per backend + // loaded models lead the table, then favorites, then one block per backend const pushSection = ( kind: ModelsTableGroup['kind'], items: ModelQuantGroup[], @@ -218,7 +198,6 @@ }); }; - pushSection(ModelsTableGroupKind.SELECTED, selected); pushSection(ModelsTableGroupKind.LOADED, loaded); pushSection(ModelsTableGroupKind.DOWNLOADING, downloads); pushSection(ModelsTableGroupKind.FAVORITES, favorites); diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfiguration.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfiguration.svelte index 7f07272ae2d4..4af8e0d2437a 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfiguration.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfiguration.svelte @@ -1,5 +1,5 @@ diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelsTable.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelsTable.svelte index 7168a5bce6a5..0f5f3ffd7761 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelsTable.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelsTable.svelte @@ -13,7 +13,6 @@ import { ArrowDown, ArrowUp, - CheckCircle2, ChevronDown, ChevronUp, Download, @@ -388,8 +387,6 @@ {:else if group.kind === ModelsTableGroupKind.LOADED} - {:else if group.kind === ModelsTableGroupKind.SELECTED} - {:else if group.kind === ModelsTableGroupKind.HIDDEN} {:else if group.kind === ModelsTableGroupKind.LOCAL} diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerQuantRow.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerQuantRow.svelte index e9c1219dc5e9..87bdc65ae0cc 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerQuantRow.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerQuantRow.svelte @@ -2,7 +2,7 @@ import ModelContext from '../ModelContext.svelte'; import ModelsManagerStatusCell from './ModelsManagerStatusCell.svelte'; import { modelRowActions } from './row-actions'; - import { canLoadOption, configuredContext, isRowControlClick } from './utils'; + import { configuredContext, isRowControlClick } from './utils'; import { ModelDraftSidecars } from '@ggml-org/llama-ui/models'; import { Badge } from '@ggml-org/llama-ui/ui/badge'; import { MoreHorizontal } from '@lucide/svelte'; @@ -40,9 +40,7 @@ let quant = $derived(option.parsedId?.quantization ?? option.model); // the "more actions" dropdown and the right-click menu offer the same actions - let actions = $derived( - modelRowActions(option, { canLoad: canLoadOption(option), favorite, isHidden }, { onDelete }) - ); + let actions = $derived(modelRowActions(option, { favorite, isHidden }, { onDelete })); let contextMenuOpen = $state(false); diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerStatusCell.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerStatusCell.svelte index 0a1402cfbb62..43b503a59a89 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerStatusCell.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerStatusCell.svelte @@ -1,7 +1,6 @@ @@ -35,7 +30,6 @@ {:else if canToggleLoad} -{:else if option.backendId && option.backendId !== LOCAL_BACKEND_ID} - {:else} :`; the entry exists only // while Discover is on const viewInDiscover = uiStore.isDiscoverEnabled @@ -76,19 +74,15 @@ export function modelRowActions( label: favorite ? 'Remove from favorites' : 'Add to favorites', onclick: () => modelsStore.toggleFavorite(option.model) }, - ...(canLoad - ? [ - { - disabled: removeBlockedReason !== null, - icon: Trash2, - label: 'Delete from disk', - onclick: () => handlers.onDelete(option), - separator: true, - tooltip: removeBlockedReason ?? undefined, - variant: 'destructive' as const - } - ] - : []), + { + disabled: removeBlockedReason !== null, + icon: Trash2, + label: 'Delete from disk', + onclick: () => handlers.onDelete(option), + separator: true, + tooltip: removeBlockedReason ?? undefined, + variant: 'destructive' as const + }, { icon: isHidden ? Eye : EyeOff, label: isHidden ? 'Unhide model' : 'Hide model', diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/utils.ts b/ui/apps/chat/src/lib/components/app/models/ModelsManager/utils.ts index 9504d18f7853..1a2b420dd2f4 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/utils.ts +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/utils.ts @@ -14,7 +14,6 @@ import type { ModelSidecarBadge } from '#lib/types/models.js'; import { getBackend } from '#lib/utils/api-base.ts'; -import { getBackendCapabilities } from '#lib/utils/backend.ts'; import { detectThinkingSupport, detectToolUseSupport, repoOf } from '#lib/utils/index.ts'; /** One repo of the table, with the rows it ships as. */ @@ -142,11 +141,6 @@ export function configuredContext(option: ModelOption): number | null { : null; } -/** True when the backend that serves the model can load and unload it. */ -export function canLoadOption(option: ModelOption): boolean { - return getBackendCapabilities(getBackend(option.backendId)).loadUnload; -} - export function servedByLabel(option: ModelOption): string { const backend = getBackend(option.backendId); diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelector.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelector.svelte index 86ac02de082e..2babeba83235 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelector.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelector.svelte @@ -341,7 +341,6 @@ onSelect={ms.handleSelect} renderOption={modelOption} sectionHeaderClass="[&:not(:first-child)]:mt-2 mb-1 px-2 py-2.5 text-sm font-semibold text-foreground/80 select-none" - selected={ms.selectedItems} {showOrgName} />
diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorDropdown.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorDropdown.svelte index f621c67bf82d..e3491165248d 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorDropdown.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorDropdown.svelte @@ -275,7 +275,6 @@ onSelect={ms.handleSelect} renderOption={modelOption} sectionHeaderClass="[&:not(:first-child)]:mt-1 mb-1 px-2 py-2 text-[13px] font-semibold text-foreground/80 select-none" - selected={ms.selectedItems} {showOrgName} /> diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorList.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorList.svelte index c1a6fdef48a8..268696a833da 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorList.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsSelector/ModelsSelectorList.svelte @@ -1,7 +1,7 @@
-
- - - onChange({ baseUrl: e.currentTarget.value })} - placeholder="https://api.example.com" - type="url" - value={backend.baseUrl} - /> - - {#if urlError} -

{urlError}

- {/if} +
+ {#each [BackendKind.URL, BackendKind.REMOTE] as kind (kind)} + + {/each}
+ {#if isRemote} +
+ + +
+ onChange({ code: e.currentTarget.value })} + placeholder="Paste the {CODE_LENGTHS.SHARE}-character code" + spellcheck="false" + type="text" + value={backend.code ?? ''} + /> + + {#if canScan} + + {/if} +
+ + {#if codeError} +

{codeError}

+ {:else} +

+ Printed by llama-server --connect. It is a credential: + anyone who has it can use that server. +

+ {/if} +
+ {:else} +
+ + + onChange({ baseUrl: e.currentTarget.value })} + placeholder="https://api.example.com" + type="url" + value={backend.baseUrl} + /> + + {#if urlError} +

{urlError}

+ {/if} +
+ {/if} +
+ handleChange({ code: scanned })} + /> +
- {#if testing} + {#if pairing} + + +
+

Pairing

+ +

Opening the tunnel to that server.

+
+ {:else if testing}
@@ -171,6 +268,18 @@ Asking {hostOf(draft.baseUrl)} for the models it serves.

+ {:else if pairError} + + +
+

Pairing failed

+ +

{pairError}

+ +

+ The provider is saved; retry from its card. +

+
{:else if testResult?.ok} @@ -195,13 +304,21 @@

{:else} - + {#if isRemote} + + {:else} + + {/if}
-

Connection not tested

+

+ {isRemote ? 'Not paired yet' : 'Connection not tested'} +

- Test it to list the models this provider serves. + {isRemote + ? 'Pairing saves the provider and connects to it.' + : 'Test it to list the models this provider serves.'}

{/if} @@ -212,13 +329,25 @@ Cancel - - - + {#if isRemote} + + {:else} + + + + {/if} diff --git a/ui/apps/chat/src/lib/components/app/backends/index.ts b/ui/apps/chat/src/lib/components/app/backends/index.ts index 7b18cf2c44d2..3da88d367307 100644 --- a/ui/apps/chat/src/lib/components/app/backends/index.ts +++ b/ui/apps/chat/src/lib/components/app/backends/index.ts @@ -1,4 +1,5 @@ export { default as BackendCard } from './BackendCard.svelte'; export { default as BackendForm } from './BackendForm.svelte'; export { default as BackendIcon } from './BackendIcon.svelte'; +export { default as DialogBackendCodeScanner } from './DialogBackendCodeScanner.svelte'; export { default as DialogBackendForm } from './DialogBackendForm.svelte'; diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelProviders.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelProviders.svelte index f8b7cc9c1625..637cab82a5a8 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelProviders.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelProviders.svelte @@ -1,8 +1,14 @@ {#if hasError || isLoadingModel} diff --git a/ui/apps/chat/src/lib/components/app/index.ts b/ui/apps/chat/src/lib/components/app/index.ts index b193a8a19fc3..a1ea03a74b8d 100644 --- a/ui/apps/chat/src/lib/components/app/index.ts +++ b/ui/apps/chat/src/lib/components/app/index.ts @@ -1,5 +1,4 @@ export * from './actions'; -export * from './backends'; export * from './badges'; export * from './chat'; export * from './content'; diff --git a/ui/apps/chat/src/lib/components/app/models/ModelAvatar.svelte b/ui/apps/chat/src/lib/components/app/models/ModelAvatar.svelte index 2218f42cd08e..994101386db8 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelAvatar.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelAvatar.svelte @@ -1,7 +1,7 @@ -{#if useProviderIcon} +{#if useServerIcon} - + {#snippet fallback()} {#if isLocal} @@ -109,7 +109,7 @@ {/if} {/snippet} - + {:else if orgName && hubEnabled} ([]); + let serverFilter = $state([]); let contextLimit = $state(0); let modalityFilter = $state([]); let capabilityFilter = $state([]); @@ -55,8 +55,8 @@ let isFavorite = $derived((option: ModelOption) => modelsStore.favoriteModelIds.has(option.model) ); - // every filter but the provider one, so a provider count does not fall to zero - // the moment that provider is the one being looked at + // every filter but the server one, so a server count does not fall to zero + // the moment that server is the one being looked at let matching = $derived.by(() => { // the term matches what the selector search matches: name, model, aliases and tags const searched = filterModelOptions(allModels, filter); @@ -87,19 +87,19 @@ }); }); let visible = $derived.by(() => - providerFilter.length === 0 + serverFilter.length === 0 ? matching - : matching.filter((option) => providerFilter.includes(option.backendId ?? LOCAL_BACKEND_ID)) + : matching.filter((option) => serverFilter.includes(option.serverId ?? LOCAL_BACKEND_ID)) ); // the rail counts follow the active view and filter, so it always says how many - // repos each provider contributes to what the table is showing - let providerCounts = $derived.by(() => { + // repos each server contributes to what the table is showing + let serverCounts = $derived.by(() => { const counts: Record = {}; for (const entry of groupModelQuants(matching)) { - const backendId = entry.base.backendId ?? LOCAL_BACKEND_ID; + const serverId = entry.base.serverId ?? LOCAL_BACKEND_ID; - counts[backendId] = (counts[backendId] ?? 0) + 1; + counts[serverId] = (counts[serverId] ?? 0) + 1; } return counts; @@ -119,7 +119,7 @@ const byRecency = (list: ModelQuantGroup[]) => rank.size === 0 ? list : [...list].sort((a, b) => rankOf(a) - rankOf(b)); // one entry per repo, so a model with several quants takes a single table row; - // loaded models lead the table, then favorites, then one block per provider + // loaded models lead the table, then favorites, then one block per server let entries = $derived(byRecency(groupModelQuants(visible))); let groups = $derived.by(() => { // a loaded quant is a model of its own: its repo keeps the quants left behind. @@ -167,34 +167,34 @@ const { hidden, local } = splitHiddenQuants(localRest, (option) => modelsStore.isHidden(option.id) ); - const byBackend = new SvelteMap(); + const byServer = new SvelteMap(); for (const entry of local) { - const backendId = entry.base.backendId ?? LOCAL_BACKEND_ID; + const serverId = entry.base.serverId ?? LOCAL_BACKEND_ID; - if (!byBackend.has(backendId)) byBackend.set(backendId, []); + if (!byServer.has(serverId)) byServer.set(serverId, []); - byBackend.get(backendId)!.push(entry); + byServer.get(serverId)!.push(entry); } const ordered: ModelsTableGroup[] = []; - // loaded models lead the table, then favorites, then one block per backend + // loaded models lead the table, then favorites, then one block per server const pushSection = ( kind: ModelsTableGroup['kind'], items: ModelQuantGroup[], - provider?: { id: string; label: string } + server?: { id: string; label: string } ): void => { if (items.length === 0) return; const isLocal = kind === ModelsTableGroupKind.LOCAL; ordered.push({ - backendId: provider?.id ?? (isLocal ? LOCAL_BACKEND_ID : null), isLocal, items, - key: provider?.id ?? (isLocal ? LOCAL_BACKEND_ID : kind), + key: server?.id ?? (isLocal ? LOCAL_BACKEND_ID : kind), kind, - label: provider?.label ?? MODELS_TABLE_GROUP_LABELS[kind as ModelsTableGroupKind] + label: server?.label ?? MODELS_TABLE_GROUP_LABELS[kind as ModelsTableGroupKind], + serverId: server?.id ?? (isLocal ? LOCAL_BACKEND_ID : null) }); }; @@ -202,19 +202,19 @@ pushSection(ModelsTableGroupKind.DOWNLOADING, downloads); pushSection(ModelsTableGroupKind.FAVORITES, favorites); - const localItems = byBackend.get(LOCAL_BACKEND_ID); + const localItems = byServer.get(LOCAL_BACKEND_ID); if (localItems?.length) pushSection(ModelsTableGroupKind.LOCAL, localItems); - for (const backend of backendsStore.enabled) { - if (backend.id === LOCAL_BACKEND_ID) continue; + for (const server of serversStore.enabled) { + if (server.id === LOCAL_BACKEND_ID) continue; - const items = byBackend.get(backend.id); + const items = byServer.get(server.id); if (items?.length) - pushSection(ModelsTableProviderKind.PROVIDER, items, { - id: backend.id, - label: backend.name + pushSection(ModelsTableServerKind.SERVER, items, { + id: server.id, + label: server.name }); } @@ -260,12 +260,12 @@ bind:contextLimit bind:filter bind:modalities={modalityFilter} - bind:providers={providerFilter} + bind:servers={serverFilter} {groups} {isFavorite} onSelect={(option) => uiStore.openModelDetails(option.id)} - {providerCounts} {selectedId} + {serverCounts} {toolbarEnd} />
diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerFilters.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerFilters.svelte index 69ebd9a9e615..24936fa651e5 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerFilters.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerFilters.svelte @@ -2,9 +2,9 @@ import * as DropdownMenu from '@ggml-org/llama-ui/ui/dropdown-menu'; import * as Select from '@ggml-org/llama-ui/ui/select'; import * as ToggleGroup from '@ggml-org/llama-ui/ui/toggle-group'; - import { ChevronDown, Server } from '@lucide/svelte'; - import { BackendIcon } from '#lib/components/app/backends/index.ts'; + import { ChevronDown, Server as ServerGlyph } from '@lucide/svelte'; import { Logo, ScrollCarousel } from '#lib/components/app/index.ts'; + import { ServerIcon } from '#lib/components/app/servers/index.ts'; import { CAPABILITY_ICONS, CAPABILITY_LABELS, @@ -20,30 +20,31 @@ } from '#lib/constants/index.ts'; import { ModelCapability } from '#lib/enums/index.ts'; import { modelsStore } from '#lib/stores/index.ts'; - import type { Backend } from '#lib/types/backend.js'; + import type { Server } from '#lib/types/servers.js'; import { SvelteSet } from 'svelte/reactivity'; interface Props { - backends: Backend[]; + /** Servers the filter can offer: the enabled ones. */ + availableServers: Server[]; /** Capabilities a model must have every one of. */ capabilities?: ModelCapability[]; /** Smallest context a model must support; 0 keeps every model. */ contextLimit?: number; /** Modalities a model must support at least one of. */ modalities?: ModalityKey[]; - /** Backend ids to keep; empty keeps every provider. */ - providers?: string[]; - /** Repos each provider contributes to the current search, shown in the menu. */ - providerCounts?: Record; + /** Server ids to keep; empty keeps every server. */ + servers?: string[]; + /** Repos each server contributes to the current search, shown in the menu. */ + serverCounts?: Record; } let { - backends, + availableServers, capabilities = $bindable([]), contextLimit = $bindable(0), modalities = $bindable([]), - providerCounts = {}, - providers = $bindable([]) + serverCounts = {}, + servers = $bindable([]) }: Props = $props(); const CONTEXT_STEPS: { label: string; value: number }[] = [ @@ -96,32 +97,32 @@ modalities = values.filter((value): value is ModalityKey => MODALITY_VALUES.has(value)); } - // none selected means every provider, so the label names the selection - let providerLabel = $derived( - providers.length === 0 - ? 'All providers' - : providers.length === 1 - ? (backends.find((backend) => backend.id === providers[0])?.name ?? '1 provider') - : `${providers.length} providers` + // none selected means every server, so the label names the selection + let serverLabel = $derived( + servers.length === 0 + ? 'All servers' + : servers.length === 1 + ? (availableServers.find((server) => server.id === servers[0])?.name ?? '1 server') + : `${servers.length} servers` ); let contextLabel = $derived( CONTEXT_STEPS.find((step) => step.value === contextLimit)?.label ?? CONTEXT_STEPS[0].label ); - function toggleProvider(id: string, checked: boolean | 'indeterminate'): void { - providers = checked === true ? [...providers, id] : providers.filter((entry) => entry !== id); + function toggleServer(id: string, checked: boolean | 'indeterminate'): void { + servers = checked === true ? [...servers, id] : servers.filter((entry) => entry !== id); } -{#snippet providerMark(backend: Backend)} - {#if backend.id === LOCAL_BACKEND_ID} - +{#snippet serverMark(server: Server)} + {#if server.id === LOCAL_BACKEND_ID} + {#snippet fallback()} {/snippet} - + {:else} - + {/if} {/snippet} @@ -135,7 +136,7 @@ gapSize="2" innerClass="items-center" > - {#if backends.length > 1} + {#if availableServers.length > 1} {#snippet child({ props })} @@ -144,9 +145,9 @@ class="inline-flex items-center whitespace-nowrap {FILTER_TRIGGER_CLASS}" type="button" > - + - {providerLabel} + {serverLabel} @@ -155,28 +156,26 @@ - Providers + Servers - {#each backends as backend (backend.id)} + {#each availableServers as server (server.id)} toggleProvider(backend.id, checked)} + checked={servers.includes(server.id)} + onCheckedChange={(checked) => toggleServer(server.id, checked)} > - {@render providerMark(backend)} + {@render serverMark(server)} - {backend.name} + {server.name} - {providerCounts[backend.id] ?? 0} + {serverCounts[server.id] ?? 0} {/each} - {#if providers.length > 0} + {#if servers.length > 0} - (providers = [])} - >Show every provider + (servers = [])}>Show every server {/if} diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfigurationActions.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfigurationActions.svelte index 9f0183e3188f..f9dbab94f505 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfigurationActions.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfigurationActions.svelte @@ -14,7 +14,7 @@ import { conversationsStore, deviceStore, uiStore } from '#lib/stores/index.ts'; interface Props { - /** A provider that cannot load or unload has no button to offer. */ + /** A server that cannot load or unload has no button to offer. */ canToggleLoad?: boolean; isDownload?: boolean; isDownloadPaused?: boolean; diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelsTable.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelsTable.svelte index 0f5f3ffd7761..9f66a93d75a9 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelsTable.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelsTable.svelte @@ -45,10 +45,10 @@ ModelCapability, ModelDownloadConfirmAction, ModelsTableGroupKind, - ModelsTableProviderKind, + ModelsTableServerKind, ModelsTableSortKey } from '#lib/enums/index.ts'; - import { backendsModelsStore, modelsStore, settingsStore } from '#lib/stores/index.ts'; + import { modelsStore, serversModelsStore, settingsStore } from '#lib/stores/index.ts'; import type { ModelOption } from '#lib/types/models.js'; import { groupModelFamilies, type ModelFamilyGroup } from '#lib/utils/model-families.ts'; import type { Snippet } from 'svelte'; @@ -65,10 +65,10 @@ onSelect: (option: ModelOption) => void; /** Modalities a model must support at least one of. */ modalities?: ModalityKey[]; - /** Backend ids to keep; empty keeps every provider. */ - providers?: string[]; - /** Repos each provider contributes to the current search, for the filter menu. */ - providerCounts?: Record; + /** Server ids to keep; empty keeps every server. */ + servers?: string[]; + /** Repos each server contributes to the current search, for the filter menu. */ + serverCounts?: Record; selectedId: string | null; /** Rendered at the toolbar's right end, past the filters. */ toolbarEnd?: Snippet; @@ -82,15 +82,15 @@ isFavorite, modalities = $bindable([]), onSelect, - providerCounts = {}, - providers = $bindable([]), selectedId, + serverCounts = {}, + servers = $bindable([]), toolbarEnd }: Props = $props(); let isEmpty = $derived(groups.every((group) => group.items.length === 0)); let hasFilters = $derived( - hasActiveFilters(contextLimit, modalities, capabilities) || providers.length > 0 + hasActiveFilters(contextLimit, modalities, capabilities) || servers.length > 0 ); /** Noun the show-more row counts in, per unit of the grouped list. */ @@ -253,7 +253,7 @@ {onSelect} option={quant} selected={selectedId === quant.id} - showProvider={entry.kind === 'providers'} + showServer={entry.kind === 'servers'} /> {/each} @@ -358,8 +358,8 @@ bind:contextLimit bind:filter bind:modalities - bind:providers - {providerCounts} + bind:servers + {serverCounts} {toolbarEnd} /> @@ -394,22 +394,22 @@ {/if} {/snippet} - {@const backendState = group.backendId ? backendsModelsStore.get(group.backendId) : null} + {@const serverState = group.serverId ? serversModelsStore.get(group.serverId) : null} diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerQuantRow.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerQuantRow.svelte index 87bdc65ae0cc..bb3e9b99cba0 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerQuantRow.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerQuantRow.svelte @@ -10,7 +10,7 @@ import { MODEL_ROW_GRID_CLASS, MODEL_ROW_TRAILING_CELL_CLASS } from '#lib/constants/index.ts'; import { modelsStore } from '#lib/stores/index.ts'; import type { ModelOption } from '#lib/types/models.js'; - import { getBackend } from '#lib/utils/api-base.ts'; + import { getServer } from '#lib/utils/api-base.ts'; import { isAuxSidecar } from '#lib/utils/index.ts'; interface Props { @@ -19,8 +19,8 @@ onDelete: (option: ModelOption) => void; onSelect: (option: ModelOption) => void; selected: boolean; - /** Badge the backend name instead of the quant, for a provider group. */ - showProvider?: boolean; + /** Badge the server name instead of the quant, for a server group. */ + showServer?: boolean; /** Left padding in px, from the nesting depth. */ indent?: number; } @@ -32,7 +32,7 @@ onSelect, option, selected, - showProvider = false + showServer = false }: Props = $props(); let favorite = $derived(isFavorite(option)); @@ -71,7 +71,7 @@ type="button" > - {showProvider ? (getBackend(option.backendId)?.name ?? quant) : quant} + {showServer ? (getServer(option.serverId)?.name ?? quant) : quant} option.backendId ?? '')).size); + let serverCount = $derived(new Set(entry.quants.map((option) => option.serverId ?? '')).size); let groupLabel = $derived( - entry.kind === ModelGroupKind.PROVIDERS - ? `${providerCount} provider${providerCount === 1 ? '' : 's'}` + entry.kind === ModelGroupKind.SERVERS + ? `${serverCount} server${serverCount === 1 ? '' : 's'}` : entry.kind === ModelGroupKind.VARIANTS ? `${entry.quants.length} variants` : `${entry.quants.length} quants available` diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelProviders.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerServers.svelte similarity index 55% rename from ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelProviders.svelte rename to ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerServers.svelte index 637cab82a5a8..42186e7d6ee7 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelProviders.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerServers.svelte @@ -1,15 +1,15 @@ diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerTableToolbar.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerTableToolbar.svelte index b8524c987600..f91263ab5f94 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerTableToolbar.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerTableToolbar.svelte @@ -6,7 +6,7 @@ import { SearchInput } from '#lib/components/app/forms/index.ts'; import { type ModalityKey } from '#lib/constants/index.ts'; import { ModelCapability } from '#lib/enums/index.ts'; - import { backendsStore, deviceStore } from '#lib/stores/index.ts'; + import { deviceStore, serversStore } from '#lib/stores/index.ts'; import type { Snippet } from 'svelte'; interface Props { @@ -17,10 +17,10 @@ filter?: string; /** Modalities a model must support at least one of. */ modalities?: ModalityKey[]; - /** Repos each provider contributes to the current search, for the filter menu. */ - providerCounts?: Record; - /** Backend ids to keep; empty keeps every provider. */ - providers?: string[]; + /** Repos each server contributes to the current search, for the filter menu. */ + serverCounts?: Record; + /** Server ids to keep; empty keeps every server. */ + servers?: string[]; /** Rendered at the toolbar's right end, past the filters. */ toolbarEnd?: Snippet; } @@ -30,13 +30,13 @@ contextLimit = $bindable(0), filter = $bindable(''), modalities = $bindable([]), - providerCounts = {}, - providers = $bindable([]), + serverCounts = {}, + servers = $bindable([]), toolbarEnd }: Props = $props(); let hasFilters = $derived( - hasActiveFilters(contextLimit, modalities, capabilities) || providers.length > 0 + hasActiveFilters(contextLimit, modalities, capabilities) || servers.length > 0 ); let filterInput = $state(null); @@ -73,16 +73,16 @@ bind:capabilities bind:contextLimit bind:modalities - bind:providers - backends={backendsStore.enabled} - {providerCounts} + bind:servers + availableServers={serversStore.enabled} + {serverCounts} /> {#if hasFilters} {:else}

{displayUrl}

@@ -132,8 +132,8 @@
onToggle?.(value)} />
@@ -191,16 +191,16 @@
{#if isIdle} - {/if} {#if remote && tunnel === TunnelStatus.CONNECTED} - {/each} -
+ + onChange({ kind: value as ServerKind })} + value={server.kind} + > + + {#each [ServerKind.URL, ServerKind.REMOTE] as kind (kind)} + + {kind === ServerKind.REMOTE ? 'Remote server' : 'Server URL'} + + {/each} + + {#if isRemote}
-
{:else}
-
- onToggle?.(value)} - /> + {#if remote} + + + {#snippet child({ props })} + onToggle?.(value)} + /> + {/snippet} + + + +

Disabling also closes this server's tunnel.

+
+
+ {:else} + onToggle?.(value)} + /> + {/if} - {#if isOffline && errorText} - - -

{errorText}

-
+ {#if hostCode} +
+
+
+

Remote access: on

+ +

+ This server can be reached through its access code. +

+
+ +
+ + + +
+
+
+ {/if} - -

{errorText}

-
-
+ {#if status.detail} +

+ {status.detail} +

{/if}
- {#if isConnecting} + {#if isConnecting || isChecking} - - Connecting - {:else if isChecking} - - - Checking {:else if isOnline} - - {modelCount === 1 ? '1 model' : `${modelCount} models`} {:else if isOffline} - - {remote ? 'Disconnected' : 'Unreachable'} - - {:else if isIdle} - - Not connected {/if} {#if hasStatus} + {status.label} + + {#if isOffline} + + {/if} + · {/if} @@ -196,12 +251,15 @@ {/if} - {#if remote && tunnel === TunnelStatus.CONNECTED} + {#if remote && tunnel !== TunnelStatus.IDLE}
+ +
+ + {#if showHostQr && hostQr} +
+ Access code QR code + +

Scan it with the other device.

+
+ {/if} {/if} diff --git a/ui/apps/chat/src/lib/utils/index.ts b/ui/apps/chat/src/lib/utils/index.ts index 4c5c4f1c2cee..6fdfec87f620 100644 --- a/ui/apps/chat/src/lib/utils/index.ts +++ b/ui/apps/chat/src/lib/utils/index.ts @@ -47,12 +47,13 @@ export { tunnelHostLabel, tunnelOrigin } from './servers'; +export { serverCardStatusOf } from './server-status'; +export type { ServerCardFacts, ServerCardStatus } from './server-status'; // Camera access code scanning (native BarcodeDetector where the browser has one) export { scanFrameForCode, supportsQrScan } from './qr-scan'; -// What a server card reports about its tunnel and its listing -export { serverCardStatusOf } from './server-status'; -export type { ServerCardFacts, ServerCardStatus } from './server-status'; +// Access code as a QR code, the other end of the scanner above +export { qrCodeDataUrl } from './qr-code'; // Attachment utilities export { getAttachmentDisplayItems, isMcpPrompt, isMcpResource } from './attachment-display'; diff --git a/ui/apps/chat/src/lib/utils/qr-code.ts b/ui/apps/chat/src/lib/utils/qr-code.ts new file mode 100644 index 000000000000..94d002490bed --- /dev/null +++ b/ui/apps/chat/src/lib/utils/qr-code.ts @@ -0,0 +1,39 @@ +/** + * QR code of an access code, for carrying it from the screen it is shown on to + * the camera of another device. + * + * The payload is the code itself, in the shape the scanner accepts: the scanner + * hands whatever it decodes to `normalizeShareCode`, so a code pasted by hand + * and a code scanned off a screen go through the same door. + */ + +import { normalizeShareCode } from './servers'; +import { renderSVG } from 'uqr'; + +/** Module size of the rendered code, in SVG units. The image is sized by CSS. */ +const PIXEL_SIZE = 4; +/** Quiet zone, in modules on each side; the spec asks for four, a camera needs them. */ +const BORDER = 4; + +/** + * Data URL of an SVG QR code carrying the access code, or null when the value + * is not a usable code: a QR a phone cannot pair with is worse than no QR. + * + * Black on white, pinned: a scanner reads dark modules on a light field, and + * the app's dark theme must not invert that. + */ +export function qrCodeDataUrl(code: string): string | null { + const normalized = normalizeShareCode(code); + + if (!normalized) return null; + + const svg = renderSVG(normalized, { + blackColor: '#000000', + border: BORDER, + ecc: 'M', + pixelSize: PIXEL_SIZE, + whiteColor: '#ffffff' + }); + + return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`; +} From f22dcaafb4d6e4626668d66a250c1f68dd978a72 Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Tue, 20 Oct 2026 10:00:57 +0200 Subject: [PATCH 45/97] ui : give servers a dialog of their own The models dialog stays desktop-only, so a phone had no way into its server list; the sidebar now carries a Servers entry that opens the list on its own. Assisted-by: DeepSeek-V4.1-Flash --- .../SidebarNavigation.svelte | 7 +++ .../SidebarNavigationActions.svelte | 3 +- .../app/servers/DialogServers.svelte | 46 +++++++++++++++++++ .../src/lib/components/app/servers/index.ts | 1 + .../chat/src/lib/constants/ui.constants.ts | 7 +++ ui/apps/chat/src/lib/enums/ui.enums.ts | 1 + ui/apps/chat/src/lib/stores/ui.svelte.ts | 9 ++++ 7 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 ui/apps/chat/src/lib/components/app/servers/DialogServers.svelte diff --git a/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte b/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte index e989e7dbb98d..aa297d6b0aed 100644 --- a/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte +++ b/ui/apps/chat/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte @@ -8,6 +8,7 @@ DialogGroup, DialogGroupPicker, DialogSearch, + DialogServers, DialogSettingsChat, Logo, ModelsManagerModelDrawer, @@ -540,6 +541,10 @@ case SidebarAction.MANAGE_MODELS: openDialog(() => uiStore.openModelsManager()); + break; + case SidebarAction.SERVERS: + openDialog(() => uiStore.openServers()); + break; // a dialog on a desktop or tablet; on a phone, a page of its own case SidebarAction.SETTINGS: @@ -796,6 +801,8 @@ + +