import { EModelEndpoint, isAssistantsEndpoint } from 'librechat-data-provider'; import UnknownIcon from '~/components/Chat/Menus/Endpoints/UnknownIcon'; import { Plugin, GPTIcon, PaLMIcon, CodeyIcon, GeminiIcon, AssistantIcon, AnthropicIcon, AzureMinimalIcon, CustomMinimalIcon, } from '~/components/svg'; import { IconProps } from '~/common'; import { cn } from '~/utils'; const MessageEndpointIcon: React.FC = (props) => { const { error, button, iconURL, endpoint, jailbreak, size = 30, model = '', assistantName, } = props; const assistantsIcon = { icon: props.iconURL ? (
{assistantName}
) : (
), name: endpoint, }; const endpointIcons = { [EModelEndpoint.assistants]: assistantsIcon, [EModelEndpoint.azureAssistants]: assistantsIcon, [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, }, }; let { icon, bg, name } = endpoint && endpointIcons[endpoint] ? endpointIcons[endpoint] : endpointIcons.default; if (iconURL && endpointIcons[iconURL]) { ({ icon, bg, name } = endpointIcons[iconURL]); } if (isAssistantsEndpoint(endpoint)) { return icon; } return (
{icon} {error && ( ! )}
); }; export default MessageEndpointIcon;