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 @@