Skip to content

Commit 8d74580

Browse files
committed
perf: get models on mounted
1 parent 1fbf70e commit 8d74580

2 files changed

Lines changed: 23 additions & 18 deletions

File tree

src/lib/components/chat/ModelSelector/Selector.svelte

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,13 @@
326326
// Remove duplicates and sort
327327
tags = Array.from(new Set(tags)).sort((a, b) => a.localeCompare(b));
328328
}
329+
330+
models.set(
331+
await getModels(
332+
localStorage.token,
333+
$config?.features?.enable_direct_connections && ($settings?.directConnections ?? null)
334+
)
335+
);
329336
});
330337
331338
$: if (show) {

src/lib/components/layout/Sidebar.svelte

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@
627627
</Tooltip>
628628
</div>
629629

630-
<div class="{$showSidebar ? '' : 'hidden'}">
630+
<div class={$showSidebar ? '' : 'hidden'}>
631631
<div class="relative {$temporaryChatEnabled ? 'opacity-20' : ''}">
632632
<SearchInput
633633
bind:value={search}
@@ -771,8 +771,6 @@
771771
<div
772772
class="sidebar px-2 pt-2 pb-2 flex justify-between space-x-1 text-gray-600 dark:text-gray-400 sticky top-0 z-10 -mb-3"
773773
>
774-
775-
776774
<a href="/" class="flex flex-1 px-1.5 hidden" on:click={newChatHandler}>
777775
<div
778776
id="sidebar-webui-name"
@@ -801,19 +799,19 @@
801799
</Tooltip>
802800

803801
<Tooltip content={$i18n.t('New Chat')} placement="bottom">
804-
<button
805-
class="cursor-pointer p-[7px] flex rounded-xl hover:bg-gray-100 dark:hover:bg-gray-900 transition"
806-
on:click={async () => {
807-
selectedChatId = null;
808-
await goto('/kael/');
809-
const newChatButton = document.getElementById('new-chat-button');
810-
setTimeout(() => {
811-
newChatButton?.click();
812-
}, 0);
813-
}}
814-
>
815-
<PencilSquare className="size-5" strokeWidth="2" />
816-
</button>
802+
<button
803+
class="cursor-pointer p-[7px] flex rounded-xl hover:bg-gray-100 dark:hover:bg-gray-900 transition"
804+
on:click={async () => {
805+
selectedChatId = null;
806+
await goto('/kael/');
807+
const newChatButton = document.getElementById('new-chat-button');
808+
setTimeout(() => {
809+
newChatButton?.click();
810+
}, 0);
811+
}}
812+
>
813+
<PencilSquare className="size-5" strokeWidth="2" />
814+
</button>
817815
</Tooltip>
818816
<div
819817
class="{scrollTop > 0
@@ -1271,7 +1269,7 @@
12711269
</Folder>
12721270
</div>
12731271

1274-
<div class="px-1.5 pt-1.5 pb-2 sticky bottom-0 z-10 -mt-3 sidebar">
1272+
<div class="px-1.5 pt-1.5 pb-3 sticky bottom-0 z-10 -mt-3 sidebar">
12751273
<div
12761274
class=" sidebar-bg-gradient-to-t bg-linear-to-t from-gray-50 dark:from-gray-950 to-transparent from-50% pointer-events-none absolute inset-0 -z-10 -mt-6"
12771275
></div>
@@ -1286,7 +1284,7 @@
12861284
}}
12871285
>
12881286
<div
1289-
class=" flex items-center rounded-xl py-2 px-2 w-full hover:bg-gray-100 dark:hover:bg-gray-900/50 transition"
1287+
class=" flex items-center rounded-xl py-2 px-2 w-full hover:bg-gray-100 dark:hover:bg-gray-900/50 transition"
12901288
>
12911289
<div class=" self-center mr-3">
12921290
<img

0 commit comments

Comments
 (0)