From 2ca21e5f2e1d0269c293c1fbd199522420c45ac3 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 21 Nov 2026 23:02:19 +0400 Subject: [PATCH] refac --- .../chat/MessageInput/InputMenu.svelte | 137 +- .../comments/CommentsDropdown.svelte | 81 + src/lib/components/workspace/Knowledge.svelte | 531 +++-- .../workspace/Knowledge/KnowledgeBase.svelte | 388 ++-- src/lib/components/workspace/Models.svelte | 939 ++++---- .../workspace/Models/ModelEditor.svelte | 2031 ++++++++--------- src/lib/components/workspace/Prompts.svelte | 759 +++--- .../workspace/Prompts/PromptEditor.svelte | 590 +++-- src/lib/components/workspace/Skills.svelte | 704 +++--- .../workspace/Skills/SkillEditor.svelte | 569 +++-- src/lib/components/workspace/Tools.svelte | 834 ++++--- .../workspace/Tools/ToolkitEditor.svelte | 498 ++-- src/lib/i18n/locales/ar-BH/translation.json | 1 + src/lib/i18n/locales/ar/translation.json | 1 + src/lib/i18n/locales/az-AZ/translation.json | 1 + src/lib/i18n/locales/bg-BG/translation.json | 1 + src/lib/i18n/locales/bn-BD/translation.json | 1 + src/lib/i18n/locales/bo-TB/translation.json | 1 + src/lib/i18n/locales/bs-BA/translation.json | 1 + src/lib/i18n/locales/ca-ES/translation.json | 1 + src/lib/i18n/locales/ceb-PH/translation.json | 1 + src/lib/i18n/locales/cs-CZ/translation.json | 1 + src/lib/i18n/locales/da-DK/translation.json | 1 + src/lib/i18n/locales/de-DE/translation.json | 1 + src/lib/i18n/locales/dg-DG/translation.json | 1 + src/lib/i18n/locales/el-GR/translation.json | 1 + src/lib/i18n/locales/en-GB/translation.json | 1 + src/lib/i18n/locales/en-US/translation.json | 1 + src/lib/i18n/locales/es-ES/translation.json | 1 + src/lib/i18n/locales/et-EE/translation.json | 1 + src/lib/i18n/locales/eu-ES/translation.json | 1 + src/lib/i18n/locales/fa-IR/translation.json | 1 + src/lib/i18n/locales/fi-FI/translation.json | 1 + src/lib/i18n/locales/fil-PH/translation.json | 1 + src/lib/i18n/locales/fo-FO/translation.json | 1 + src/lib/i18n/locales/fr-CA/translation.json | 1 + src/lib/i18n/locales/fr-FR/translation.json | 1 + src/lib/i18n/locales/gl-ES/translation.json | 1 + src/lib/i18n/locales/he-IL/translation.json | 1 + src/lib/i18n/locales/hi-IN/translation.json | 1 + src/lib/i18n/locales/hr-HR/translation.json | 1 + src/lib/i18n/locales/hu-HU/translation.json | 1 + src/lib/i18n/locales/id-ID/translation.json | 1 + src/lib/i18n/locales/ie-GA/translation.json | 1 + src/lib/i18n/locales/it-IT/translation.json | 1 + src/lib/i18n/locales/ja-JP/translation.json | 1 + src/lib/i18n/locales/ka-GE/translation.json | 1 + src/lib/i18n/locales/kab-DZ/translation.json | 1 + src/lib/i18n/locales/ko-KR/translation.json | 1 + src/lib/i18n/locales/lt-LT/translation.json | 1 + src/lib/i18n/locales/lv-LV/translation.json | 1 + src/lib/i18n/locales/ms-MY/translation.json | 1 + src/lib/i18n/locales/nb-NO/translation.json | 1 + src/lib/i18n/locales/nl-NL/translation.json | 1 + src/lib/i18n/locales/pa-IN/translation.json | 1 + src/lib/i18n/locales/pl-PL/translation.json | 1 + src/lib/i18n/locales/pt-BR/translation.json | 1 + src/lib/i18n/locales/pt-PT/translation.json | 1 + src/lib/i18n/locales/ro-RO/translation.json | 1 + src/lib/i18n/locales/ru-RU/translation.json | 1 + src/lib/i18n/locales/sk-SK/translation.json | 1 + src/lib/i18n/locales/sl-SI/translation.json | 1 + src/lib/i18n/locales/sr-RS/translation.json | 1 + src/lib/i18n/locales/sv-SE/translation.json | 1 + src/lib/i18n/locales/ta-IN/translation.json | 1 + src/lib/i18n/locales/th-TH/translation.json | 1 + src/lib/i18n/locales/tk-TM/translation.json | 1 + src/lib/i18n/locales/tr-TR/translation.json | 1 + src/lib/i18n/locales/ug-CN/translation.json | 1 + src/lib/i18n/locales/uk-UA/translation.json | 1 + src/lib/i18n/locales/ur-PK/translation.json | 1 + .../i18n/locales/uz-Cyrl-UZ/translation.json | 1 + .../i18n/locales/uz-Latn-UZ/translation.json | 1 + src/lib/i18n/locales/vi-VN/translation.json | 1 + src/lib/i18n/locales/zh-CN/translation.json | 1 + src/lib/i18n/locales/zh-TW/translation.json | 1 + src/routes/+error.svelte | 25 +- 77 files changed, 4108 insertions(+), 4042 deletions(-) create mode 100644 src/lib/components/comments/CommentsDropdown.svelte diff --git a/src/lib/components/chat/MessageInput/InputMenu.svelte b/src/lib/components/chat/MessageInput/InputMenu.svelte index b15bf49588..c72d0048bb 100644 --- a/src/lib/components/chat/MessageInput/InputMenu.svelte +++ b/src/lib/components/chat/MessageInput/InputMenu.svelte @@ -74,6 +74,9 @@ 'directory' ].includes(tab); + $: showImageCapture = visionCapableModels.length > 0 && $visibleControls['chat.capture']; + $: showCapture = showImageCapture || !!recordActions; + let showAttachWebpageModal = false; $: showAddContext = $visibleControls['chat.attach_webpage'] || @@ -268,7 +271,55 @@ - {#if visionCapableModels.length > 0 && $visibleControls['chat.capture']} + {#if showCapture} + + {/if} + + {#if showAddContext} + + {/if} + + {:else if tab === 'capture' && showCapture} +
+ + + {#if showImageCapture} - -
{$i18n.t('Capture')}
+ +
+ {detectMobile() ? $i18n.t('Camera') : $i18n.t('Screenshot')} +
{/if} {#if recordActions} - + + + {#each [{ label: 'Record', icon: Mic, action: recordActions.record }, { label: 'Capture Audio', icon: CursorArrowRays, action: recordActions.captureAudio }] as item} + + {/each} {/if} - - {#if showAddContext} - - {/if} -
- {:else if tab === 'record' && recordActions} -
- - - - - {#each [{ label: 'Record', icon: Mic, action: recordActions.record }, { label: 'Capture Audio', icon: CursorArrowRays, action: recordActions.captureAudio }] as item} - - {/each}
{:else if tab === 'attachments'}
diff --git a/src/lib/components/comments/CommentsDropdown.svelte b/src/lib/components/comments/CommentsDropdown.svelte new file mode 100644 index 0000000000..95be8abd2d --- /dev/null +++ b/src/lib/components/comments/CommentsDropdown.svelte @@ -0,0 +1,81 @@ + + +{#if enabled} + { + if (!state) { + if (open) view = null; + } else if (!open) view = { ...resource }; + }} + > + (view = open ? null : request)} + /> +
+ {#if open && view} + {#key `${$user?.id}:${resource.resource_type}:${resource.resource_id}:${view.comment_id ?? ''}`} + (view = null)} /> + {/key} + {/if} +
+
+{/if} diff --git a/src/lib/components/workspace/Knowledge.svelte b/src/lib/components/workspace/Knowledge.svelte index f0d426cd9e..d99aa044a6 100644 --- a/src/lib/components/workspace/Knowledge.svelte +++ b/src/lib/components/workspace/Knowledge.svelte @@ -3,10 +3,9 @@ import { getPageContext } from '$lib/utils/page'; const { goto } = getPageContext(); - import Comments from '$lib/components/comments/Comments.svelte'; + import CommentsDropdown from '$lib/components/comments/CommentsDropdown.svelte'; import type { CommentsRequest } from '$lib/components/comments/CommentsPanel.svelte'; let comments: CommentsRequest | null = null; - import CommentButton from '$lib/components/comments/CommentButton.svelte'; import WorkspaceAccessModal from './common/WorkspaceAccessModal.svelte'; let accessModal: WorkspaceAccessModal; import dayjs from 'dayjs'; @@ -318,299 +317,293 @@

{$i18n.t('Knowledge')}

- - {#if loaded && items !== null && total !== null} - { - deleteHandler(selectedItem); +{#if loaded && items !== null && total !== null} + { + deleteHandler(selectedItem); + }} + /> + + + { + closeCreateModal(); }} /> + - - { - closeCreateModal(); - }} - /> - - -
-
-
-
- -
- - {#if query} -
- -
- {/if} +
+
+
+
+
- -
{ - if (e.deltaY !== 0) { - e.preventDefault(); - e.currentTarget.scrollLeft += e.deltaY; - } - }} - > -
- { - localStorage.workspaceViewOption = value; - - await tick(); + + {#if query} +
+
-
+ {/if}
- {#if items !== null && total !== null} - {#if (items ?? []).length !== 0} -
-
{ + if (e.deltaY !== 0) { + e.preventDefault(); + e.currentTarget.scrollLeft += e.deltaY; + } + }} + > +
+ { + localStorage.workspaceViewOption = value; + + await tick(); + }} + /> + + { + localStorage.workspaceKnowledgeSourceOption = sourceOption; + await tick(); + }} + /> +
+
+
+ + {#if items !== null && total !== null} + {#if (items ?? []).length !== 0} +
+
+ + {/if} + -
{$i18n.t('Owner')}
+
{$i18n.t('Owner')}
- - {$i18n.t('Actions')} -
+ {/if} + + {$i18n.t('Actions')} +
-
- {#each items as item} - {@const metaPreview = getKnowledgeMetaPreview(item)} -