import { EModelEndpoint } from 'librechat-data-provider'; import { Plugin, GPTIcon, AnthropicIcon, AzureMinimalIcon } from '~/components/svg'; import { useAuthContext } from '~/hooks'; import { IconProps } from '~/common'; import { cn } from '~/utils'; const Icon: React.FC = (props) => { const { size = 30, isCreatedByUser, button, model = true, endpoint, error, jailbreak } = props; const { user } = useAuthContext(); if (isCreatedByUser) { const username = user?.name || 'User'; return (
avatar
); } else { const endpointIcons = { [EModelEndpoint.azureOpenAI]: { icon: , bg: 'linear-gradient(0.375turn, #61bde2, #4389d0)', name: 'ChatGPT', }, [EModelEndpoint.openAI]: { icon: , bg: typeof model === 'string' && model.toLowerCase().includes('gpt-4') ? '#AB68FF' : '#19C37D', name: 'ChatGPT', }, [EModelEndpoint.gptPlugins]: { icon: , bg: `rgba(69, 89, 164, ${button ? 0.75 : 1})`, name: 'Plugins', }, [EModelEndpoint.google]: { icon: Palm Icon, name: 'PaLM2', }, [EModelEndpoint.anthropic]: { icon: , bg: '#d09a74', name: 'Claude', }, [EModelEndpoint.bingAI]: { icon: jailbreak ? ( Bing Icon ) : ( Sydney Icon ), name: jailbreak ? 'Sydney' : 'BingAI', }, [EModelEndpoint.chatGPTBrowser]: { icon: , bg: typeof model === 'string' && model.toLowerCase().includes('gpt-4') ? '#AB68FF' : `rgba(0, 163, 255, ${button ? 0.75 : 1})`, name: 'ChatGPT', }, null: { icon: , bg: 'grey', name: 'N/A' }, default: { icon: , bg: 'grey', name: 'UNKNOWN' }, }; const { icon, bg, name } = endpoint && endpointIcons[endpoint] ? endpointIcons[endpoint] : endpointIcons.default; return (
{icon} {error && ( ! )}
); } }; export default Icon;