ui : add a Discover models trigger to the model selector

Add a Discover models item to the selector dropdown footer that opens
the DialogModelsDiscover dialog.

Assisted-by: pi
This commit is contained in:
Aleksander Grygier
2026-09-04 20:07:36 +02:00
parent b5d4ab37c5
commit bd2a47e27f
3 changed files with 18 additions and 3 deletions
@@ -1,10 +1,11 @@
<script lang="ts">
import ModelLoadHighlight from './ModelLoadHighlight.svelte';
import type { ModelItem } from './utils';
import { ChevronDown, Lightbulb, Loader2 } from '@lucide/svelte';
import { ChevronDown, Lightbulb, Loader2, PackageSearch } from '@lucide/svelte';
import {
ChatFormActionAddReasoningSubmenu,
DialogModelInformation,
DialogModelsDiscover,
DropdownMenuSearchable,
ModelId,
ModelsSelectorList,
@@ -39,6 +40,7 @@
let isOpen = $state(false);
let highlightedId = $state<string | null>(null);
let modelsHubOpen = $state(false);
// The model submenu opens together with the menu so the list and its search
// box are immediately available, as before the submenu was introduced
let modelSubOpen = $state(false);
@@ -352,6 +354,17 @@
</DropdownMenu.Sub>
<ChatFormActionAddReasoningSubmenu />
<DropdownMenu.Separator />
<DropdownMenu.Item
class="flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-1.75 text-left text-sm transition-colors hover:bg-accent"
onclick={() => (modelsHubOpen = true)}
>
<PackageSearch class="h-4 w-4 shrink-0 text-muted-foreground" />
<span>Discover models</span>
</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Root>
{:else}
@@ -415,3 +428,5 @@
open={ms.showModelDialog}
/>
{/if}
<DialogModelsDiscover bind:open={modelsHubOpen} />
@@ -44,10 +44,10 @@ import type { ModelDownloadProgress } from '$lib/types';
if (getDownloadState) return getDownloadState(repoWithTag, filePath, isSidecar);
return {
isDownloading: modelsStore.status.isDownloadInProgress(repoWithTag),
isDownloaded: isSidecar
? modelsStore.status.isDraftDownloaded(modelId, filePath)
: modelsStore.status.isModelDownloaded(repoWithTag),
isDownloading: modelsStore.status.isDownloadInProgress(repoWithTag),
isFailed: modelsStore.status.hasFailedDownload(repoWithTag),
progress: modelsStore.status.getDownloadProgress(repoWithTag)
};
@@ -77,11 +77,11 @@
<DialogModelDownload
filePath="Q4_K_M/gemma-4-12b-it-Q4_K_M.gguf"
formattedSize="7.3 GB"
onClose={() => {}}
open
quant="Q4_K_M"
repoId="ggml-org/gemma-4-12b-it-GGUF"
sidecar={null}
onClose={() => {}}
/>
</div>
</Story>