From 34813573fa82c724a73fecc82116ea6a35689d4e Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 14 Jul 2026 01:34:41 -0400 Subject: [PATCH] refac --- src/lib/components/admin/Functions.svelte | 99 +++----- .../automations/AutomationMenu.svelte | 8 +- .../automations/ModelDropdown.svelte | 6 +- .../automations/ScheduleDropdown.svelte | 4 +- .../automations/TerminalDropdown.svelte | 6 +- src/lib/components/common/DropdownMenu.svelte | 2 +- .../components/common/DropdownOptions.svelte | 4 +- src/lib/components/common/Select.svelte | 2 +- src/lib/components/notes/AIMenu.svelte | 4 +- src/lib/components/notes/Notes.svelte | 103 ++++---- .../components/notes/Notes/NoteMenu.svelte | 18 +- src/lib/components/notes/RecordMenu.svelte | 6 +- src/lib/components/workspace/Knowledge.svelte | 83 +++---- .../workspace/Knowledge/ItemMenu.svelte | 4 +- .../workspace/Knowledge/KnowledgeBase.svelte | 16 +- .../KnowledgeBase/AddContentMenu.svelte | 16 +- .../KnowledgeBase/DirectoryRow.svelte | 4 +- .../Knowledge/KnowledgeBase/Files.svelte | 6 +- src/lib/components/workspace/Models.svelte | 227 ++++++++---------- .../Models/Knowledge/KnowledgeSelector.svelte | 2 +- .../workspace/Models/ModelMenu.svelte | 16 +- src/lib/components/workspace/Prompts.svelte | 97 +++----- .../Prompts/PromptHistoryMenu.svelte | 2 +- .../workspace/Prompts/PromptMenu.svelte | 10 +- src/lib/components/workspace/Skills.svelte | 55 +++-- .../workspace/Skills/SkillMenu.svelte | 8 +- src/lib/components/workspace/Tools.svelte | 84 +++---- .../workspace/Tools/AddToolMenu.svelte | 4 +- .../workspace/Tools/ToolMenu.svelte | 10 +- .../workspace/common/CommunityDiscover.svelte | 34 +++ .../workspace/common/TagSelector.svelte | 8 +- .../workspace/common/ViewSelector.svelte | 8 +- src/routes/(app)/automations/+page.svelte | 149 ++++++------ src/routes/(app)/notes/+page.svelte | 101 ++------ 34 files changed, 554 insertions(+), 652 deletions(-) create mode 100644 src/lib/components/workspace/common/CommunityDiscover.svelte diff --git a/src/lib/components/admin/Functions.svelte b/src/lib/components/admin/Functions.svelte index 6f5de19559..e13b4ffc50 100644 --- a/src/lib/components/admin/Functions.svelte +++ b/src/lib/components/admin/Functions.svelte @@ -33,12 +33,12 @@ import GarbageBin from '../icons/GarbageBin.svelte'; import Search from '../icons/Search.svelte'; import Plus from '../icons/Plus.svelte'; - import ChevronRight from '../icons/ChevronRight.svelte'; import XMark from '../icons/XMark.svelte'; import AddFunctionMenu from './Functions/AddFunctionMenu.svelte'; import ImportModal from '../ImportModal.svelte'; import ViewSelector from '../workspace/common/ViewSelector.svelte'; import TagSelector from '../workspace/common/TagSelector.svelte'; + import CommunityDiscover from '../workspace/common/CommunityDiscover.svelte'; import { capitalizeFirstLetter } from '$lib/utils'; import Spinner from '../common/Spinner.svelte'; @@ -352,11 +352,9 @@ -
-
-
+
+
+
@@ -381,47 +379,49 @@
{/if}
-
-
{ - if (e.deltaY !== 0) { - e.preventDefault(); - e.currentTarget.scrollLeft += e.deltaY; - } - }} - >
{ + if (e.deltaY !== 0) { + e.preventDefault(); + e.currentTarget.scrollLeft += e.deltaY; + } + }} > - { - localStorage.workspaceViewOption = value; +
+ { + localStorage.workspaceViewOption = value; - await tick(); - }} - /> + await tick(); + }} + /> - + +
{#if (filteredItems ?? []).length !== 0} -
+
{#each filteredItems as func (func.id)} diff --git a/src/lib/components/automations/AutomationMenu.svelte b/src/lib/components/automations/AutomationMenu.svelte index e58ee33cc5..2f97cb9bdf 100644 --- a/src/lib/components/automations/AutomationMenu.svelte +++ b/src/lib/components/automations/AutomationMenu.svelte @@ -33,7 +33,7 @@
+ + {/if} +
{$i18n.t('Notes')}
- {total} + {total ?? ''}
@@ -364,17 +380,15 @@ > -
{$i18n.t('New Note')}
+
-
-
-
+
+
+
@@ -399,11 +413,9 @@
{/if}
-
-
{ if (e.deltaY !== 0) { e.preventDefault(); @@ -412,11 +424,10 @@ }} >
{/if} -
-
-
- { - if (displayOption) { - localStorage.noteDisplayOption = displayOption; - } else { - delete localStorage.noteDisplayOption; - } - }} - /> + { + if (displayOption) { + localStorage.noteDisplayOption = displayOption; + } else { + delete localStorage.noteDisplayOption; + } + }} + /> +
@@ -468,22 +477,20 @@ {#if (items ?? []).length > 0} {@const groupedNotes = groupNotes(items)} -
+
{#each groupedNotes as [timeRange, notesList], idx} -
+
{$i18n.t(timeRange)}
{#if displayOption === null}
{#each notesList as note, idx (note.id)}
@@ -493,9 +500,7 @@ className="flex-1" placement="top-start" > -
+
{note.title}
@@ -555,7 +560,7 @@ }} >
{/if}
- -
- ⓘ {$i18n.t("Use '#' in the prompt input to load and include your knowledge.")} -
{:else}
diff --git a/src/lib/components/workspace/Knowledge/ItemMenu.svelte b/src/lib/components/workspace/Knowledge/ItemMenu.svelte index 6c05b3f6bf..9edee6f6ac 100644 --- a/src/lib/components/workspace/Knowledge/ItemMenu.svelte +++ b/src/lib/components/workspace/Knowledge/ItemMenu.svelte @@ -46,7 +46,7 @@ {#if onExport} - - -
- - - - - -
- - - - -
+ {#if (tags ?? []).length > 0} + { + return { value: tag, label: tag }; + })} + /> + {/if}
- + + + + + + +
+ + + + + +
+ + + + +
+
+
+
{#if models !== null} {#if (models ?? []).length !== 0} -
+
{#each models as model (model.id)}
{ if (model.write_access) { @@ -849,30 +849,11 @@
{#if $config?.features.enable_community_sharing} -
+ {/if} {:else}
diff --git a/src/lib/components/workspace/Models/Knowledge/KnowledgeSelector.svelte b/src/lib/components/workspace/Models/Knowledge/KnowledgeSelector.svelte index 923e704652..994d41946b 100644 --- a/src/lib/components/workspace/Models/Knowledge/KnowledgeSelector.svelte +++ b/src/lib/components/workspace/Models/Knowledge/KnowledgeSelector.svelte @@ -155,7 +155,7 @@ {/if}
-
+
-
-
-
+
+
+
@@ -354,36 +352,38 @@
{/if}
-
-
{ - if (e.deltaY !== 0) { - e.preventDefault(); - e.currentTarget.scrollLeft += e.deltaY; - } - }} - >
{ + if (e.deltaY !== 0) { + e.preventDefault(); + e.currentTarget.scrollLeft += e.deltaY; + } + }} > - { - localStorage.workspaceViewOption = value; - page = 1; - await tick(); - }} - /> - - {#if (tags ?? []).length > 0} - ({ value: tag, label: tag }))} +
+ { + localStorage.workspaceViewOption = value; + page = 1; + await tick(); + }} /> - {/if} + + {#if (tags ?? []).length > 0} + ({ value: tag, label: tag }))} + /> + {/if} +
@@ -393,10 +393,10 @@
{:else if (prompts ?? []).length !== 0} -
+
{#each prompts as prompt (prompt.id)}
@@ -535,30 +535,11 @@
{#if $config?.features.enable_community_sharing} -
+ {/if} {:else}
diff --git a/src/lib/components/workspace/Prompts/PromptHistoryMenu.svelte b/src/lib/components/workspace/Prompts/PromptHistoryMenu.svelte index bb1443e14e..d39a3113a1 100644 --- a/src/lib/components/workspace/Prompts/PromptHistoryMenu.svelte +++ b/src/lib/components/workspace/Prompts/PromptHistoryMenu.svelte @@ -62,7 +62,7 @@ {:else} - + + + {selectedLabel} + + + -
- - - - + + {item.label} +
+ +
+
+ + + + + + + +
+ + + + +
+
- +
{#if automations === null || loading} @@ -430,10 +435,10 @@
{:else} -
+
{#each automations as automation (automation.id)}
@@ -460,7 +465,7 @@ }} > - -
- {/if} - -
- - -
- {#if $user !== undefined && $user !== null} - { - if (e.detail === 'archived-chat') { - showArchivedChats.set(true); - } - }} - > - - - {/if} -
-
+
+
+ {#if loaded} +
+
- - -
- -
+ {:else} +
+ +
+ {/if}
-{/if} +