refac/enh: model suggestion tooltip

This commit is contained in:
Timothy Jaeryang Baek 2025-09-12 23:36:40 +04:00
parent 3e1b14f570
commit c55f557828

View file

@ -6,6 +6,7 @@
import { models } from '$lib/stores'; import { models } from '$lib/stores';
import { WEBUI_BASE_URL } from '$lib/constants'; import { WEBUI_BASE_URL } from '$lib/constants';
import Tooltip from '$lib/components/common/Tooltip.svelte';
const i18n = getContext('i18n'); const i18n = getContext('i18n');
@ -65,30 +66,32 @@
{#if filteredItems.length > 0} {#if filteredItems.length > 0}
{#each filteredItems as model, modelIdx} {#each filteredItems as model, modelIdx}
<button <Tooltip content={model.id} placement="top-start">
class="px-2.5 py-1.5 rounded-xl w-full text-left {modelIdx === selectedIdx <button
? 'bg-gray-50 dark:bg-gray-800 selected-command-option-button' class="px-2.5 py-1.5 rounded-xl w-full text-left {modelIdx === selectedIdx
: ''}" ? 'bg-gray-50 dark:bg-gray-800 selected-command-option-button'
type="button" : ''}"
on:click={() => { type="button"
onSelect({ type: 'model', data: model }); on:click={() => {
}} onSelect({ type: 'model', data: model });
on:mousemove={() => { }}
selectedIdx = modelIdx; on:mousemove={() => {
}} selectedIdx = modelIdx;
on:focus={() => {}} }}
data-selected={modelIdx === selectedIdx} on:focus={() => {}}
> data-selected={modelIdx === selectedIdx}
<div class="flex text-black dark:text-gray-100 line-clamp-1"> >
<img <div class="flex text-black dark:text-gray-100 line-clamp-1">
src={model?.info?.meta?.profile_image_url ?? `${WEBUI_BASE_URL}/static/favicon.png`} <img
alt={model?.name ?? model.id} src={model?.info?.meta?.profile_image_url ?? `${WEBUI_BASE_URL}/static/favicon.png`}
class="rounded-full size-5 items-center mr-2" alt={model?.name ?? model.id}
/> class="rounded-full size-5 items-center mr-2"
<div class="truncate"> />
{model.name} <div class="truncate">
{model.name}
</div>
</div> </div>
</div> </button>
</button> </Tooltip>
{/each} {/each}
{/if} {/if}