From ff56d6a40ee9323d238d5945c494f2735e878934 Mon Sep 17 00:00:00 2001 From: Ryan Hopper-Lowe <46546486+ryanhopperlowe@users.noreply.github.com> Date: Thu, 16 Jan 2025 09:24:33 -0600 Subject: [PATCH] feat: collapse agent/user tools into single section (#1279) --- ui/admin/app/components/agent/ToolForm.tsx | 128 +++++++----------- .../agent/shared/ToolAuthenticationStatus.tsx | 19 ++- ui/admin/app/components/tools/ToolCatalog.tsx | 2 +- 3 files changed, 69 insertions(+), 80 deletions(-) diff --git a/ui/admin/app/components/agent/ToolForm.tsx b/ui/admin/app/components/agent/ToolForm.tsx index 4df132dae..6b447504b 100644 --- a/ui/admin/app/components/agent/ToolForm.tsx +++ b/ui/admin/app/components/agent/ToolForm.tsx @@ -9,12 +9,13 @@ import { noop } from "~/lib/utils"; import { ToolEntry } from "~/components/agent/ToolEntry"; import { ToolCatalogDialog } from "~/components/tools/ToolCatalog"; import { Form } from "~/components/ui/form"; -import { Switch } from "~/components/ui/switch"; import { - Tooltip, - TooltipContent, - TooltipTrigger, -} from "~/components/ui/tooltip"; + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "~/components/ui/select"; const ToolVariant = { FIXED: "fixed", @@ -99,14 +100,6 @@ export function ToolForm({ }).unsubscribe; }, [watch, onChange]); - const [allTools, fixedFields, userFields] = useMemo(() => { - return [ - toolFields.fields.map(({ tool }) => tool), - toolFields.fields?.filter((field) => field.variant === ToolVariant.FIXED), - toolFields.fields?.filter((field) => field.variant !== ToolVariant.FIXED), - ]; - }, [toolFields]); - const removeTools = (tools: string[]) => { const indexes = tools .map((tool) => toolFields.fields.findIndex((t) => t.tool === tool)) @@ -137,80 +130,62 @@ export function ToolForm({ } }; + const sortedFields = toolFields.fields.toSorted((a, b) => + a.tool.localeCompare(b.tool) + ); + return (