diff --git a/ui/litellm-dashboard/.eslintrc.json b/ui/litellm-dashboard/.eslintrc.json index ddf8a7fee7d..475787bed9c 100644 --- a/ui/litellm-dashboard/.eslintrc.json +++ b/ui/litellm-dashboard/.eslintrc.json @@ -69,6 +69,7 @@ "src/components/CostTrackingSettings/how_it_works.tsx", "src/components/Settings/AdminSettings/UISettings/PageVisibilitySettings.tsx", "src/components/AIHub/marketplace_table_columns.tsx", + "src/components/AIHub/AgentHubTableColumns.tsx", "src/components/UsagePage/components/EntityUsage/SpendByProvider.tsx", "src/components/view_logs/ToolsSection/FormattedToolView.tsx", "src/components/Settings/LoggingAndAlerts/LoggingCallbacks/LoggingCallbacksTable.tsx", diff --git a/ui/litellm-dashboard/src/components/AIHub/AgentHubTableColumns.tsx b/ui/litellm-dashboard/src/components/AIHub/AgentHubTableColumns.tsx index 09b1c147615..501db337379 100644 --- a/ui/litellm-dashboard/src/components/AIHub/AgentHubTableColumns.tsx +++ b/ui/litellm-dashboard/src/components/AIHub/AgentHubTableColumns.tsx @@ -1,7 +1,14 @@ import { ColumnDef } from "@tanstack/react-table"; -import { Button, Badge, Text } from "@tremor/react"; -import { Tooltip, Tag } from "antd"; -import { CopyOutlined, InfoCircleOutlined } from "@ant-design/icons"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from "@/components/ui/tooltip"; +import { Copy, Info } from "lucide-react"; +import { cn } from "@/lib/utils"; export interface AgentHubData { agent_id?: string; @@ -12,6 +19,7 @@ export interface AgentHubData { version: string; capabilities?: { streaming?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any [key: string]: any; }; defaultInputModes?: string[]; @@ -25,207 +33,223 @@ export interface AgentHubData { }>; supportsAuthenticatedExtendedCard?: boolean; is_public?: boolean; + // eslint-disable-next-line @typescript-eslint/no-explicit-any [key: string]: any; } +const badgeClass = { + blue: "bg-blue-100 text-blue-700 dark:bg-blue-950 dark:text-blue-300", + emerald: + "bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300", + purple: + "bg-purple-100 text-purple-700 dark:bg-purple-950 dark:text-purple-300", + gray: "bg-muted text-muted-foreground", +}; + export const getAgentHubTableColumns = ( showModal: (agent: AgentHubData) => void, copyToClipboard: (text: string) => void, + // eslint-disable-next-line @typescript-eslint/no-unused-vars publicPage: boolean = false, -): ColumnDef[] => { - const allColumns: ColumnDef[] = [ - { - header: "Agent Name", - accessorKey: "name", - enableSorting: true, - sortingFn: "alphanumeric", - cell: ({ row }) => { - const agent = row.original; - - return ( -
-
- {agent.name} - - copyToClipboard(agent.name)} - className="cursor-pointer text-gray-500 hover:text-blue-500 text-xs" - /> +): ColumnDef[] => [ + { + header: "Agent Name", + accessorKey: "name", + enableSorting: true, + sortingFn: "alphanumeric", + cell: ({ row }) => { + const agent = row.original; + return ( +
+
+ {agent.name} + + + + + + Copy agent name -
- {/* Show description on mobile */} -
- {agent.description} -
+
- ); - }, - }, - { - header: "Description", - accessorKey: "description", - enableSorting: true, - sortingFn: "alphanumeric", - cell: ({ row }) => { - const agent = row.original; - - return {agent.description || "-"}; - }, - meta: { - className: "hidden md:table-cell", - }, - }, - { - header: "Version", - accessorKey: "version", - enableSorting: true, - sortingFn: "alphanumeric", - cell: ({ row }) => { - const agent = row.original; - - return ( - - v{agent.version} - - ); - }, - meta: { - className: "hidden lg:table-cell", - }, - }, - { - header: "Protocol", - accessorKey: "protocolVersion", - enableSorting: true, - sortingFn: "alphanumeric", - cell: ({ row }) => { - const agent = row.original; - - return {agent.protocolVersion || "-"}; - }, - meta: { - className: "hidden lg:table-cell", - }, - }, - { - header: "Skills", - accessorKey: "skills", - enableSorting: false, - cell: ({ row }) => { - const agent = row.original; - const skills = agent.skills || []; - - return ( -
- - {skills.length} skill{skills.length !== 1 ? "s" : ""} - - {skills.length > 0 && ( -
- {skills.slice(0, 2).map((skill) => ( - - {skill.name} - - ))} - {skills.length > 2 && +{skills.length - 2}} -
- )} +
+

+ {agent.description} +

- ); - }, +
+ ); }, - { - header: "Capabilities", - accessorKey: "capabilities", - enableSorting: false, - cell: ({ row }) => { - const agent = row.original; - const capabilities = agent.capabilities || {}; - const capabilityList = Object.entries(capabilities) - .filter(([_, value]) => value === true) - .map(([key]) => key); - - return ( -
- {capabilityList.length === 0 ? ( - - - ) : ( - capabilityList.map((capability) => ( - - {capability} + }, + { + header: "Description", + accessorKey: "description", + enableSorting: true, + sortingFn: "alphanumeric", + cell: ({ row }) => ( +

{row.original.description || "-"}

+ ), + meta: { + className: "hidden md:table-cell", + }, + }, + { + header: "Version", + accessorKey: "version", + enableSorting: true, + sortingFn: "alphanumeric", + cell: ({ row }) => ( + + v{row.original.version} + + ), + meta: { + className: "hidden lg:table-cell", + }, + }, + { + header: "Protocol", + accessorKey: "protocolVersion", + enableSorting: true, + sortingFn: "alphanumeric", + cell: ({ row }) => ( + {row.original.protocolVersion || "-"} + ), + meta: { + className: "hidden lg:table-cell", + }, + }, + { + header: "Skills", + accessorKey: "skills", + enableSorting: false, + cell: ({ row }) => { + const agent = row.original; + const skills = agent.skills || []; + return ( +
+ + {skills.length} skill{skills.length !== 1 ? "s" : ""} + + {skills.length > 0 && ( +
+ {skills.slice(0, 2).map((skill) => ( + + {skill.name} - )) - )} + ))} + {skills.length > 2 && ( + + +{skills.length - 2} + + )} +
+ )} +
+ ); + }, + }, + { + header: "Capabilities", + accessorKey: "capabilities", + enableSorting: false, + cell: ({ row }) => { + const agent = row.original; + const capabilities = agent.capabilities || {}; + const capabilityList = Object.entries(capabilities) + .filter(([, value]) => value === true) + .map(([key]) => key); + + return ( +
+ {capabilityList.length === 0 ? ( + - + ) : ( + capabilityList.map((capability) => ( + + {capability} + + )) + )} +
+ ); + }, + }, + { + header: "I/O Modes", + accessorKey: "defaultInputModes", + enableSorting: false, + cell: ({ row }) => { + const agent = row.original; + const inputModes = agent.defaultInputModes || []; + const outputModes = agent.defaultOutputModes || []; + + return ( +
+
+ In:{" "} + {inputModes.join(", ") || "-"}
- ); - }, - }, - { - header: "I/O Modes", - accessorKey: "defaultInputModes", - enableSorting: false, - cell: ({ row }) => { - const agent = row.original; - const inputModes = agent.defaultInputModes || []; - const outputModes = agent.defaultOutputModes || []; - - return ( -
- - In: {inputModes.join(", ") || "-"} - - - Out: {outputModes.join(", ") || "-"} - +
+ Out:{" "} + {outputModes.join(", ") || "-"}
- ); - }, - meta: { - className: "hidden xl:table-cell", - }, +
+ ); }, - { - header: "Public", - accessorKey: "is_public", - enableSorting: true, - sortingFn: (rowA, rowB) => { - const publicA = rowA.original.is_public === true ? 1 : 0; - const publicB = rowB.original.is_public === true ? 1 : 0; - return publicA - publicB; - }, - cell: ({ row }) => { - const agent = row.original; - - return agent.is_public === true ? ( - - Yes - - ) : ( - - No - - ); - }, - meta: { - className: "hidden md:table-cell", - }, + meta: { + className: "hidden xl:table-cell", }, - { - header: "Details", - id: "details", - enableSorting: false, - cell: ({ row }) => { - const agent = row.original; - - return ( - - ); - }, + }, + { + header: "Public", + accessorKey: "is_public", + enableSorting: true, + sortingFn: (rowA, rowB) => { + const publicA = rowA.original.is_public === true ? 1 : 0; + const publicB = rowB.original.is_public === true ? 1 : 0; + return publicA - publicB; }, - ]; - - return allColumns; -}; + cell: ({ row }) => + row.original.is_public === true ? ( + Yes + ) : ( + No + ), + meta: { + className: "hidden md:table-cell", + }, + }, + { + header: "Details", + id: "details", + enableSorting: false, + cell: ({ row }) => { + const agent = row.original; + return ( + + ); + }, + }, +];