From 0bae7ca615d77d2a95833052e850faa93945e176 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Mon, 10 Jun 2024 22:29:24 -0700 Subject: [PATCH] feat: tool selector input menu --- .../chat/MessageInput/InputMenu.svelte | 23 +++++++++++++++---- src/lib/components/icons/WrenchSolid.svelte | 11 +++++++++ src/lib/components/workspace/Tools.svelte | 10 +++++--- 3 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 src/lib/components/icons/WrenchSolid.svelte diff --git a/src/lib/components/chat/MessageInput/InputMenu.svelte b/src/lib/components/chat/MessageInput/InputMenu.svelte index d7dc71fb2..811e4d27d 100644 --- a/src/lib/components/chat/MessageInput/InputMenu.svelte +++ b/src/lib/components/chat/MessageInput/InputMenu.svelte @@ -4,22 +4,19 @@ import { getContext } from 'svelte'; import Dropdown from '$lib/components/common/Dropdown.svelte'; - import GarbageBin from '$lib/components/icons/GarbageBin.svelte'; - import Pencil from '$lib/components/icons/Pencil.svelte'; import Tooltip from '$lib/components/common/Tooltip.svelte'; - import Tags from '$lib/components/chat/Tags.svelte'; - import Share from '$lib/components/icons/Share.svelte'; - import ArchiveBox from '$lib/components/icons/ArchiveBox.svelte'; import DocumentArrowUpSolid from '$lib/components/icons/DocumentArrowUpSolid.svelte'; import Switch from '$lib/components/common/Switch.svelte'; import GlobeAltSolid from '$lib/components/icons/GlobeAltSolid.svelte'; import { config } from '$lib/stores'; + import WrenchSolid from '$lib/components/icons/WrenchSolid.svelte'; const i18n = getContext('i18n'); export let uploadFilesHandler: Function; export let webSearchEnabled: boolean; + export let tools = {}; export let onClose: Function; let show = false; @@ -46,6 +43,22 @@ align="start" transition={flyAndScale} > + {#if Object.keys(tools).length > 0} + {#each Object.keys(tools) as tool} +
+
+ +
{tool}
+
+ + +
+ {/each} +
+ {/if} + {#if $config?.features?.enable_web_search}
+ export let className = 'size-4'; + + + + + diff --git a/src/lib/components/workspace/Tools.svelte b/src/lib/components/workspace/Tools.svelte index 959dc17cb..022409ea9 100644 --- a/src/lib/components/workspace/Tools.svelte +++ b/src/lib/components/workspace/Tools.svelte @@ -81,13 +81,17 @@ {#each $tools.filter((t) => query === '' || t.name .toLowerCase() .includes(query.toLowerCase()) || t.id.toLowerCase().includes(query.toLowerCase())) as tool} -
{ + goto(`/workspace/tools/edit?id=${encodeURIComponent(tool.id)}`); + }} >