import React from 'react'; import type { TModelSpec, TEndpointsConfig } from 'librechat-data-provider'; import type { IconMapProps } from '~/common'; import { getModelSpecIconURL, getIconKey, getEndpointField } from '~/utils'; import { icons } from '~/components/Chat/Menus/Endpoints/Icons'; interface SpecIconProps { currentSpec: TModelSpec; endpointsConfig: TEndpointsConfig; } const SpecIcon: React.FC = ({ currentSpec, endpointsConfig }) => { const iconURL = getModelSpecIconURL(currentSpec); const { endpoint } = currentSpec.preset; const endpointIconURL = getEndpointField(endpointsConfig, endpoint, 'iconURL'); const iconKey = getIconKey({ endpoint, endpointsConfig, endpointIconURL }); let Icon: (props: IconMapProps) => React.JSX.Element; if (!iconURL?.includes('http')) { Icon = icons[iconKey] ?? icons.unknown; } else { Icon = iconURL ? () => (
{currentSpec.name}
) : icons[endpoint ?? ''] ?? icons.unknown; } return ( ); }; export default SpecIcon;