import React from 'react'; import { Plugin, GPTIcon, AnthropicIcon, AzureMinimalIcon } from '~/components/svg'; import { useAuthContext } from '~/hooks'; import { cn } from '~/utils'; import { IconProps } from '~/common'; 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 = { azureOpenAI: { icon: , bg: 'linear-gradient(0.375turn, #61bde2, #4389d0)', name: 'ChatGPT', }, openAI: { icon: , bg: typeof model === 'string' && model.toLowerCase().includes('gpt-4') ? '#AB68FF' : '#19C37D', name: 'ChatGPT', }, gptPlugins: { icon: , bg: `rgba(69, 89, 164, ${button ? 0.75 : 1})`, name: 'Plugins', }, google: { icon: Palm Icon, name: 'PaLM2' }, anthropic: { icon: , bg: '#d09a74', name: 'Claude', }, bingAI: { icon: jailbreak ? ( Bing Icon ) : ( Sydney Icon ), name: jailbreak ? 'Sydney' : 'BingAI', }, 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 } = endpointIcons[endpoint ?? 'default']; return (
{icon} {error && ( ! )}
); } }; export default Icon;