This commit is contained in:
Timothy Jaeryang Baek committed 2026-11-08 01:28:41 +09:00
1 parent dc22fa8f86
commit 834c47ee02
14 files changed
+948 -572

No files matched your search

@@ -1,5 +1,5 @@
<script lang="ts">
import { getContext, onMount, tick } from 'svelte';
import { getContext, onMount } from 'svelte';
import { fly } from 'svelte/transition';
import { config, user, tools as _tools, mobile, knowledge, visibleControls } from '$lib/stores';
@@ -11,6 +11,7 @@
import DropdownMenu from '$lib/components/common/DropdownMenu.svelte';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import DocumentArrowUp from '$lib/components/icons/DocumentArrowUp.svelte';
import DocumentDuplicate from '$lib/components/icons/DocumentDuplicate.svelte';
import Camera from '$lib/components/icons/Camera.svelte';
import Note from '$lib/components/icons/Note.svelte';
import Clip from '$lib/components/icons/Clip.svelte';
@@ -45,12 +46,13 @@
export let onUpload: Function;
export let onClose: Function;
export let onCompare: () => void = () => {};
export let toolApprovalMode = 'full';
export let onToolApprovalModeChange: Function = () => {};
let show = false;
let tab = '';
export let show = false;
export let tab = '';
export let closeOnOutsideClick = true;
$: if (!show) tab = '';
let showAttachWebpageModal = false;
$: toolApprovalModes = [
@@ -136,9 +138,10 @@
<Dropdown
bind:show
{closeOnOutsideClick}
visualViewportAware
on:change={(e) => {
if (e.detail === false) {
onOpenChange={(state) => {
if (state === false) {
onClose();
}
}}
@@ -148,12 +151,11 @@
</Tooltip>
<div slot="content">
<DropdownMenu className="w-70 max-h-72 overflow-hidden transition">
<DropdownMenu
className="w-70 max-h-72 overflow-y-auto overflow-x-hidden scrollbar-thin transition"
>
{#if tab === ''}
<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 }}>
{#if toolPermissionsEnabled}
<button
role="menuitem"
@@ -259,33 +261,38 @@
</Tooltip>
{/if}
{#if $visibleControls['chat.compare']}
<button
role="menuitem"
type="button"
class="flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer hover:bg-gray-50/40 dark:hover:bg-gray-800/40 rounded-xl text-left"
on:click={async () => {
show = false;
await tick();
onCompare();
}}
>
<svg
class="size-3.5 shrink-0"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<rect x="3" y="4" width="18" height="16" rx="2" />
<path d="M12 4v16M5.5 12h4M14.5 12h4M16.5 10v4" />
</svg>
<span>{$i18n.t('Compare text')}</span>
</button>
{/if}
<button
role="menuitem"
type="button"
class="flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer hover:bg-gray-50/40 dark:hover:bg-gray-800/40 rounded-xl text-left"
on:click={() => {
tab = 'attachments';
}}
>
<DocumentDuplicate />
<div class="flex items-center w-full justify-between">
<div>{$i18n.t('Add Context')}</div>
<div class="text-gray-500"><ChevronRight /></div>
</div>
</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 }}
>
<button
role="menuitem"
type="button"
class="flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer hover:bg-gray-50/40 dark:hover:bg-gray-800/40 rounded-xl text-left"
on:click={() => {
tab = '';
}}
>
<ChevronLeft />
<div>{$i18n.t('Add Context')}</div>
</button>
<div class="h-px mx-1 my-1 bg-gray-100 dark:bg-gray-800"></div>
{#if $visibleControls['chat.attach_webpage']}
<Tooltip
@@ -665,7 +672,7 @@
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"
on:click={() => {
tab = '';
tab = 'attachments';
}}
>
<ChevronLeft />
@@ -685,7 +692,7 @@
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"
on:click={() => {
tab = '';
tab = 'attachments';
}}
>
<ChevronLeft />
@@ -705,7 +712,7 @@
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"
on:click={() => {
tab = '';
tab = 'attachments';
}}
>
<ChevronLeft />
@@ -725,7 +732,7 @@
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"
on:click={() => {
tab = '';
tab = 'attachments';
}}
>
<ChevronLeft />
@@ -745,7 +752,7 @@
role="menuitem"
class="flex w-full 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"
on:click={() => {
tab = '';
tab = 'attachments';
}}
>
<ChevronLeft />
@@ -790,6 +797,7 @@
{/if}
</div>
{/if}
<slot name="integrations" />
</DropdownMenu>
</div>
</Dropdown>