import { Tag } from "antd"; import { ColumnsType } from "antd/es/table"; import TableIconActionButton from "../common_components/IconActionButton/TableIconActionButtons/TableIconActionButton"; import { SearchTool } from "./types"; export const searchToolColumns = ( onView: (searchToolId: string) => void, onEdit: (searchToolId: string) => void, onDelete: (searchToolId: string) => void, availableProviders: Array<{ provider_name: string; ui_friendly_name: string }>, ): ColumnsType => [ { title: "Search Tool ID", dataIndex: "search_tool_id", key: "search_tool_id", render: (_, tool) => { const isFromConfig = tool.is_from_config; if (isFromConfig) { return -; } return ( ); }, }, { title: "Name", dataIndex: "search_tool_name", key: "search_tool_name", render: (name: string) => {name}, }, { title: "Provider", key: "provider", render: (_, tool) => { const provider = tool.litellm_params.search_provider; const providerInfo = availableProviders.find((p) => p.provider_name === provider); const displayName = providerInfo?.ui_friendly_name || provider; return {displayName}; }, }, { title: "Created At", dataIndex: "created_at", key: "created_at", render: (_, tool) => { return {tool.created_at ? new Date(tool.created_at).toLocaleDateString() : "-"}; }, }, { title: "Updated At", dataIndex: "updated_at", key: "updated_at", render: (_, tool) => { return {tool.updated_at ? new Date(tool.updated_at).toLocaleDateString() : "-"}; }, }, { title: "Source", key: "source", render: (_, tool) => { const isFromConfig = tool.is_from_config ?? false; return {isFromConfig ? "Config" : "DB"}; }, }, { title: "Actions", key: "actions", render: (_, tool) => { const toolId = tool.search_tool_id; const isFromConfig = tool.is_from_config ?? false; return (
{ if (toolId && !isFromConfig) { onEdit(toolId); } }} /> { if (toolId && !isFromConfig) { onDelete(toolId); } }} />
); }, }, ];