* ui : add the drawer, sheet and grouped list primitives Add the drawer and sheet overlay components, the toggle and toggle group, the shared searchable input, the collapsible sections and the grouped list, and the near viewport helper they position with. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : add the shared model components and data layer Add the model row pieces shared by the selector and the manager, the models store with its download status feed, the huggingface and migration services, and the model utils, enums and constants they read through. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : rework the models selector around its providers Group the selector components under their own folder, rework the list around the provider grouping, add the mobile trigger and the download item, and derive the selection state in one hook. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : add the models manager Add the manager table with its repo, quant and status rows, the filters and the toolbar, the row actions in a drawer, the downloads section, the manage models dialog and the stories and tests. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : rework the chat form actions and the mobile experience Move the add actions into a drawer and a sheet, float the model actions in a bar on a phone, open the context panel in a drawer, and derive the attachment, reasoning and tools menus in hooks. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : move the mcp servers to the sidebar rail and tidy the dialogs Move the mcp servers dialog to the sidebar rail with its menu entries, even out the dialogs on a phone, and group the mcp and settings stores behind their own modules. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : polish the shell The secondary button gets its own look back and the chat add button its own light surface. Pressable elements get a pointer cursor again, the font rendering smooths on the app shell, and the agent skills stay out of prettier's way. The root layout props probe rework that came with this polish reads the providers api url and stays with the providers change instead. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : wrap the model id classes Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * ui : load the model the new chat CTA picks Start a new chat selected the model but left it unloaded, so the chat opened against a server with nothing in memory. Both CTAs share a load helper now. Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash * refactor: Post-review fixes
105 lines
3.5 KiB
Svelte
105 lines
3.5 KiB
Svelte
<script lang="ts">
|
|
import ModelAvatar from '../ModelAvatar.svelte';
|
|
import ModelCapabilities from '../ModelCapabilities.svelte';
|
|
import ModelContext from '../ModelContext.svelte';
|
|
import ModelDownloadProgressBar from '../ModelDownloadProgressBar.svelte';
|
|
import ModelId from '../ModelId.svelte';
|
|
import ModelsManagerStatusCell from './ModelsManagerStatusCell.svelte';
|
|
import { modelRowActions } from './row-actions';
|
|
import { configuredContext, downloadProgressFor } from './utils';
|
|
import { MoreHorizontal } from '@lucide/svelte';
|
|
import { DropdownMenuActions } from '$lib/components/app';
|
|
import { MODEL_ROW_GRID_CLASS, MODEL_ROW_TRAILING_CELL_CLASS } from '$lib/constants';
|
|
import { ModelRowDownloadState } from '$lib/enums';
|
|
import { deviceStore, modelsStore } from '$lib/stores';
|
|
import type { ModelOption } from '$lib/types/models';
|
|
|
|
interface Props {
|
|
isFavorite: (option: ModelOption) => boolean;
|
|
option: ModelOption;
|
|
onDelete: (option: ModelOption) => void;
|
|
onSelect: (option: ModelOption) => void;
|
|
selected: boolean;
|
|
/** Left padding in px, from the nesting depth. */
|
|
indent?: number;
|
|
}
|
|
|
|
let { indent = 0, isFavorite, onDelete, onSelect, option, selected }: Props = $props();
|
|
|
|
let favorite = $derived(isFavorite(option));
|
|
let isHidden = $derived(modelsStore.isHidden(option.id));
|
|
// live while the download runs, frozen while it is paused
|
|
let downloadProgress = $derived(downloadProgressFor(option.model));
|
|
// a tracked download takes over the status column while it runs
|
|
let download = $derived(
|
|
modelsStore.status.isDownloadPaused(option.model)
|
|
? ModelRowDownloadState.PAUSED
|
|
: modelsStore.status.isDownloadInProgress(option.model)
|
|
? ModelRowDownloadState.DOWNLOADING
|
|
: null
|
|
);
|
|
</script>
|
|
|
|
<div
|
|
class={[
|
|
MODEL_ROW_GRID_CLASS,
|
|
'group relative rounded-md px-2 py-3 transition max-md:px-3 max-md:py-4',
|
|
isHidden && 'opacity-60',
|
|
selected ? 'bg-accent text-accent-foreground' : 'hover:bg-muted/40'
|
|
]}
|
|
>
|
|
<!-- the row holds a load control and an actions menu, so only the model itself is
|
|
the button: a button nested in a role="button" row is invalid -->
|
|
<button
|
|
aria-pressed={selected}
|
|
class="flex min-w-0 cursor-pointer items-center gap-3 text-left max-md:gap-2 max-md:pr-9"
|
|
onclick={() => onSelect(option)}
|
|
style="padding-left: {indent}px"
|
|
type="button"
|
|
>
|
|
<ModelAvatar {option} size="size-7 md:size-9" />
|
|
|
|
<span class="flex min-w-0 items-center gap-1.25">
|
|
<ModelId
|
|
aliases={option.aliases}
|
|
class="min-w-0 flex-1 max-md:text-sm"
|
|
draftSidecars={option.draftSidecars}
|
|
hideCapabilities
|
|
hideModalities
|
|
modalities={option.modalities}
|
|
modelId={option.model}
|
|
tags={option.tags}
|
|
title={option.model}
|
|
/>
|
|
|
|
<!-- a phone has no width for the modality icons, the id needs it more -->
|
|
<ModelCapabilities hideModalities={deviceStore.isMobile} {option} />
|
|
</span>
|
|
</button>
|
|
|
|
<ModelContext
|
|
class="justify-self-end max-md:hidden"
|
|
configured={configuredContext(option)}
|
|
{option}
|
|
/>
|
|
|
|
<ModelsManagerStatusCell class="max-md:hidden" {download} {option} />
|
|
|
|
{#if download}
|
|
<ModelDownloadProgressBar
|
|
downloadedBytes={downloadProgress?.downloadedBytes ?? 0}
|
|
overlay
|
|
totalBytes={downloadProgress?.totalBytes ?? 0}
|
|
/>
|
|
{/if}
|
|
|
|
<div class="flex items-center justify-center justify-self-center {MODEL_ROW_TRAILING_CELL_CLASS}">
|
|
<DropdownMenuActions
|
|
actions={modelRowActions(option, favorite, isHidden, onDelete, download)}
|
|
align="end"
|
|
triggerIcon={MoreHorizontal}
|
|
triggerTooltip="Model actions"
|
|
/>
|
|
</div>
|
|
</div>
|