import React, { memo } from 'react'; import type { TPreset } from 'librechat-data-provider'; import type { IconMapProps } from '~/common'; import { icons } from '~/components/Chat/Menus/Endpoints/Icons'; interface ConvoIconURLProps { preset: TPreset | null; endpointIconURL?: string; assistantName?: string; agentName?: string; context?: 'landing' | 'menu-item' | 'nav' | 'message'; assistantAvatar?: string; agentAvatar?: string; } const classMap = { 'menu-item': 'relative flex h-full items-center justify-center overflow-hidden rounded-full', message: 'icon-md', default: 'icon-xl relative flex h-full overflow-hidden rounded-full', }; const styleMap = { 'menu-item': { width: '20px', height: '20px' }, default: { width: '100%', height: '100%' }, }; const styleImageMap = { default: { width: '100%', height: '100%' }, }; const ConvoIconURL: React.FC = ({ preset, endpointIconURL, assistantAvatar, assistantName, agentAvatar, agentName, context, }) => { const { iconURL = '' } = preset ?? {}; let Icon: ( props: IconMapProps & { context?: string; iconURL?: string; }, ) => React.JSX.Element; const isURL = !!(iconURL && (iconURL.includes('http') || iconURL.startsWith('/images/'))); if (!isURL) { Icon = icons[iconURL] ?? icons.unknown; } else { Icon = () => (
{preset?.chatGptLabel
); return ; } return (
); }; export default memo(ConvoIconURL);