From bc262f33cc87b298c1f676b28a9aa05e47c6e9aa Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Tue, 27 Oct 2026 06:46:25 +0100 Subject: [PATCH] ui: Open model details in a drawer without leaving the page (#31176) * ui: open model details in a global drawer without leaving the page The model info actions in the selector used to navigate to the models page to open its details pane, and a phone opened a separate dialog instead. The drawer now lives outside the models table, driven by uiStore, so the info icon opens it over whatever page is showing. The models dropdown and the phone picker stay open under the drawer's backdrop, and keep focus while the drawer opens and closes, so the trigger's tooltip no longer pops over the drawer. Assisted-by: Claude (Opus 5.5 Medium) * ui: let the model details drawer reopen after a drag to dismiss Dragging the drawer down wrote vaul's own open state, which the one-way open prop then kept closed, so the info action could not open it again until a refresh. Bind open both ways through the store instead. Assisted-by: Claude (Opus 5.5 Medium) * ui: close the models selector from the details drawer chat actions Assisted-by: Claude (Opus 5.5 Medium) --- .../app/dialogs/DialogModelInformation.svelte | 85 -------- .../src/lib/components/app/dialogs/index.ts | 11 - .../app/models/ModelRowActions.svelte | 8 +- .../models/ModelsManager/ModelsManager.svelte | 201 +----------------- .../ModelsManagerModelDrawer.svelte | 188 ++++++++++++++++ .../app/models/ModelsManager/utils.ts | 13 ++ .../ModelsSelector/ModelsSelector.svelte | 12 +- .../ModelsSelectorDownloadItem.svelte | 24 +-- .../ModelsSelectorDrawer.svelte | 7 +- .../ModelsSelectorDropdown.svelte | 19 ++ .../ui/src/lib/components/app/models/index.ts | 3 + .../SidebarNavigation.svelte | 4 +- .../ui/drawer/drawer-content.svelte | 4 +- tools/ui/src/lib/stores/ui.svelte.ts | 36 ++-- 14 files changed, 282 insertions(+), 333 deletions(-) delete mode 100644 tools/ui/src/lib/components/app/dialogs/DialogModelInformation.svelte create mode 100644 tools/ui/src/lib/components/app/models/ModelsManager/ModelsManagerModelDrawer.svelte diff --git a/tools/ui/src/lib/components/app/dialogs/DialogModelInformation.svelte b/tools/ui/src/lib/components/app/dialogs/DialogModelInformation.svelte deleted file mode 100644 index 7780b67d2..000000000 --- a/tools/ui/src/lib/components/app/dialogs/DialogModelInformation.svelte +++ /dev/null @@ -1,85 +0,0 @@ - - - { - if (!open) uiStore.modelInformation = null; - }} - open={uiStore.modelInformation !== null} -> - event.preventDefault()} - overlayClass="z-[70]" - > - - - - - {#if uiStore.modelInformation} - {uiStore.modelInformation.model} - {/if} - - - - Details of the model, from the server or the Hub. - - - -
- {#if uiStore.modelInformation} - - {/if} -
-
-
diff --git a/tools/ui/src/lib/components/app/dialogs/index.ts b/tools/ui/src/lib/components/app/dialogs/index.ts index ff287ec18..f038c447b 100644 --- a/tools/ui/src/lib/components/app/dialogs/index.ts +++ b/tools/ui/src/lib/components/app/dialogs/index.ts @@ -420,17 +420,6 @@ export { default as DialogModelNotAvailable } from './DialogModelNotAvailable.sv */ export { default as DialogConversationSelection } from './DialogConversationSelection.svelte'; -/** - * - * MODEL INFORMATION DIALOGS - * - * Dialogs for displaying model and server information. - * - */ - -/** **DialogModelInformation** - model details a phone opens instead of the manager pane. */ -export { default as DialogModelInformation } from './DialogModelInformation.svelte'; - /** * **DialogMcpResourcesBrowser** - MCP resources browser dialog * diff --git a/tools/ui/src/lib/components/app/models/ModelRowActions.svelte b/tools/ui/src/lib/components/app/models/ModelRowActions.svelte index b40f88d83..5c2f321bd 100644 --- a/tools/ui/src/lib/components/app/models/ModelRowActions.svelte +++ b/tools/ui/src/lib/components/app/models/ModelRowActions.svelte @@ -1,7 +1,7 @@ @@ -325,69 +198,9 @@ bind:modalities={modalityFilter} {groups} {isFavorite} - onSelect={(option) => (selectedId = option.id)} + onSelect={(option) => uiStore.openModelDetails(option.id)} {selectedId} {toolbarEnd} /> - - - { - if (!open) selectedId = null; - }} - open={selected !== null} - shouldScaleBackground={false} -> - - Model details - - - Configuration, actions and metadata of the selected model. - - -
- {#if shownOption} - {#key shownId} - (selectedId = null)} - onToggleLoad={() => void toggleLoad(shownOption)} - onUseInChat={() => void useInChat(shownOption)} - onUseInNewChat={() => void useInNewChat(shownOption)} - option={shownOption} - /> - {/key} - {/if} -
-
-
- - diff --git a/tools/ui/src/lib/components/app/models/ModelsManager/ModelsManagerModelDrawer.svelte b/tools/ui/src/lib/components/app/models/ModelsManager/ModelsManagerModelDrawer.svelte new file mode 100644 index 000000000..d9e7643ae --- /dev/null +++ b/tools/ui/src/lib/components/app/models/ModelsManager/ModelsManagerModelDrawer.svelte @@ -0,0 +1,188 @@ + + + + selected !== null, + (open) => { + if (!open) uiStore.closeModelDetails(); + } + } + direction={deviceStore.isMobile ? 'bottom' : 'right'} + shouldScaleBackground={false} +> + + Model details + + + Configuration, actions and metadata of the selected model. + + +
+ {#if shownOption} + {#key shownId} + uiStore.closeModelDetails()} + onToggleLoad={() => void toggleLoad(shownOption)} + onUseInChat={() => void useInChat(shownOption)} + onUseInNewChat={() => void useInNewChat(shownOption)} + option={shownOption} + /> + {/key} + {/if} +
+
+
+ + diff --git a/tools/ui/src/lib/components/app/models/ModelsManager/utils.ts b/tools/ui/src/lib/components/app/models/ModelsManager/utils.ts index ccbe226c0..7241fc355 100644 --- a/tools/ui/src/lib/components/app/models/ModelsManager/utils.ts +++ b/tools/ui/src/lib/components/app/models/ModelsManager/utils.ts @@ -72,6 +72,19 @@ export function downloadGroups( }); } +/** Model with this qualified id or raw name, from the listing or else the tracked downloads. */ +export function findModelOption( + key: string | null, + models: ModelOption[], + downloads: ModelQuantGroup[] +): ModelOption | null { + if (!key) return null; + + const matches = (candidate: ModelOption) => candidate.id === key || candidate.model === key; + + return models.find(matches) ?? downloads.find((group) => matches(group.base))?.base ?? null; +} + /** One collapsible block of the manager's table. */ export interface ModelsTableGroup { /** One entry per repo, its quants hanging off it. */ diff --git a/tools/ui/src/lib/components/app/models/ModelsSelector/ModelsSelector.svelte b/tools/ui/src/lib/components/app/models/ModelsSelector/ModelsSelector.svelte index 33b3b2f86..1ed74a3ea 100644 --- a/tools/ui/src/lib/components/app/models/ModelsSelector/ModelsSelector.svelte +++ b/tools/ui/src/lib/components/app/models/ModelsSelector/ModelsSelector.svelte @@ -14,8 +14,9 @@ import { KeyboardKey, ServerModelStatus } from '$lib/enums'; import { useChatFormModel } from '$lib/hooks/use-chat-form-model.svelte'; import { useModelsSelector } from '$lib/hooks/use-models-selector.svelte'; - import { deviceStore, modelsStore, serverStore, settingsStore } from '$lib/stores'; + import { deviceStore, modelsStore, serverStore, settingsStore, uiStore } from '$lib/stores'; import { type ModelItem, modelLoadFraction } from '$lib/utils'; + import { untrack } from 'svelte'; interface Props { /** Model to show, when the caller owns it, e.g. the model of one message. */ @@ -165,6 +166,15 @@ } } + // the details drawer's chat actions finish the pick, so an open picker closes too + $effect(() => { + if (!uiStore.modelsSelectorCloseSignal) return; + + untrack(() => { + if (isOpen) ms.handleOpenChange(false); + }); + }); + // bits-ui auto-focuses the opened content, which can yank the page scroll: the // content prevents that and this focuses the search input instead $effect(() => { diff --git a/tools/ui/src/lib/components/app/models/ModelsSelector/ModelsSelectorDownloadItem.svelte b/tools/ui/src/lib/components/app/models/ModelsSelector/ModelsSelectorDownloadItem.svelte index 7cc286f89..995bfe661 100644 --- a/tools/ui/src/lib/components/app/models/ModelsSelector/ModelsSelectorDownloadItem.svelte +++ b/tools/ui/src/lib/components/app/models/ModelsSelector/ModelsSelectorDownloadItem.svelte @@ -6,8 +6,8 @@ import { ActionIcon, ModelId } from '$lib/components/app'; import { ModelRowDownloadState } from '$lib/enums'; import { HuggingFaceService, ModelsService } from '$lib/services'; - import { deviceStore, modelsStore, uiStore } from '$lib/stores'; - import type { ModelDownloadEntry, ModelOption, ModelSidecarBadge } from '$lib/types'; + import { modelsStore, uiStore } from '$lib/stores'; + import type { ModelDownloadEntry, ModelSidecarBadge } from '$lib/types'; interface Props { /** One entry from the status feed: an in-flight or paused download. */ @@ -26,14 +26,6 @@ let pendingDrafts = $derived(sidecars.filter((badge) => badge.pending)); let onDiskDrafts = $derived(sidecars.filter((badge) => !badge.pending)); - /** The download stands for its model, so the row's info action can open on it. */ - let option = $derived({ - capabilities: [], - id: entry.repoWithTag, - model: entry.repoWithTag, - name: modelsStore.toDisplayName(entry.repoWithTag) - }); - let percent = $derived( entry.progress && entry.progress.totalBytes > 0 ? Math.round((entry.progress.downloadedBytes / entry.progress.totalBytes) * 100) @@ -81,11 +73,7 @@