From 2b92aef7a56ba2d0670c21751f8fae9db13f3a83 Mon Sep 17 00:00:00 2001 From: Ryan Hopper-Lowe <46546486+ryanhopperlowe@users.noreply.github.com> Date: Tue, 14 Jan 2025 15:38:07 -0600 Subject: [PATCH] enhance: move environment variable section to the bottom of agent/workflow form (#1253) --- ui/admin/app/components/agent/Agent.tsx | 27 ++--- .../shared/EnvironmentVariableSection.tsx | 100 ++++++++++-------- ui/admin/app/components/workflow/Workflow.tsx | 22 ++-- 3 files changed, 74 insertions(+), 75 deletions(-) diff --git a/ui/admin/app/components/agent/Agent.tsx b/ui/admin/app/components/agent/Agent.tsx index 6c42b8d7c..8664b7e8f 100644 --- a/ui/admin/app/components/agent/Agent.tsx +++ b/ui/admin/app/components/agent/Agent.tsx @@ -1,4 +1,4 @@ -import { LibraryIcon, PlusIcon, VariableIcon, WrenchIcon } from "lucide-react"; +import { LibraryIcon, PlusIcon, WrenchIcon } from "lucide-react"; import { useCallback, useEffect, useState } from "react"; import useSWR from "swr"; @@ -99,11 +99,11 @@ export function Agent({ className, currentThreadId, onRefresh }: AgentProps) { -
+
-
+

Tools @@ -121,20 +121,7 @@ export function Agent({ className, currentThreadId, onRefresh }: AgentProps) { />

-
-

- - Environment Variables -

- - -
- -
+

Knowledge @@ -156,6 +143,12 @@ export function Agent({ className, currentThreadId, onRefresh }: AgentProps) { }} />

+ +
diff --git a/ui/admin/app/components/agent/shared/EnvironmentVariableSection.tsx b/ui/admin/app/components/agent/shared/EnvironmentVariableSection.tsx index 9ee6e762a..3e206fcb9 100644 --- a/ui/admin/app/components/agent/shared/EnvironmentVariableSection.tsx +++ b/ui/admin/app/components/agent/shared/EnvironmentVariableSection.tsx @@ -1,4 +1,4 @@ -import { PenIcon } from "lucide-react"; +import { PenIcon, VariableIcon } from "lucide-react"; import { toast } from "sonner"; import { Agent } from "~/lib/model/agents"; @@ -9,7 +9,7 @@ import { EnvironmentApiService } from "~/lib/service/api/EnvironmentApiService"; import { EnvForm } from "~/components/agent/shared/AgentEnvironmentVariableForm"; import { SelectList } from "~/components/composed/SelectModule"; import { Button } from "~/components/ui/button"; -import { Card } from "~/components/ui/card"; +import { Card, CardDescription } from "~/components/ui/card"; import { Dialog, DialogContent, @@ -60,49 +60,61 @@ export function EnvironmentVariableSection({ const items = entity.env ?? []; return ( -
- {!!items.length && ( - - item.name} - items={items} - renderItem={renderItem} - selected={items.map((item) => item.name)} - /> - - )} - - - - - - - - - Environment Variables - - - - Environment variables are used to store values that can be used in - your {entityType}. - - - {revealEnv.data && ( - updateEnv.execute(entity.id, values)} +
+

+ + Environment Variables +

+ + + Add environment variables that will be available to all tools as key + value pairs. + + +
+ {!!items.length && ( + + item.name} + items={items} + renderItem={renderItem} + selected={items.map((item) => item.name)} /> - )} - -
+ + )} + + + + + + + + + Environment Variables + + + + Environment variables are used to store values that can be used in + your {entityType}. + + + {revealEnv.data && ( + updateEnv.execute(entity.id, values)} + /> + )} + + +
); diff --git a/ui/admin/app/components/workflow/Workflow.tsx b/ui/admin/app/components/workflow/Workflow.tsx index 231b946cd..bef1607e4 100644 --- a/ui/admin/app/components/workflow/Workflow.tsx +++ b/ui/admin/app/components/workflow/Workflow.tsx @@ -1,4 +1,4 @@ -import { Library, List, PuzzleIcon, Variable, WrenchIcon } from "lucide-react"; +import { Library, List, PuzzleIcon, WrenchIcon } from "lucide-react"; import { useCallback, useState } from "react"; import { AssistantNamespace } from "~/lib/model/assistants"; @@ -94,19 +94,6 @@ function WorkflowContent({ className }: WorkflowProps) { />
-
-

- - Environment Variables -

- - -
-

@@ -163,6 +150,13 @@ function WorkflowContent({ className }: WorkflowProps) {

+ + +