mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
feat: icons for chat identification (#879)
* Added endpoint picture * plugin icon fix & new minimalist icon * changed from BingAIMinimalIcon to BingAIMinimalistIcon * fix(Conversation) reduced the space between the icon and the title * refactor(getIcon & getMinimalIcon) * moved IconProps in ~/common * refactor(getIcon & getMinimalistIcon) from switch/case to map * fix(getIcon.tsx) renamed to Icon * renamed all from Minimalist to Minimal
This commit is contained in:
parent
6358383001
commit
2419af8748
18 changed files with 356 additions and 126 deletions
58
client/src/components/Endpoints/MinimalIcon.tsx
Normal file
58
client/src/components/Endpoints/MinimalIcon.tsx
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
import React from 'react';
|
||||
import {
|
||||
AzureMinimalIcon,
|
||||
OpenAIMinimalIcon,
|
||||
ChatGPTMinimalIcon,
|
||||
PluginMinimalIcon,
|
||||
BingAIMinimalIcon,
|
||||
PaLMinimalIcon,
|
||||
AnthropicMinimalIcon,
|
||||
} from '~/components/svg';
|
||||
import { cn } from '~/utils';
|
||||
import { IconProps } from '~/common';
|
||||
|
||||
const MinimalIcon: React.FC<IconProps> = (props) => {
|
||||
const { size = 30, error } = props;
|
||||
|
||||
let endpoint = 'default'; // Default value for endpoint
|
||||
|
||||
if (typeof props.endpoint === 'string') {
|
||||
endpoint = props.endpoint;
|
||||
}
|
||||
|
||||
const endpointIcons = {
|
||||
azureOpenAI: { icon: <AzureMinimalIcon />, name: props.chatGptLabel || 'ChatGPT' },
|
||||
openAI: { icon: <OpenAIMinimalIcon />, name: props.chatGptLabel || 'ChatGPT' },
|
||||
gptPlugins: { icon: <PluginMinimalIcon />, name: 'Plugins' },
|
||||
google: { icon: <PaLMinimalIcon />, name: props.modelLabel || 'PaLM2' },
|
||||
anthropic: { icon: <AnthropicMinimalIcon />, name: props.modelLabel || 'Claude' },
|
||||
bingAI: { icon: <BingAIMinimalIcon />, name: 'BingAI' },
|
||||
chatGPTBrowser: { icon: <ChatGPTMinimalIcon />, name: 'ChatGPT' },
|
||||
default: { icon: <OpenAIMinimalIcon />, name: 'UNKNOWN' },
|
||||
};
|
||||
|
||||
const { icon, name } = endpointIcons[endpoint];
|
||||
|
||||
return (
|
||||
<div
|
||||
title={name}
|
||||
style={{
|
||||
width: size,
|
||||
height: size,
|
||||
}}
|
||||
className={cn(
|
||||
'relative flex items-center justify-center rounded-sm text-white',
|
||||
props.className || '',
|
||||
)}
|
||||
>
|
||||
{icon}
|
||||
{error && (
|
||||
<span className="absolute right-0 top-[20px] -mr-2 flex h-4 w-4 items-center justify-center rounded-full border border-white bg-red-500 text-[10px] text-white">
|
||||
!
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default MinimalIcon;
|
||||
Loading…
Add table
Add a link
Reference in a new issue