mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac
This commit is contained in:
parent
c59b4cf379
commit
7969d8e8f3
@ -438,6 +438,12 @@
|
|||||||
window.addEventListener('message', onMessageHandler);
|
window.addEventListener('message', onMessageHandler);
|
||||||
$socket?.on('chat-events', chatEventHandler);
|
$socket?.on('chat-events', chatEventHandler);
|
||||||
|
|
||||||
|
page.subscribe((page) => {
|
||||||
|
if (page.url.pathname === '/') {
|
||||||
|
initNewChat();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (!$chatId) {
|
if (!$chatId) {
|
||||||
chatIdUnsubscriber = chatId.subscribe(async (value) => {
|
chatIdUnsubscriber = chatId.subscribe(async (value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
|
@ -237,7 +237,11 @@
|
|||||||
bind:show={showMenu}
|
bind:show={showMenu}
|
||||||
model={item.model}
|
model={item.model}
|
||||||
toggleSidebarHandler={() => {
|
toggleSidebarHandler={() => {
|
||||||
pinnedModels.set([...new Set([...$pinnedModels, item.model.id])]);
|
if ($pinnedModels.includes(item.model.id)) {
|
||||||
|
pinnedModels.set($pinnedModels.filter((id) => id !== item.model.id));
|
||||||
|
} else {
|
||||||
|
pinnedModels.set([...new Set([...$pinnedModels, item.model.id])]);
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
copyLinkHandler={() => {
|
copyLinkHandler={() => {
|
||||||
copyLinkHandler(item.model);
|
copyLinkHandler(item.model);
|
||||||
|
@ -38,15 +38,16 @@
|
|||||||
</DropdownMenu.Trigger>
|
</DropdownMenu.Trigger>
|
||||||
|
|
||||||
<DropdownMenu.Content
|
<DropdownMenu.Content
|
||||||
|
strategy="fixed"
|
||||||
class="w-full max-w-[180px] text-sm rounded-xl px-1 py-1.5 z-[9999999] bg-white dark:bg-gray-850 dark:text-white shadow-lg"
|
class="w-full max-w-[180px] text-sm rounded-xl px-1 py-1.5 z-[9999999] bg-white dark:bg-gray-850 dark:text-white shadow-lg"
|
||||||
sideOffset={-2}
|
sideOffset={-2}
|
||||||
side="bottom"
|
side="bottom"
|
||||||
align="start"
|
align="end"
|
||||||
transition={flyAndScale}
|
transition={flyAndScale}
|
||||||
>
|
>
|
||||||
<DropdownMenu.Item
|
<DropdownMenu.Item
|
||||||
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition items-center gap-2"
|
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition items-center gap-2"
|
||||||
on:click={() => {
|
on:click={(e) => {
|
||||||
toggleSidebarHandler();
|
toggleSidebarHandler();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -647,11 +647,12 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if ($pinnedModels ?? []).length > 0}
|
{#if ($pinnedModels ?? []).length > 0}
|
||||||
<div class="py-2">
|
<div class="pt-1.5">
|
||||||
{#each $pinnedModels as modelId (modelId)}
|
{#each $pinnedModels as modelId (modelId)}
|
||||||
|
{@const model = $models.find((model) => model.id === modelId)}
|
||||||
<div class="px-1.5 flex justify-center text-gray-800 dark:text-gray-200">
|
<div class="px-1.5 flex justify-center text-gray-800 dark:text-gray-200">
|
||||||
<a
|
<a
|
||||||
class="grow flex items-center space-x-3 rounded-lg px-2 py-[7px] hover:bg-gray-100 dark:hover:bg-gray-900 transition"
|
class="grow flex items-center space-x-2.5 rounded-lg px-2 py-[7px] hover:bg-gray-100 dark:hover:bg-gray-900 transition"
|
||||||
href="/?model={modelId}"
|
href="/?model={modelId}"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selectedChatId = null;
|
selectedChatId = null;
|
||||||
@ -664,25 +665,17 @@
|
|||||||
draggable="false"
|
draggable="false"
|
||||||
>
|
>
|
||||||
<div class="self-center">
|
<div class="self-center">
|
||||||
<svg
|
<img
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
crossorigin="anonymous"
|
||||||
fill="none"
|
src={model?.info?.meta?.profile_image_url ?? '/static/favicon.png'}
|
||||||
viewBox="0 0 24 24"
|
class=" size-5 rounded-full"
|
||||||
stroke-width="2"
|
alt="logo"
|
||||||
stroke="currentColor"
|
/>
|
||||||
class="size-[1.1rem]"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
d="M13.5 16.875h3.375m0 0h3.375m-3.375 0V13.5m0 3.375v3.375M6 10.5h2.25a2.25 2.25 0 0 0 2.25-2.25V6a2.25 2.25 0 0 0-2.25-2.25H6A2.25 2.25 0 0 0 3.75 6v2.25A2.25 2.25 0 0 0 6 10.5Zm0 9.75h2.25A2.25 2.25 0 0 0 10.5 18v-2.25a2.25 2.25 0 0 0-2.25-2.25H6a2.25 2.25 0 0 0-2.25 2.25V18A2.25 2.25 0 0 0 6 20.25Zm9.75-9.75H18a2.25 2.25 0 0 0 2.25-2.25V6A2.25 2.25 0 0 0 18 3.75h-2.25A2.25 2.25 0 0 0 13.5 6v2.25a2.25 2.25 0 0 0 2.25 2.25Z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex self-center translate-y-[0.5px]">
|
<div class="flex self-center translate-y-[0.5px]">
|
||||||
<div class=" self-center font-medium text-sm font-primary">
|
<div class=" self-center font-medium text-sm font-primary">
|
||||||
{$models.find((model) => model.id === modelId)?.name ?? modelId}
|
{model?.name ?? modelId}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user