mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-29 00:21:45 -05:00
refac
This commit is contained in:
1 parent
003299641e
commit
0d8288dc0a
3 files changed
+22
-20
No files matched your search
@@ -53,6 +53,7 @@
|
||||
export let tab = '';
|
||||
export let closeOnOutsideClick = true;
|
||||
$: if (!show) tab = '';
|
||||
$: hasInternalList = ['tools', 'skills', 'files', 'notes', 'knowledge', 'chats'].includes(tab);
|
||||
|
||||
let showAttachWebpageModal = false;
|
||||
$: toolApprovalModes = [
|
||||
@@ -140,6 +141,8 @@
|
||||
bind:show
|
||||
{closeOnOutsideClick}
|
||||
visualViewportAware
|
||||
maxHeight="18rem"
|
||||
contentClass="flex flex-col overflow-hidden!"
|
||||
onOpenChange={(state) => {
|
||||
if (state === false) {
|
||||
onClose();
|
||||
@@ -150,9 +153,11 @@
|
||||
<slot />
|
||||
</Tooltip>
|
||||
|
||||
<div slot="content">
|
||||
<div slot="content" class="flex min-h-0 flex-col">
|
||||
<DropdownMenu
|
||||
className="w-70 max-h-72 overflow-y-auto overflow-x-hidden scrollbar-thin transition"
|
||||
className="w-70 min-h-0 transition {hasInternalList
|
||||
? 'flex flex-col overflow-hidden'
|
||||
: 'overflow-y-auto overflow-x-hidden scrollbar-thin'}"
|
||||
>
|
||||
{#if tab === ''}
|
||||
<div in:fly={{ x: -20, duration: 150 }}>
|
||||
@@ -277,10 +282,7 @@
|
||||
</button>
|
||||
</div>
|
||||
{:else if tab === 'attachments'}
|
||||
<div
|
||||
class="max-h-72 overflow-y-auto overflow-x-hidden scrollbar-thin"
|
||||
in:fly={{ x: 20, duration: 150 }}
|
||||
>
|
||||
<div in:fly={{ x: 20, duration: 150 }}>
|
||||
<button
|
||||
role="menuitem"
|
||||
type="button"
|
||||
@@ -615,7 +617,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
{:else if tab === 'tool_permissions'}
|
||||
<div class="flex max-h-72 flex-col overflow-hidden" in:fly={{ x: 20, duration: 150 }}>
|
||||
<div class="flex min-h-0 flex-col overflow-hidden" in:fly={{ x: 20, duration: 150 }}>
|
||||
<button
|
||||
role="menuitem"
|
||||
class="flex w-full shrink-0 justify-between gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal select-none cursor-pointer rounded-xl hover:bg-gray-50/40 dark:hover:bg-gray-800/40"
|
||||
@@ -667,7 +669,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{:else if tab === 'knowledge'}
|
||||
<div class="flex max-h-72 flex-col overflow-hidden" in:fly={{ x: 20, duration: 150 }}>
|
||||
<div class="flex min-h-0 flex-col overflow-hidden" in:fly={{ x: 20, duration: 150 }}>
|
||||
<button
|
||||
role="menuitem"
|
||||
class="flex w-full shrink-0 justify-between gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal select-none cursor-pointer rounded-xl hover:bg-gray-50/40 dark:hover:bg-gray-800/40"
|
||||
@@ -687,7 +689,7 @@
|
||||
<Knowledge {onSelect} />
|
||||
</div>
|
||||
{:else if tab === 'notes'}
|
||||
<div class="flex max-h-72 flex-col overflow-hidden" in:fly={{ x: 20, duration: 150 }}>
|
||||
<div class="flex min-h-0 flex-col overflow-hidden" in:fly={{ x: 20, duration: 150 }}>
|
||||
<button
|
||||
role="menuitem"
|
||||
class="flex w-full shrink-0 justify-between gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal select-none cursor-pointer rounded-xl hover:bg-gray-50/40 dark:hover:bg-gray-800/40"
|
||||
@@ -707,7 +709,7 @@
|
||||
<Notes {onSelect} />
|
||||
</div>
|
||||
{:else if tab === 'files'}
|
||||
<div class="flex max-h-72 flex-col overflow-hidden" in:fly={{ x: 20, duration: 150 }}>
|
||||
<div class="flex min-h-0 flex-col overflow-hidden" in:fly={{ x: 20, duration: 150 }}>
|
||||
<button
|
||||
role="menuitem"
|
||||
class="flex w-full shrink-0 justify-between gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal select-none cursor-pointer rounded-xl hover:bg-gray-50/40 dark:hover:bg-gray-800/40"
|
||||
@@ -727,7 +729,7 @@
|
||||
<Files {onSelect} />
|
||||
</div>
|
||||
{:else if tab === 'chats'}
|
||||
<div class="flex max-h-72 flex-col overflow-hidden" in:fly={{ x: 20, duration: 150 }}>
|
||||
<div class="flex min-h-0 flex-col overflow-hidden" in:fly={{ x: 20, duration: 150 }}>
|
||||
<button
|
||||
role="menuitem"
|
||||
class="flex w-full shrink-0 justify-between gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal select-none cursor-pointer rounded-xl hover:bg-gray-50/40 dark:hover:bg-gray-800/40"
|
||||
|
||||
@@ -512,10 +512,10 @@
|
||||
{/if}
|
||||
</div>
|
||||
{:else if tab === 'tools' && tools}
|
||||
<div class="flex max-h-72 min-h-0 flex-col gap-0.5" in:fly={{ x: 20, duration: 150 }}>
|
||||
<div class="flex min-h-0 flex-col gap-0.5 overflow-hidden" in:fly={{ x: 20, duration: 150 }}>
|
||||
<button
|
||||
role="menuitem"
|
||||
class="flex w-full justify-between gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer rounded-xl hover:bg-gray-50/40 dark:hover:bg-gray-800/40"
|
||||
class="flex w-full shrink-0 justify-between gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer rounded-xl hover:bg-gray-50/40 dark:hover:bg-gray-800/40"
|
||||
on:click={() => {
|
||||
toolQuery = '';
|
||||
tab = '';
|
||||
@@ -648,10 +648,10 @@
|
||||
</div>
|
||||
</div>
|
||||
{:else if tab === 'skills' && skills}
|
||||
<div class="flex max-h-72 min-h-0 flex-col gap-0.5" in:fly={{ x: 20, duration: 150 }}>
|
||||
<div class="flex min-h-0 flex-col gap-0.5 overflow-hidden" in:fly={{ x: 20, duration: 150 }}>
|
||||
<button
|
||||
role="menuitem"
|
||||
class="flex w-full justify-between gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer rounded-xl hover:bg-gray-50/40 dark:hover:bg-gray-800/40"
|
||||
class="flex w-full shrink-0 justify-between gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer rounded-xl hover:bg-gray-50/40 dark:hover:bg-gray-800/40"
|
||||
on:click={() => {
|
||||
skillQuery = '';
|
||||
tab = '';
|
||||
|
||||
@@ -148,12 +148,12 @@
|
||||
? 'cursor-not-allowed opacity-40 text-gray-400 dark:text-gray-600'
|
||||
: directory
|
||||
? 'cursor-pointer text-gray-600 hover:text-gray-700 dark:text-gray-300 dark:hover:text-gray-200'
|
||||
: 'cursor-pointer text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300'}"
|
||||
: 'cursor-pointer text-gray-300 hover:text-gray-500 dark:text-gray-600 dark:hover:text-gray-400'}"
|
||||
>
|
||||
<Folder className="size-3.5 shrink-0" strokeWidth="2" />
|
||||
<span data-input-label class="max-w-[9.375rem] truncate"
|
||||
>{directory ? folderName(directory) : $i18n.t('Choose...')}</span
|
||||
>
|
||||
{#if directory}
|
||||
<span data-input-label class="max-w-[9.375rem] truncate">{folderName(directory)}</span>
|
||||
{/if}
|
||||
</button>
|
||||
</Tooltip>
|
||||
<div slot="content">
|
||||
@@ -171,7 +171,7 @@
|
||||
on:click={() => selectDirectory('')}
|
||||
>
|
||||
<Folder className="size-3.5 shrink-0" strokeWidth="2" />
|
||||
<span class="flex-1 text-start">{$i18n.t('No folder')}</span>
|
||||
<span class="flex-1 text-start">{$i18n.t('Home')}</span>
|
||||
{#if !directory}
|
||||
<Check
|
||||
className="size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"
|
||||
|
||||
Reference in new issue
Block a user