import React, { useMemo } from 'react'; import { Label } from '@librechat/client'; import type t from 'librechat-data-provider'; import { useLocalize, TranslationKeys, useAgentCategories } from '~/hooks'; import { cn, renderAgentAvatar, getContactDisplayName } from '~/utils'; interface AgentCardProps { agent: t.Agent; // The agent data to display onClick: () => void; // Callback when card is clicked className?: string; // Additional CSS classes } /** * Card component to display agent information */ const AgentCard: React.FC = ({ agent, onClick, className = '' }) => { const localize = useLocalize(); const { categories } = useAgentCategories(); const categoryLabel = useMemo(() => { if (!agent.category) return ''; const category = categories.find((cat) => cat.value === agent.category); if (category) { if (category.label && category.label.startsWith('com_')) { return localize(category.label as TranslationKeys); } return category.label; } return agent.category.charAt(0).toUpperCase() + agent.category.slice(1); }, [agent.category, categories, localize]); return (
{ if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); onClick(); } }} > {/* Two column layout */}
{/* Left column: Avatar and Category */}
{renderAgentAvatar(agent, { size: 'sm' })}
{/* Category tag */} {agent.category && (
)}
{/* Right column: Name, description, and other content */}
{/* Agent name */} {/* Agent description */}

{agent.description ?? ''}

{/* Owner info - moved to bottom right */} {(() => { const displayName = getContactDisplayName(agent); if (displayName) { return (
); } return null; })()}
); }; export default AgentCard;