diff --git a/ui/admin/app/components/chat/ChatActions.tsx b/ui/admin/app/components/chat/ChatActions.tsx index c4bf8483e..7fdd3fd7c 100644 --- a/ui/admin/app/components/chat/ChatActions.tsx +++ b/ui/admin/app/components/chat/ChatActions.tsx @@ -1,35 +1,15 @@ -import { - LibraryIcon, - PaperclipIcon, - TableIcon, - WrenchIcon, -} from "lucide-react"; -import { useMemo } from "react"; - -import { Agent } from "~/lib/model/agents"; -import { KnowledgeFile } from "~/lib/model/knowledge"; import { cn } from "~/lib/utils"; -import { TypographyMuted, TypographySmall } from "~/components/Typography"; -import { ToolEntry } from "~/components/agent/ToolEntry"; import { useChat } from "~/components/chat/ChatContext"; +import { FilesInfo } from "~/components/chat/chat-actions/FilesInfo"; +import { KnowledgeInfo } from "~/components/chat/chat-actions/KnowledgeInfo"; +import { TablesInfo } from "~/components/chat/chat-actions/TablesInfo"; +import { ToolsInfo } from "~/components/chat/chat-actions/ToolsInfo"; import { useOptimisticThread, useThreadAgents as useThreadAgent, useThreadKnowledge, } from "~/components/chat/thread-helpers"; -import { Button } from "~/components/ui/button"; -import { - Popover, - PopoverContent, - PopoverTrigger, -} from "~/components/ui/popover"; -import { Switch } from "~/components/ui/switch"; -import { - Tooltip, - TooltipContent, - TooltipTrigger, -} from "~/components/ui/tooltip"; export function ChatActions({ className }: { className?: string }) { const { threadId } = useChat(); @@ -59,194 +39,3 @@ export function ChatActions({ className }: { className?: string }) { ); } - -type ToolItem = { - tool: string; - isToggleable: boolean; - isEnabled: boolean; -}; - -function ToolsInfo({ - tools, - className, - agent, - disabled, - onChange, -}: { - tools: string[]; - className?: string; - agent: Nullish; - disabled?: boolean; - onChange: (tools: string[]) => void; -}) { - const toolItems = useMemo(() => { - if (!agent) - return tools.map((tool) => ({ - tool, - isToggleable: false, - isEnabled: true, - })); - - const agentTools = (agent.tools ?? []).map((tool) => ({ - tool, - isToggleable: false, - isEnabled: true, - })); - - const { defaultThreadTools, availableThreadTools } = agent ?? {}; - - const toggleableTools = [ - ...(defaultThreadTools ?? []), - ...(availableThreadTools ?? []), - ].map((tool) => ({ - tool, - isToggleable: true, - isEnabled: tools.includes(tool), - })); - - return [...agentTools, ...toggleableTools]; - }, [tools, agent]); - - const handleToggleTool = (tool: string, checked: boolean) => { - onChange(checked ? [...tools, tool] : tools.filter((t) => t !== tool)); - }; - - return ( - - Tools - - - - -