mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-09-17 20:31:47 +02:00
ui : move the discover models entry to the sidebar
Replace the selector dropdown footer entry with a sidebar action that opens the discover dialog. Assisted-by: pi:zai-org/GLM-5.3
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
<script lang="ts">
|
||||
import ModelLoadHighlight from './ModelLoadHighlight.svelte';
|
||||
import { ChevronDown, Lightbulb, Loader2, PackageSearch } from '@lucide/svelte';
|
||||
import { ChevronDown, Lightbulb, Loader2 } from '@lucide/svelte';
|
||||
import {
|
||||
DialogModelInformation,
|
||||
DialogModelsDiscover,
|
||||
DropdownMenuSearchable,
|
||||
ModelId,
|
||||
ModelsSelectorList,
|
||||
@@ -40,7 +39,6 @@
|
||||
|
||||
let isOpen = $state(false);
|
||||
let highlightedId = $state<string | null>(null);
|
||||
let modelsHubOpen = $state(false);
|
||||
|
||||
const ms = useModelsSelector({
|
||||
currentModel: () => currentModel,
|
||||
@@ -329,19 +327,11 @@
|
||||
</div>
|
||||
|
||||
{#snippet footer()}
|
||||
<!-- Sticky actions footer: reasoning effort panel and discover
|
||||
models. Sticks to the bottom of the content scrollport. -->
|
||||
<!-- Sticky actions footer: reasoning effort panel.
|
||||
Sticks to the bottom of the content scrollport. -->
|
||||
<div onfocusin={clearHighlight} onmouseenter={clearHighlight} role="none">
|
||||
<ModelsSelectorReasoningPanel />
|
||||
|
||||
<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>
|
||||
</div>
|
||||
{/snippet}
|
||||
</DropdownMenuSearchable>
|
||||
@@ -408,5 +398,3 @@
|
||||
open={ms.showModelDialog}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<DialogModelsDiscover bind:open={modelsHubOpen} />
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
|
||||
{#if footer}
|
||||
<!-- Sticks to the bottom of the dropdown content's scrollport. -->
|
||||
<div class="sticky bottom-0 z-20 bg-popover px-1 pb-2">
|
||||
<div class="-mx-1 mb-1 h-px bg-border/20"></div>
|
||||
<div class="sticky bottom-0 z-20 bg-popover py-1.5">
|
||||
<div class="h-px bg-border/20 mb-1.5 mx-1.5"></div>
|
||||
|
||||
{@render footer()}
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import {
|
||||
ActionIcon,
|
||||
DialogConversationRename,
|
||||
DialogModelsDiscover,
|
||||
DialogSettingsChat,
|
||||
Logo,
|
||||
SidebarNavigationActions,
|
||||
@@ -93,6 +94,7 @@
|
||||
|
||||
let renameDialogOpen = $state(false);
|
||||
let settingsDialogOpen = $state(false);
|
||||
let modelsHubOpen = $state(false);
|
||||
let renameTargetConversationId = $state<string | null>(null);
|
||||
let renameDraft = $state('');
|
||||
let renameOriginalTitle = $state('');
|
||||
@@ -402,6 +404,7 @@
|
||||
isSearchModeActive = false;
|
||||
searchQuery = '';
|
||||
}}
|
||||
onDiscoverModelsClick={() => (modelsHubOpen = true)}
|
||||
onSettingsClick={() => (settingsDialogOpen = true)}
|
||||
/>
|
||||
|
||||
@@ -452,6 +455,8 @@
|
||||
|
||||
<DialogSettingsChat bind:open={settingsDialogOpen} />
|
||||
|
||||
<DialogModelsDiscover bind:open={modelsHubOpen} />
|
||||
|
||||
<style>
|
||||
aside {
|
||||
@media (max-width: 768px) {
|
||||
|
||||
+26
-20
@@ -26,6 +26,7 @@
|
||||
onSearchDeactivated?: () => void;
|
||||
onSearchClick?: () => void;
|
||||
onNewChat?: () => void;
|
||||
onDiscoverModelsClick?: () => void;
|
||||
onSettingsClick?: () => void;
|
||||
}
|
||||
|
||||
@@ -34,6 +35,7 @@
|
||||
isExpandedMode = false,
|
||||
isSearchModeActive = $bindable(false),
|
||||
onNewChat,
|
||||
onDiscoverModelsClick,
|
||||
onSearchClick,
|
||||
onSearchDeactivated,
|
||||
onSettingsClick,
|
||||
@@ -117,16 +119,18 @@
|
||||
onNewChat?.();
|
||||
void conversationsStore.openNewChat();
|
||||
}
|
||||
: item.action === SidebarAction.SETTINGS
|
||||
? () => onSettingsClick?.()
|
||||
: item.route
|
||||
? () => {
|
||||
onNewChat?.();
|
||||
goto(item.route!);
|
||||
}
|
||||
: isSearchOnMobile
|
||||
? undefined
|
||||
: onSearchClick}
|
||||
: item.action === SidebarAction.DISCOVER_MODELS
|
||||
? () => onDiscoverModelsClick?.()
|
||||
: item.action === SidebarAction.SETTINGS
|
||||
? () => onSettingsClick?.()
|
||||
: item.route
|
||||
? () => {
|
||||
onNewChat?.();
|
||||
goto(item.route!);
|
||||
}
|
||||
: isSearchOnMobile
|
||||
? undefined
|
||||
: onSearchClick}
|
||||
{@const itemTransition = {
|
||||
delay: !initialized ? i * ICON_STRIP_TRANSITION_DELAY_MULTIPLIER : 0,
|
||||
duration: ICON_STRIP_TRANSITION_DURATION,
|
||||
@@ -173,16 +177,18 @@
|
||||
onNewChat?.();
|
||||
void conversationsStore.openNewChat();
|
||||
}
|
||||
: item.action === SidebarAction.SETTINGS
|
||||
? () => onSettingsClick?.()
|
||||
: item.route
|
||||
? () => {
|
||||
onNewChat?.();
|
||||
goto(item.route!);
|
||||
}
|
||||
: isSearchOnMobile
|
||||
? undefined
|
||||
: onSearchClick}
|
||||
: item.action === SidebarAction.DISCOVER_MODELS
|
||||
? () => onDiscoverModelsClick?.()
|
||||
: item.action === SidebarAction.SETTINGS
|
||||
? () => onSettingsClick?.()
|
||||
: item.route
|
||||
? () => {
|
||||
onNewChat?.();
|
||||
goto(item.route!);
|
||||
}
|
||||
: isSearchOnMobile
|
||||
? undefined
|
||||
: onSearchClick}
|
||||
{@const itemTransition = {
|
||||
delay: !initialized ? i * ICON_STRIP_TRANSITION_DELAY_MULTIPLIER : 0,
|
||||
duration: ICON_STRIP_TRANSITION_DURATION,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Package, Search, Settings, SquarePen } from '@lucide/svelte';
|
||||
import { Package, PackageSearch, Search, Settings, SquarePen } from '@lucide/svelte';
|
||||
import { SidebarAction, ToolSource } from '$lib/enums';
|
||||
import type { DesktopIconStripItem } from '$lib/types';
|
||||
|
||||
@@ -64,6 +64,11 @@ export const SIDEBAR_ACTIONS_ITEMS: DesktopIconStripItem[] = [
|
||||
tooltip: 'New chat'
|
||||
},
|
||||
{ icon: Search, keys: ['cmd', 'k'], tooltip: 'Search' },
|
||||
{
|
||||
action: SidebarAction.DISCOVER_MODELS,
|
||||
icon: PackageSearch,
|
||||
tooltip: 'Discover models'
|
||||
},
|
||||
{
|
||||
action: SidebarAction.SETTINGS,
|
||||
icon: Settings,
|
||||
|
||||
@@ -24,6 +24,7 @@ export enum ScrollCarouselVariant {
|
||||
*/
|
||||
export enum SidebarAction {
|
||||
NEW_CHAT = 'new-chat',
|
||||
DISCOVER_MODELS = 'discover-models',
|
||||
SETTINGS = 'settings'
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user