import { EModelEndpoint } from 'librechat-data-provider'; import UnknownIcon from '~/components/Chat/Menus/Endpoints/UnknownIcon'; import { Plugin, GPTIcon, AnthropicIcon, AzureMinimalIcon, CustomMinimalIcon, PaLMIcon, CodeyIcon, GeminiIcon, } from '~/components/svg'; import { useAuthContext } from '~/hooks/AuthContext'; import { IconProps } from '~/common'; import { cn } from '~/utils'; const Icon: React.FC = (props) => { const { user } = useAuthContext(); const { size = 30, isCreatedByUser, button, model = '', endpoint, error, jailbreak } = props; 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: model?.toLowerCase()?.includes('code') ? ( ) : model?.toLowerCase()?.includes('gemini') ? ( ) : ( ), name: model?.toLowerCase()?.includes('code') ? 'Codey' : model?.toLowerCase()?.includes('gemini') ? 'Gemini' : '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', }, [EModelEndpoint.custom]: { icon: , name: 'Custom', }, null: { icon: , bg: 'grey', name: 'N/A' }, default: { icon: ( ), name: endpoint, }, }; const { icon, bg, name } = endpoint && endpointIcons[endpoint] ? endpointIcons[endpoint] : endpointIcons.default; return (
{icon} {error && ( ! )}
); } }; export default Icon;