= (props) => {
const {
error,
button,
iconURL = '',
endpoint,
jailbreak,
size = 30,
model = '',
assistantName,
agentName,
} = props;
const assistantsIcon = {
icon: iconURL ? (
) : (
),
name: endpoint,
};
const agentsIcon = {
icon: iconURL ? (
) : (
),
name: endpoint,
};
const endpointIcons: {
[key: string]: EndpointIcon | undefined;
} = {
[EModelEndpoint.assistants]: assistantsIcon,
[EModelEndpoint.agents]: agentsIcon,
[EModelEndpoint.azureAssistants]: assistantsIcon,
[EModelEndpoint.azureOpenAI]: {
icon: ,
bg: 'linear-gradient(0.375turn, #61bde2, #4389d0)',
name: 'ChatGPT',
},
[EModelEndpoint.openAI]: {
icon: ,
bg: getOpenAIColor(model),
name: 'ChatGPT',
},
[EModelEndpoint.gptPlugins]: {
icon: ,
bg: `rgba(69, 89, 164, ${button === true ? 0.75 : 1})`,
name: 'Plugins',
},
[EModelEndpoint.google]: {
icon: getGoogleIcon(model, size),
name: getGoogleModelName(model),
},
[EModelEndpoint.anthropic]: {
icon: ,
bg: '#d09a74',
name: 'Claude',
},
[EModelEndpoint.bedrock]: {
icon: ,
bg: '#268672',
name: alternateName[EModelEndpoint.bedrock],
},
[EModelEndpoint.bingAI]: {
icon:
jailbreak === true ? (
) : (
),
name: jailbreak === true ? 'Sydney' : 'BingAI',
},
[EModelEndpoint.chatGPTBrowser]: {
icon: ,
bg:
typeof model === 'string' && model.toLowerCase().includes('gpt-4')
? '#AB68FF'
: `rgba(0, 163, 255, ${button === true ? 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 != null && endpoint && endpointIcons[endpoint]
? endpointIcons[endpoint] ?? {}
: (endpointIcons.default as EndpointIcon);
if (iconURL && endpointIcons[iconURL]) {
({ icon, bg, name } = endpointIcons[iconURL]);
}
if (isAssistantsEndpoint(endpoint)) {
return icon;
}
return (
{icon}
{error === true && (
!
)}
);
};
export default memo(MessageEndpointIcon);