From ca792a3abe43e716f714f32b3486810c3ef85310 Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Wed, 28 Oct 2026 16:27:39 +0100 Subject: [PATCH 1/6] ui: show suggested and Hub models on the models page, add a grid view Replace the Discover dialog with a suggested models carousel above the installed models, search Hugging Face from the same search field in a section of its own, and open Hub models in a details drawer. Add a table/grid switch for the installed models. Assisted-by: Claude (Opus 5.5 Medium) --- .../app/dialogs/DialogDiscoverModels.svelte | 53 ---- .../src/lib/components/app/dialogs/index.ts | 3 - .../models/ModelsManager/ModelsManager.svelte | 44 ++- .../ModelsManagerHubResults.svelte | 81 ++++++ .../ModelsManagerModelCard.svelte | 134 +++++++++ .../ModelsManagerModelConfiguration.svelte | 10 +- ...elsManagerModelConfigurationActions.svelte | 18 +- ...delsManagerModelConfigurationHeader.svelte | 8 +- .../ModelsManagerModelsTable.svelte | 166 +++++++++-- .../ModelsManagerTableToolbar.svelte | 43 ++- .../app/models/ModelsManager/row-actions.ts | 12 +- .../app/models/discover/ModelsDiscover.svelte | 218 -------------- .../models/discover/ModelsDiscoverCard.svelte | 59 ++++ .../discover/ModelsDiscoverCarousel.svelte | 76 +++++ .../ModelsDiscoverDetails.svelte | 2 +- .../ModelsDiscoverDetailsDrawer.svelte | 68 +++++ .../ModelsDiscoverDetailsSkeleton.svelte | 2 +- .../discover/ModelsDiscoverDetails/index.ts | 5 +- .../ModelsDiscoverListItem.svelte | 266 +++--------------- .../ModelsDiscoverListSearch.svelte | 30 -- .../discover/ModelsDiscoverList/index.ts | 7 +- .../components/app/models/discover/index.ts | 14 +- .../SidebarNavigation.svelte | 4 +- .../constants/models-discover.constants.ts | 5 +- .../src/lib/constants/settings.constants.ts | 2 +- .../src/lib/constants/storage.constants.ts | 1 + ui/apps/chat/src/lib/enums/index.ts | 3 +- ui/apps/chat/src/lib/enums/model.enums.ts | 6 + .../lib/hooks/use-hub-model-summary.svelte.ts | 140 +++++++++ .../stores/models-discover/index.svelte.ts | 63 +++-- ui/apps/chat/src/lib/stores/ui.svelte.ts | 59 +++- ui/apps/chat/src/routes/models/+page.svelte | 17 +- .../models-manager-views.svelte.test.ts | 122 ++++++++ 33 files changed, 1065 insertions(+), 676 deletions(-) delete mode 100644 ui/apps/chat/src/lib/components/app/dialogs/DialogDiscoverModels.svelte create mode 100644 ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerHubResults.svelte create mode 100644 ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelCard.svelte delete mode 100644 ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscover.svelte create mode 100644 ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverCard.svelte create mode 100644 ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverCarousel.svelte create mode 100644 ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/ModelsDiscoverDetailsDrawer.svelte delete mode 100644 ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverList/ModelsDiscoverListSearch.svelte create mode 100644 ui/apps/chat/src/lib/hooks/use-hub-model-summary.svelte.ts create mode 100644 ui/apps/chat/tests/client/models-manager-views.svelte.test.ts diff --git a/ui/apps/chat/src/lib/components/app/dialogs/DialogDiscoverModels.svelte b/ui/apps/chat/src/lib/components/app/dialogs/DialogDiscoverModels.svelte deleted file mode 100644 index a1eeb46a449f..000000000000 --- a/ui/apps/chat/src/lib/components/app/dialogs/DialogDiscoverModels.svelte +++ /dev/null @@ -1,53 +0,0 @@ - - - - event.preventDefault()} - > - - - - - Discover - - - - Find models on Hugging Face and download them to the server. - - - -
- -
-
-
diff --git a/ui/apps/chat/src/lib/components/app/dialogs/index.ts b/ui/apps/chat/src/lib/components/app/dialogs/index.ts index 6d6ad0d2ab56..03f1849c0338 100644 --- a/ui/apps/chat/src/lib/components/app/dialogs/index.ts +++ b/ui/apps/chat/src/lib/components/app/dialogs/index.ts @@ -479,6 +479,3 @@ export { default as DialogConversationSelection } from './DialogConversationSele * ``` */ export { default as DialogMermaidPreview } from './DialogMermaidPreview.svelte'; - -/** **DialogDiscoverModels** - shell for the Hugging Face model discovery view. */ -export { default as DialogDiscoverModels } from './DialogDiscoverModels.svelte'; 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 6170e7476bff..1ae7a740506d 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 @@ -1,4 +1,5 @@ + +{#snippet icon()} + +{/snippet} + + +
+ {#if modelsDiscoverStore.searchError && !pending} +

+ {modelsDiscoverStore.searchError} +

+ {:else if !pending && results.length === 0} +

+ No GGUF models on Hugging Face match this search. +

+ {:else if isGrid} +
+ {#if pending} + {#each Array(SKELETON_COUNT) as _, index (index)} + + {/each} + {:else} + {#each results as model (model.id)} + uiStore.openHubModelDetails(id)} + /> + {/each} + {/if} +
+ {:else} + uiStore.openHubModelDetails(id)} + showBaseModelAvatar + /> + {/if} +
+
diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelCard.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelCard.svelte new file mode 100644 index 000000000000..414d0a45e18f --- /dev/null +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelCard.svelte @@ -0,0 +1,134 @@ + + + + + +
{ + if (!isRowControlClick(event)) activate(); + }} +> +
+ + + + +
+ + {#if sidecarBadges?.length} +
+ {#each sidecarBadges as badge (badge.repo + ':' + badge.kind + ':' + (badge.quant ?? ''))} + + {/each} +
+ {/if} + +
+ + + {#if favorite} + +
+ +
+ + + +
+ + {#if download} + + {/if} +
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 b456606c6e9e..c9a3fea2b1b6 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 @@ -129,13 +129,11 @@ {isLoaded} {onClose} onRequestCancelDownload={() => (cancelDownloadOpen = true)} - onSeeInDiscover={isDownload - ? () => uiStore.openModelsDiscover(repoOf(option.model)) - : undefined} onToggleDownload={() => void modelsStore.status.toggleDownload(option.model)} {onToggleLoad} {onUseInChat} {onUseInNewChat} + onViewOnHub={isDownload ? () => uiStore.openHubModelDetails(repoOf(option.model)) : undefined} {option} {status} /> @@ -253,13 +251,13 @@ {isLoaded} isLoading={status === ServerModelStatus.LOADING} onRequestCancelDownload={() => (cancelDownloadOpen = true)} - onSeeInDiscover={isDownload - ? () => uiStore.openModelsDiscover(repoOf(option.model)) - : undefined} onToggleDownload={() => void modelsStore.status.toggleDownload(option.model)} {onToggleLoad} {onUseInChat} {onUseInNewChat} + onViewOnHub={isDownload + ? () => uiStore.openHubModelDetails(repoOf(option.model)) + : undefined} /> {/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 f9dbab94f505..09573710260e 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 @@ -20,8 +20,8 @@ isDownloadPaused?: boolean; isLoaded: boolean; isLoading: boolean; - /** Opens the manager dialog on the Discover view, focused on this model's repo. */ - onSeeInDiscover?: () => void; + /** Opens the Hub details drawer on this model's repo. */ + onViewOnHub?: () => void; /** Confirm-cancel dialog on the pane, so nothing deletes without a click. */ onRequestCancelDownload?: () => void; onToggleDownload?: () => void; @@ -39,11 +39,11 @@ isLoaded, isLoading, onRequestCancelDownload, - onSeeInDiscover, onToggleDownload, onToggleLoad, onUseInChat, onUseInNewChat, + onViewOnHub, size = 'sm' }: Props = $props(); @@ -80,11 +80,11 @@ - {#if onSeeInDiscover && discoverEnabled} - {/if} {:else} @@ -136,11 +136,11 @@ {/if} - {#if onSeeInDiscover && discoverEnabled} - {/if} diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfigurationHeader.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfigurationHeader.svelte index a32cfa6b518d..2f284eab6578 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfigurationHeader.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfigurationHeader.svelte @@ -17,8 +17,8 @@ isCustomized: boolean; isLoaded: boolean; onClose: () => void; - /** Opens the manager dialog on the Discover view, focused on this model's repo. */ - onSeeInDiscover?: () => void; + /** Opens the Hub details drawer on this model's repo. */ + onViewOnHub?: () => void; onRequestCancelDownload?: () => void; onToggleDownload?: () => void; onToggleLoad: () => void; @@ -36,11 +36,11 @@ isLoaded, onClose, onRequestCancelDownload, - onSeeInDiscover, onToggleDownload, onToggleLoad, onUseInChat, onUseInNewChat, + onViewOnHub, option, status }: Props = $props(); @@ -167,11 +167,11 @@ {isLoaded} {isLoading} {onRequestCancelDownload} - {onSeeInDiscover} {onToggleDownload} {onToggleLoad} {onUseInChat} {onUseInNewChat} + {onViewOnHub} size="default" /> {/if} 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 9f66a93d75a9..fd7223378c52 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 @@ -1,4 +1,5 @@ - -{#snippet catalog()} - (selectedId = id)} - showBaseModelAvatar - /> -{/snippet} - - - -
- {#if selectedId} - - {/if} -
- - (cancelOpen = false)} - onConfirm={() => void modelsStore.status.cancelDownload(pendingCancel)} - open={cancelOpen} - repoWithTag={pendingCancel} -/> diff --git a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverCard.svelte b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverCard.svelte new file mode 100644 index 000000000000..81cd35624397 --- /dev/null +++ b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverCard.svelte @@ -0,0 +1,59 @@ + + + diff --git a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverCarousel.svelte b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverCarousel.svelte new file mode 100644 index 000000000000..3e4e84e9943e --- /dev/null +++ b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverCarousel.svelte @@ -0,0 +1,76 @@ + + +{#snippet icon()} + +{/snippet} + + + {#if modelsDiscoverStore.error && models.length === 0} +
+

{modelsDiscoverStore.error}

+ + +
+ {:else} + + {#if isFirstLoad} + {#each Array(SKELETON_CARDS) as _, index (index)} +
+
+ + + +
+ + + + +
+ {/each} + {:else} + {#each models as model (model.id)} + uiStore.openHubModelDetails(id)} + /> + {/each} + {/if} +
+ {/if} +
diff --git a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/ModelsDiscoverDetails.svelte b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/ModelsDiscoverDetails.svelte index bf6bc7529300..eb21a724e101 100644 --- a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/ModelsDiscoverDetails.svelte +++ b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/ModelsDiscoverDetails.svelte @@ -83,7 +83,7 @@

{error}

{:else if details} -
+
+ import ModelsDiscoverDetailsContainer from './ModelsDiscoverDetailsContainer.svelte'; + import * as Drawer from '@ggml-org/llama-ui/ui/drawer'; + import { X } from '@lucide/svelte'; + import { ActionIcon } from '#lib/components/app/index.ts'; + import { DISCOVER_ICON } from '#lib/constants/index.ts'; + import { deviceStore, uiStore } from '#lib/stores/index.ts'; + import { untrack } from 'svelte'; + + let focus = $derived(uiStore.hubModelFocus); + // keep the last repo on screen while the drawer closes + let shownId = $state(null); + + $effect(() => { + const repo = focus; + + if (!repo) return; + + untrack(() => (shownId = repo)); + }); + + // the setting can be turned off while the drawer is open: it closes with it + $effect(() => { + if (focus && !uiStore.isDiscoverEnabled) untrack(() => uiStore.closeHubModelDetails()); + }); + + + + focus !== null, + (open) => { + if (!open) uiStore.closeHubModelDetails(); + } + } + direction={deviceStore.isMobile ? 'bottom' : 'right'} + shouldScaleBackground={false} +> + +
+ + + Hugging Face + + + Details of a Hugging Face model and the files it can be downloaded as. + + + uiStore.closeHubModelDetails()} + tooltip="Close" + tooltipAsTitle + /> +
+ +
+ {#if shownId} + + {/if} +
+
+
diff --git a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/ModelsDiscoverDetailsSkeleton.svelte b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/ModelsDiscoverDetailsSkeleton.svelte index 1841495389d4..974cdeb9a520 100644 --- a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/ModelsDiscoverDetailsSkeleton.svelte +++ b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/ModelsDiscoverDetailsSkeleton.svelte @@ -3,7 +3,7 @@ -
+
diff --git a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/index.ts b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/index.ts index 91d5c89065d6..507fb4d81461 100644 --- a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/index.ts +++ b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverDetails/index.ts @@ -10,9 +10,12 @@ /** Detail pane of the selected model; fetches its own details and GGUF file list. */ export { default as ModelsDiscoverDetails } from './ModelsDiscoverDetails.svelte'; -/** Fetches one repo's details, files and readme for hosts outside Discover. */ +/** Fetches one repo's details, files and readme, then renders the detail pane. */ export { default as ModelsDiscoverDetailsContainer } from './ModelsDiscoverDetailsContainer.svelte'; +/** Detail pane in a drawer, mounted once and opened through `uiStore.openHubModelDetails`. */ +export { default as ModelsDiscoverDetailsDrawer } from './ModelsDiscoverDetailsDrawer.svelte'; + /** Header of the detail pane. */ export { default as ModelsDiscoverDetailsHeader } from './ModelsDiscoverDetailsHeader.svelte'; diff --git a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverList/ModelsDiscoverListItem.svelte b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverList/ModelsDiscoverListItem.svelte index b33ca55f0b9b..1d8c49034171 100644 --- a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverList/ModelsDiscoverListItem.svelte +++ b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverList/ModelsDiscoverListItem.svelte @@ -1,160 +1,23 @@
  • -
    - - - {#if download} - {@const state = download} - - - - - {percent !== null ? `${percent}%` : state.isPaused ? 'Paused' : 'Downloading'} - - - - - {/if} -
    - - - {#if onDiskDrafts.length} -
    - {#each onDiskDrafts as badge (badge.repo + ':' + badge.kind + ':' + (badge.quant ?? ''))} - - {/each} -
    - {/if} - - {#if download?.progress && download.progress.totalBytes > 0} - onSelect?.(model.id)} + type="button" + > + - {/if} + + + + +
  • diff --git a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverList/ModelsDiscoverListSearch.svelte b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverList/ModelsDiscoverListSearch.svelte deleted file mode 100644 index 55a05bd6d1ce..000000000000 --- a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverList/ModelsDiscoverListSearch.svelte +++ /dev/null @@ -1,30 +0,0 @@ - - - -
    - handleInput(v)} {placeholder} size="sm" /> -
    diff --git a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverList/index.ts b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverList/index.ts index c3025c0b2601..6eb6482fa8f5 100644 --- a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverList/index.ts +++ b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverList/index.ts @@ -2,15 +2,14 @@ * * MODELS DISCOVER - LIST * - * The discover sidebar column: a debounced search field above a navigable list of - * HuggingFace GGUF models, with skeleton rows while loading. + * Lists of HuggingFace GGUF models: the Hub search results on the models page, with + * skeleton rows while loading. * */ export { default as ModelsDiscoverList } from './ModelsDiscoverList.svelte'; -export { default as ModelsDiscoverListSearch } from './ModelsDiscoverListSearch.svelte'; -/** One model entry; also the row of a tracked download, with its own controls. */ +/** One model entry. */ export { default as ModelsDiscoverListItem } from './ModelsDiscoverListItem.svelte'; export { default as ModelsDiscoverListItemSkeleton } from './ModelsDiscoverListItemSkeleton.svelte'; diff --git a/ui/apps/chat/src/lib/components/app/models/discover/index.ts b/ui/apps/chat/src/lib/components/app/models/discover/index.ts index bb353c72dfa8..4a113bf4cc60 100644 --- a/ui/apps/chat/src/lib/components/app/models/discover/index.ts +++ b/ui/apps/chat/src/lib/components/app/models/discover/index.ts @@ -2,15 +2,17 @@ * * MODELS DISCOVER * - * Components for the Models Discover view: a sidebar search + list of HuggingFace GGUF - * models and a detail view for the selected model, used as the body of the discovery - * dialog. The list and detail trees live in their own subfolders; this barrel re-exports - * them alongside the shared leaves. + * Components for browsing HuggingFace GGUF models on the models page: the suggested + * models carousel, the Hub search results and the details drawer a repo opens in. The + * list and detail trees live in their own subfolders; this barrel re-exports them. * */ -/** The whole view: sidebar list on the left, detail pane on the right. */ -export { default as ModelsDiscover } from './ModelsDiscover.svelte'; +/** Suggested catalog models, a horizontal row of cards above the installed models. */ +export { default as ModelsDiscoverCarousel } from './ModelsDiscoverCarousel.svelte'; + +/** One Hub repo as a card: the carousel's, and the grid view's search results. */ +export { default as ModelsDiscoverCard } from './ModelsDiscoverCard.svelte'; export * from './ModelsDiscoverList'; export * from './ModelsDiscoverDetails'; 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 c49b09ed5f9f..57af8de0a107 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 @@ -4,7 +4,6 @@ ActionIcon, DialogConversationDelete, DialogConversationRename, - DialogDiscoverModels, DialogGroup, DialogGroupPicker, DialogProject, @@ -18,6 +17,7 @@ SidebarNavigationConversationList, SidebarNavigationFooter } from '#lib/components/app/index.ts'; + import { ModelsDiscoverDetailsDrawer } from '#lib/components/app/models/discover/index.ts'; import { ROUTES, SIDEBAR_ACTIONS_ITEMS, @@ -802,7 +802,7 @@ {/if} {/each} - + diff --git a/ui/apps/chat/src/lib/constants/models-discover.constants.ts b/ui/apps/chat/src/lib/constants/models-discover.constants.ts index b0a0abc568d7..b1687112aefc 100644 --- a/ui/apps/chat/src/lib/constants/models-discover.constants.ts +++ b/ui/apps/chat/src/lib/constants/models-discover.constants.ts @@ -1,7 +1,7 @@ /** * Models discover constants. * - * Endpoints and settings for the Models Discover dialog. + * Endpoints and settings for browsing Hugging Face models on the models page. */ /** llama.app model catalog used as the default model list. Online-only source; the discover feature requires an internet connection anyway. */ @@ -12,3 +12,6 @@ export const MODELS_DISCOVER_CATALOG_URL = 'https://llama.app/v1/catalog.json'; * is not hit with the whole catalog at once. */ export const MODELS_DISCOVER_CATALOG_BATCH = 4; + +/** Quiet time after the last keystroke before the models page searches the Hub. */ +export const MODELS_DISCOVER_SEARCH_DEBOUNCE_MS = 300; diff --git a/ui/apps/chat/src/lib/constants/settings.constants.ts b/ui/apps/chat/src/lib/constants/settings.constants.ts index ebd784129840..9977e1de9bd8 100644 --- a/ui/apps/chat/src/lib/constants/settings.constants.ts +++ b/ui/apps/chat/src/lib/constants/settings.constants.ts @@ -166,7 +166,7 @@ export const SETTINGS_REGISTRY: SettingsSectionEntry[] = [ }, { defaultValue: false, - help: 'Show Discover Models on the Models page, to browse and download HuggingFace GGUF models. Turns Models and the Hugging Face Hub API on while it is enabled. Only available in router mode.', + help: 'Show suggested models and Hugging Face search results on the models page, to browse and download HuggingFace GGUF models. Turns Models and the Hugging Face Hub API on while it is enabled. Only available in router mode.', key: SETTINGS_KEYS.ENABLE_DISCOVER_MODELS, label: 'Enable Discover Models', type: SettingsFieldType.CHECKBOX diff --git a/ui/apps/chat/src/lib/constants/storage.constants.ts b/ui/apps/chat/src/lib/constants/storage.constants.ts index 31cd6d0b9f04..093eb6389b6e 100644 --- a/ui/apps/chat/src/lib/constants/storage.constants.ts +++ b/ui/apps/chat/src/lib/constants/storage.constants.ts @@ -56,6 +56,7 @@ export const REASONING_EFFORT_DEFAULT_LOCALSTORAGE_KEY = `${STORAGE_APP_NAME}.re export const SIDEBAR_SECTION_ORDER_LOCALSTORAGE_KEY = `${STORAGE_APP_NAME}.sidebarSectionOrder`; export const SIDEBAR_COLLAPSED_SECTIONS_LOCALSTORAGE_KEY = `${STORAGE_APP_NAME}.sidebarCollapsedSections`; export const CONVERSATION_TABS_LOCALSTORAGE_KEY = `${STORAGE_APP_NAME}.conversationTabs`; +export const MODELS_VIEW_MODE_LOCALSTORAGE_KEY = `${STORAGE_APP_NAME}.modelsViewMode`; export const SIDEBAR_EXPANDED_LOCALSTORAGE_KEY = `${STORAGE_APP_NAME}.sidebarExpanded`; export const SIDEBAR_WIDTH_LOCALSTORAGE_KEY = `${STORAGE_APP_NAME}.sidebarWidth`; export const USER_OVERRIDES_LOCALSTORAGE_KEY = `${STORAGE_APP_NAME}.userOverrides`; diff --git a/ui/apps/chat/src/lib/enums/index.ts b/ui/apps/chat/src/lib/enums/index.ts index baba49379eb0..86f6d957cdc3 100644 --- a/ui/apps/chat/src/lib/enums/index.ts +++ b/ui/apps/chat/src/lib/enums/index.ts @@ -87,7 +87,8 @@ export { ModelRowDownloadState, ModelsTableGroupKind, ModelsTableServerKind, - ModelsTableSortKey + ModelsTableSortKey, + ModelsViewMode } from './model.enums'; export { diff --git a/ui/apps/chat/src/lib/enums/model.enums.ts b/ui/apps/chat/src/lib/enums/model.enums.ts index faceb6e5fe72..33beb908837f 100644 --- a/ui/apps/chat/src/lib/enums/model.enums.ts +++ b/ui/apps/chat/src/lib/enums/model.enums.ts @@ -74,3 +74,9 @@ export enum ModelsTableServerKind { COMPAT = 'compat', SERVER = 'server' } + +/** How the models manager lays out the installed models. */ +export enum ModelsViewMode { + GRID = 'grid', + TABLE = 'table' +} diff --git a/ui/apps/chat/src/lib/hooks/use-hub-model-summary.svelte.ts b/ui/apps/chat/src/lib/hooks/use-hub-model-summary.svelte.ts new file mode 100644 index 000000000000..14903f2c3de3 --- /dev/null +++ b/ui/apps/chat/src/lib/hooks/use-hub-model-summary.svelte.ts @@ -0,0 +1,140 @@ +import { HF_MMPROJ_FILENAME_TOKEN, MODEL_ID } from '#lib/constants/index.ts'; +import { ModelDraftSidecar } from '#lib/enums/index.ts'; +import { HuggingFaceService } from '#lib/services/index.ts'; +import { modelsDiscoverStore } from '#lib/stores/index.ts'; +import type { ModelsDiscoverSizeRange } from '#lib/stores/models-discover/index.svelte.ts'; +import type { HfModelInfo, HfModelSiblingRef } from '#lib/types/huggingface.js'; +import type { ModelModalities } from '#lib/types/models.js'; +import { + detectThinkingSupport, + detectToolUseSupport, + directoryOf, + isDraftSidecar, + isServerSidecarFile, + orgOf +} from '#lib/utils/index.ts'; +import { SvelteSet } from 'svelte/reactivity'; + +/** + * True when a file of the weights sits in the draft's directory: the server + * resolves a sidecar against the model file beside it, never across directories. + */ +function hasWeightsBeside(siblings: HfModelSiblingRef[], draftPath: string): boolean { + const directory = directoryOf(draftPath); + + return siblings.some( + (sibling) => + MODEL_ID.WEIGHT_EXTENSION_REGEX.test(sibling.rfilename) && + directoryOf(sibling.rfilename) === directory && + !HuggingFaceService.extractQuantMeta(sibling.rfilename)?.sidecar + ); +} + +/** + * What a Hub row or card shows of one repo record: avatar orgs, context, capabilities, + * modalities, draft kinds and size range. Shared so every Hub surface reads a record + * the same way; a repo the catalog did not measure is measured once here. + */ +export function useHubModelSummary( + getModel: () => HfModelInfo, + /** Show the original (base) model's org avatar instead of the repo's org. */ + getShowBaseModelAvatar: () => boolean = () => false +) { + const org = $derived(orgOf(getModel().id)); + // the base model's org when asked (e.g. the Qwen logo for ggml-org/Qwen3.8-27B-GGUF), + // else the repo's org + const avatarOrg = $derived.by(() => { + if (!getShowBaseModelAvatar()) return org; + + return orgOf(HuggingFaceService.getBaseModels(getModel())[0]) || org; + }); + const contextLength = $derived(getModel().gguf?.context_length); + // Reasoning support from the chat template, matching the details view. + const supportsThinking = $derived(detectThinkingSupport(getModel().gguf?.chat_template ?? '')); + const supportsToolUse = $derived(detectToolUseSupport(getModel().gguf?.chat_template ?? '')); + const mmprojPath = $derived( + getModel().siblings?.find((s) => s.rfilename.toLowerCase().includes(HF_MMPROJ_FILENAME_TOKEN)) + ?.rfilename + ); + // Modalities derived from HF metadata: the pipeline tag and the mmproj. + const modalities = $derived( + HuggingFaceService.getModalities(getModel().id, getModel().pipeline_tag, mmprojPath) + ); + + // the mmproj's header says whether it also hears; read once per repo + $effect(() => { + if (mmprojPath) void HuggingFaceService.getMmprojEncoders(getModel().id, mmprojPath); + }); + // Draft sidecars (mtp, dflash, dspark, eagle3) the repo offers, badged with no + // quant: the list does not know how the server configures them. Only the drafts + // the server can actually pull are shown, so a badge never outlives the file + // find_best_sibling would resolve. + const draftKinds = $derived.by(() => { + const siblings = getModel().siblings ?? []; + const kinds = new SvelteSet(); + + for (const sibling of siblings) { + const sidecar = HuggingFaceService.extractQuantMeta(sibling.rfilename)?.sidecar; + + if (!sidecar || !isDraftSidecar(sidecar)) continue; + + if (!isServerSidecarFile(sibling.rfilename, sidecar)) continue; + + if (!hasWeightsBeside(siblings, sibling.rfilename)) continue; + + kinds.add(sidecar); + } + + return Object.values(ModelDraftSidecar).filter((kind) => kinds.has(kind)); + }); + + // Min/max size across the repo's quants, draft sidecars included. The store + // has catalog repos covered already; any other one (a search hit) is measured + // once and the result is cached per repo. + let measuredSize = $state(null); + + const sizeRange = $derived(modelsDiscoverStore.cachedSizeRangeFor(getModel().id) ?? measuredSize); + + $effect(() => { + const id = getModel().id; + + if (modelsDiscoverStore.cachedSizeRangeFor(id)) return; + + let cancelled = false; + + void modelsDiscoverStore.sizeRange(id).then((range) => { + if (!cancelled) measuredSize = range ?? null; + }); + + return () => { + cancelled = true; + }; + }); + + return { + get avatarOrg() { + return avatarOrg; + }, + get contextLength() { + return contextLength; + }, + get draftKinds() { + return draftKinds; + }, + get modalities() { + return modalities; + }, + get org() { + return org; + }, + get sizeRange() { + return sizeRange; + }, + get supportsThinking() { + return supportsThinking; + }, + get supportsToolUse() { + return supportsToolUse; + } + }; +} diff --git a/ui/apps/chat/src/lib/stores/models-discover/index.svelte.ts b/ui/apps/chat/src/lib/stores/models-discover/index.svelte.ts index c7acb104c2b9..906e05697033 100644 --- a/ui/apps/chat/src/lib/stores/models-discover/index.svelte.ts +++ b/ui/apps/chat/src/lib/stores/models-discover/index.svelte.ts @@ -1,9 +1,10 @@ /** * modelsDiscoverStore - Models Discover browse state * - * Owns the HuggingFace GGUF list shown in the discover sidebar. The default list is - * the curated catalog set; a search replaces it with matches across all of HuggingFace. - * Both paths fetch the same fields, so a row renders the same either way. + * Owns the HuggingFace GGUF lists shown on the models page: the curated catalog set the + * suggestions carousel shows, and the matches a search finds across all of HuggingFace. + * The two are kept apart so a search never hides the suggestions. Both paths fetch the + * same fields, so a card or row renders the same either way. */ import { MODELS_DISCOVER_CATALOG_BATCH } from '#lib/constants/index.ts'; @@ -24,19 +25,24 @@ export interface ModelsDiscoverSizeRange { } class ModelsDiscoverStore { + /** Error of the catalog fetch. */ error = $state(null); - models = $state([]); - /** First model in the list - discover auto-opens this one. */ - firstModel = $derived(this.models[0] ?? null); - loading = $state(false); + /** Trimmed query the search results answer; empty while no search runs. */ + query = $state(''); + /** Error of the newest search. */ + searchError = $state(null); /** True while a search is in flight; only the newest request owns this flag. */ searching = $state(false); + /** Matches of the newest search. */ + searchResults = $state([]); + /** Curated catalog repos, filled batch by batch as they land. */ + suggested = $state([]); + private catalog: HfCatalogEntry[] = []; /** Repo id -> size range, for catalog rows and lazily measured search rows. */ private catalogSizeRanges = new SvelteMap(); - private defaultModels: HfModelInfo[] = []; private fetched = false; private searchRequestId = 0; /** In-flight `sizeRange()` lookups, keyed by repo id. */ @@ -50,15 +56,20 @@ class ModelsDiscoverStore { return this.catalogSizeRanges.get(modelId); } - /** Catalog family description; undefined for a repo outside the curated catalog. */ + /** + * Catalog family description, emphasis markers dropped since every surface renders it + * as plain text; undefined for a repo outside the curated catalog. + */ descriptionFor(modelId: string): string | undefined { - return this.catalog.find((entry) => - entry.sizes.some((size) => size.builds.some((build) => build.repo === modelId)) - )?.description; + return this.catalog + .find((entry) => + entry.sizes.some((size) => size.builds.some((build) => build.repo === modelId)) + ) + ?.description?.replace(/(\*\*|__)(.+?)\1/g, '$2'); } /** - * Fill the list from the llama.app catalog, one repo per catalog size. Every repo + * Fill the suggestions from the llama.app catalog, one repo per catalog size. Every repo * is fetched with its file tree, so a catalog row carries the same data a search * result does. No-op when already loaded or in flight. */ @@ -75,8 +86,7 @@ class ModelsDiscoverStore { const builds = this.catalogBuilds(); const failedBuilds: HfCatalogBuild[] = []; - - this.defaultModels = []; + const suggested: HfModelInfo[] = []; // fetch in small batches: not every repo hits the HF API at once, // and the rows land as they arrive instead of all at the end @@ -102,13 +112,11 @@ class ModelsDiscoverStore { this.catalogSizeRanges.set(build.repo, this.sizeRangeFor(build, tree)); // the catalog repo id, not the HF response `id`, drives selection - this.defaultModels.push({ ...info, id: build.repo, modelId: build.repo }); + suggested.push({ ...info, id: build.repo, modelId: build.repo }); } - // show what has landed, unless a search owns the list right now - if (!this.searching) { - this.models = [...this.defaultModels]; - } + // show what has landed + this.suggested = [...suggested]; } // stay incomplete when some repos failed, so the next mount retries @@ -121,15 +129,17 @@ class ModelsDiscoverStore { } } - /** Replace the list with search results; an empty query restores the default list. */ + /** Search all of HuggingFace; an empty query clears the results. */ async search(query: string): Promise { const trimmed = query.trim(); const requestId = ++this.searchRequestId; + this.query = trimmed; + if (!trimmed) { this.searching = false; - this.models = this.defaultModels; - this.error = null; + this.searchResults = []; + this.searchError = null; return; } @@ -141,12 +151,13 @@ class ModelsDiscoverStore { if (requestId !== this.searchRequestId) return; - this.models = this.baseOrgFirst(results); - this.error = null; + this.searchResults = this.baseOrgFirst(results); + this.searchError = null; } catch (err) { if (requestId !== this.searchRequestId) return; - this.error = err instanceof Error ? err.message : 'Search failed'; + this.searchResults = []; + this.searchError = err instanceof Error ? err.message : 'Search failed'; } finally { if (requestId === this.searchRequestId) this.searching = false; } diff --git a/ui/apps/chat/src/lib/stores/ui.svelte.ts b/ui/apps/chat/src/lib/stores/ui.svelte.ts index 62f702cba6f0..49563d2667ef 100644 --- a/ui/apps/chat/src/lib/stores/ui.svelte.ts +++ b/ui/apps/chat/src/lib/stores/ui.svelte.ts @@ -6,6 +6,7 @@ * controls and the chat tab bar reacts to). */ import { + MODELS_VIEW_MODE_LOCALSTORAGE_KEY, ROUTES, SETTINGS_KEYS, SIDEBAR_COLLAPSED_SECTIONS_LOCALSTORAGE_KEY, @@ -15,7 +16,7 @@ import { SIDEBAR_SECTION_ORDER_LOCALSTORAGE_KEY, SIDEBAR_WIDTH_LOCALSTORAGE_KEY } from '#lib/constants/index.ts'; -import { SidebarAction } from '#lib/enums/index.ts'; +import { ModelsViewMode, SidebarAction } from '#lib/enums/index.ts'; import { deviceStore } from '#lib/stores/device.svelte.ts'; import { settingsStore } from '#lib/stores/settings/index.svelte.ts'; import type { Group } from '#lib/types/groups.js'; @@ -89,12 +90,6 @@ class UiStore { /** Set when a flow outside the chat wants the composer focused once it can take it. */ composerFocusRequested = $state(false); - /** Repo the Discover dialog selects when it opens, set by a model row. */ - discoverModelFocus = $state(null); - - /** Open state of the Discover dialog. */ - discoverModelsOpen = $state(false); - /** Sidebar sections showing all their chats past the preview, for this session. */ expandedSidebarSections = new SvelteSet(); @@ -104,6 +99,9 @@ class UiStore { /** Open state of the group picker, a phone's stand-in for the group submenus. */ groupPicker = $state(null); + /** Hugging Face repo the Hub details drawer shows, e.g. `ggml-org/gemma-3-4b-it-GGUF`. */ + hubModelFocus = $state(null); + /** Whether the main chat form is expanded into its large editor. */ isComposerExpanded = $state(false); @@ -117,6 +115,8 @@ class UiStore { modelsReturnRoute: ResolvedPathname = resolve(ROUTES.START); /** Bumped to close every open models selector; a counter, so no selector has to reset it. */ modelsSelectorCloseSignal = $state(0); + /** Table or grid of cards on the models page; remembered across reloads. */ + modelsViewMode = $state(this.loadModelsViewMode()); /** Open state of the project dialog, `null` while closed. */ projectDialog = $state(null); /** Open state of the project picker, a phone's stand-in for the project submenus. */ @@ -135,6 +135,11 @@ class UiStore { return Boolean(settingsStore.getConfig(SETTINGS_KEYS.ENABLE_DISCOVER_MODELS)); } + /** Whether the Hub details drawer is open. */ + get isHubModelDetailsOpen(): boolean { + return this.hubModelFocus !== null; + } + /** * Whether MCP shows in the sidebar. Off by default: most people have never heard of MCP, * so it waits behind its setting. Hiding it only hides the entry point: servers already @@ -177,6 +182,11 @@ class UiStore { localStorage.setItem(SIDEBAR_EXPANDED_LOCALSTORAGE_KEY, String(expanded)); } + /** Close the Hub details drawer. */ + closeHubModelDetails(): void { + this.hubModelFocus = null; + } + /** Close the model details drawer. */ closeModelDetails(): void { this.modelDetailsFocus = null; @@ -233,19 +243,23 @@ class UiStore { this.groupPicker = options; } + /** + * Open the Hub details drawer on one repo; a no-op while Discover is off. The two + * details drawers never stack, so the model details drawer steps aside. + */ + openHubModelDetails(repo: string): void { + if (!this.isDiscoverEnabled) return; + + this.modelDetailsFocus = null; + this.hubModelFocus = repo; + } + /** Open the model details drawer over the current page, without leaving it. */ openModelDetails(focus: string): void { + this.hubModelFocus = null; this.modelDetailsFocus = focus; } - /** Open the Discover dialog, focused on one repo; a no-op while Discover is off. */ - openModelsDiscover(focus?: string): void { - if (!this.isDiscoverEnabled) return; - - this.discoverModelFocus = focus ?? null; - this.discoverModelsOpen = true; - } - /** Navigate to the models manager; a no-op while it is hidden. */ openModelsManager(): void { if (!this.isModelsManagerShown || this.isModelsPageOpen) return; @@ -316,6 +330,13 @@ class UiStore { this.composerFocusRequested = true; } + /** Lay the models page out as a table or a grid of cards. */ + setModelsViewMode(mode: ModelsViewMode): void { + this.modelsViewMode = mode; + + if (browser) localStorage.setItem(MODELS_VIEW_MODE_LOCALSTORAGE_KEY, mode); + } + /** * Remembers the order the user dragged the sections into. * @@ -378,6 +399,14 @@ class UiStore { } } + private loadModelsViewMode(): ModelsViewMode { + if (!browser) return ModelsViewMode.TABLE; + + const saved = localStorage.getItem(MODELS_VIEW_MODE_LOCALSTORAGE_KEY); + + return saved === ModelsViewMode.GRID ? ModelsViewMode.GRID : ModelsViewMode.TABLE; + } + private loadSidebarExpanded(): boolean { if (!browser || deviceStore.isMobile) return false; diff --git a/ui/apps/chat/src/routes/models/+page.svelte b/ui/apps/chat/src/routes/models/+page.svelte index 0a4e3643a3ad..a1cf9f1197b2 100644 --- a/ui/apps/chat/src/routes/models/+page.svelte +++ b/ui/apps/chat/src/routes/models/+page.svelte @@ -3,8 +3,8 @@ import { ArrowLeft, Server } from '@lucide/svelte'; import ModelsManager from '#lib/components/app/models/ModelsManager/ModelsManager.svelte'; import ModelsManagerServers from '#lib/components/app/models/ModelsManager/ModelsManagerServers.svelte'; - import { APP_NAME, DISCOVER_ICON } from '#lib/constants/index.ts'; - import { modelsStore, uiStore } from '#lib/stores/index.ts'; + import { APP_NAME } from '#lib/constants/index.ts'; + import { modelsStore } from '#lib/stores/index.ts'; import { onMount } from 'svelte'; // the manager's second view: the servers its models come from @@ -58,19 +58,6 @@ {#if !showServers}
    - {#if uiStore.isDiscoverEnabled} - - {/if} - + + {#if actions} +
    + {@render actions()} +
    + {/if} +
    + + {@render children?.()} + + {#if footer || footerEnd} +
    +
    + {@render footer?.()} +
    + + {#if footerEnd} +
    + {@render footerEnd()} +
    + {/if} +
    + {/if} + + {@render overlay?.()} + diff --git a/ui/apps/chat/src/lib/components/app/models/ModelCardSkeleton.svelte b/ui/apps/chat/src/lib/components/app/models/ModelCardSkeleton.svelte new file mode 100644 index 000000000000..51976422e22e --- /dev/null +++ b/ui/apps/chat/src/lib/components/app/models/ModelCardSkeleton.svelte @@ -0,0 +1,45 @@ + + + + +
    + + +
    + + + +
    +
    + +
    + + + +
    + + {#if description} +
    + + + +
    + {/if} + +
    + + + +
    +
    diff --git a/ui/apps/chat/src/lib/components/app/models/ModelContext.svelte b/ui/apps/chat/src/lib/components/app/models/ModelContext.svelte index 1dcbbaa7ea34..5b8f0c20bd83 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelContext.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelContext.svelte @@ -1,5 +1,6 @@ - - - -
    { - if (!isRowControlClick(event)) activate(); - }} + onSelect(option)} + pressed={download ? undefined : selected} + {selected} + tooltip={option.model} > -
    - - + {#if favorite} + +
    + {/snippet} + + {#if sidecarBadges?.length}
    @@ -107,28 +101,21 @@
    {/if} -
    - - - {#if favorite} - -
    - -
    - + {#snippet footer()} + + {/snippet} + {#snippet footerEnd()} -
    + {/snippet} - {#if download} - - {/if} -
    + {#snippet overlay()} + {#if download} + + {/if} + {/snippet} + diff --git a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfigurationHeader.svelte b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfigurationHeader.svelte index 2f284eab6578..0b216d70e862 100644 --- a/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfigurationHeader.svelte +++ b/ui/apps/chat/src/lib/components/app/models/ModelsManager/ModelsManagerModelConfiguration/ModelsManagerModelConfigurationHeader.svelte @@ -3,10 +3,10 @@ import { Badge } from '@ggml-org/llama-ui/ui/badge'; import { Button } from '@ggml-org/llama-ui/ui/button'; import { Server, X } from '@lucide/svelte'; - import { Logo, ModelAvatar, ModelId } from '#lib/components/app/index.ts'; + import { Logo, ModelAvatar, ModelCapabilities, ModelId } from '#lib/components/app/index.ts'; import { ServerIcon } from '#lib/components/app/servers/index.ts'; import { LOCAL_BACKEND_ID } from '#lib/constants/index.ts'; - import { ModelCapability, ServerModelStatus } from '#lib/enums/index.ts'; + import { ServerModelStatus } from '#lib/enums/index.ts'; import { deviceStore } from '#lib/stores/index.ts'; import type { ModelOption } from '#lib/types/models.js'; import { getServer } from '#lib/utils/api-base.ts'; @@ -44,8 +44,6 @@ option, status }: Props = $props(); - let supportsToolUse = $derived(option.capabilities.includes(ModelCapability.TOOL_USE)); - let supportsThinking = $derived(option.capabilities.includes(ModelCapability.REASONING)); let server = $derived(getServer(option.serverId)); let serverName = $derived(server?.name ?? null); @@ -100,14 +98,15 @@
    + @@ -159,6 +158,9 @@ {/if}
    + + + {#if !isMobile} +
    {#each cards.slice(0, shown) as entry (entry.key)} + import ModelCard from '../ModelCard.svelte'; import ModelId from '../ModelId.svelte'; import ModelOrgAvatar from '../ModelOrgAvatar.svelte'; + import { ModelCapabilityIcons } from '@ggml-org/llama-ui/models'; + import { Database, Download, ScrollText } from '@lucide/svelte'; import { useHubModelSummary } from '#lib/hooks/use-hub-model-summary.svelte.ts'; + import { HuggingFaceService } from '#lib/services/index.ts'; import { modelsDiscoverStore } from '#lib/stores/index.ts'; import type { HfModelInfo } from '#lib/types/huggingface.js'; + import { formatParameters } from '#lib/utils/index.ts'; interface Props { model: HfModelInfo; @@ -14,7 +19,7 @@ let { active = false, class: className = '', model, onSelect }: Props = $props(); - // the card names the model the repo quantizes, the way the list does + // the card names the model the repo quantizes, the way the details pane does const summary = useHubModelSummary( () => model, () => true @@ -23,37 +28,68 @@ let description = $derived(modelsDiscoverStore.descriptionFor(model.id)); - + + + {#snippet footer()} + + {#if summary.sizeRange} + + + + {HuggingFaceService.formatSizeRange(summary.sizeRange.min, summary.sizeRange.max)} + + {/if} + + {#if summary.contextLength} + + + + {formatParameters(summary.contextLength)} + + {/if} + + {/snippet} + + {#snippet footerEnd()} + + + + {HuggingFaceService.formatDownloads(model.downloads)} + + {/snippet} + diff --git a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverCarousel.svelte b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverCarousel.svelte index 3e4e84e9943e..79934b3bfd99 100644 --- a/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverCarousel.svelte +++ b/ui/apps/chat/src/lib/components/app/models/discover/ModelsDiscoverCarousel.svelte @@ -1,15 +1,15 @@ {#snippet icon()} - + {/snippet} -