✨ feat: Add 'platform' type to Avatar and extend model icon mappings for new platforms

This commit is contained in:
canisminor1990
2025-06-03 14:00:33 +08:00
parent d1bc295b96
commit 8b43e188f4
5 changed files with 51 additions and 12 deletions
+13 -2
View File
@@ -4,11 +4,18 @@ import { memo } from 'react';
import IconAvatar, { type IconAvatarProps } from '@/features/IconAvatar';
import { COLOR_GPT_3, COLOR_GPT_4, COLOR_O_1, COLOR_PRIMARY, TITLE } from '../style';
import {
COLOR_GPT_3,
COLOR_GPT_4,
COLOR_O_1,
COLOR_PLATFORM,
COLOR_PRIMARY,
TITLE,
} from '../style';
import Mono from './Mono';
export interface AvatarProps extends Omit<IconAvatarProps, 'Icon'> {
type?: 'normal' | 'gpt3' | 'gpt4' | 'o1' | 'o3';
type?: 'normal' | 'gpt3' | 'gpt4' | 'o1' | 'o3' | 'platform';
}
const Avatar = memo<AvatarProps>(({ background, type = 'normal', ...rest }) => {
@@ -28,6 +35,10 @@ const Avatar = memo<AvatarProps>(({ background, type = 'normal', ...rest }) => {
bg = COLOR_O_1;
break;
}
case 'platform': {
bg = COLOR_PLATFORM;
break;
}
default: {
bg = background || COLOR_PRIMARY;
}
+2
View File
@@ -49,6 +49,7 @@ export default () => (
<OpenAI.Avatar size={64} type={'gpt3'} />
<OpenAI.Avatar size={64} type={'gpt4'} />
<OpenAI.Avatar size={64} type={'o1'} />
<OpenAI.Avatar size={64} type={'platform'} />
<OpenAI.Avatar size={64} shape={'square'} />
</Flexbox>
);
@@ -68,6 +69,7 @@ export default () => (
<ColorPreview color={OpenAI.colorGpt3} />
<ColorPreview color={OpenAI.colorGpt4} />
<ColorPreview color={OpenAI.colorO1} />
<ColorPreview color={OpenAI.colorPlatform} />
</Flexbox>
);
```
+4 -1
View File
@@ -2,7 +2,7 @@ import Avatar from './components/Avatar';
import Combine from './components/Combine';
import Mono from './components/Mono';
import Text from './components/Text';
import { COLOR_GPT_3, COLOR_GPT_4, COLOR_O_1, COLOR_PRIMARY, TITLE } from './style';
import { COLOR_GPT_3, COLOR_GPT_4, COLOR_O_1, COLOR_PLATFORM, COLOR_PRIMARY, TITLE } from './style';
export type CompoundedIcon = typeof Mono & {
Avatar: typeof Avatar;
@@ -11,6 +11,7 @@ export type CompoundedIcon = typeof Mono & {
colorGpt3: string;
colorGpt4: string;
colorO1: string;
colorPlatform?: string;
colorPrimary: string;
title: string;
};
@@ -23,5 +24,7 @@ Icons.colorPrimary = COLOR_PRIMARY;
Icons.colorGpt3 = COLOR_GPT_3;
Icons.colorGpt4 = COLOR_GPT_4;
Icons.colorO1 = COLOR_O_1;
Icons.colorPlatform = COLOR_PLATFORM;
Icons.title = TITLE;
export default Icons;
+1
View File
@@ -6,3 +6,4 @@ export const COLOR_PRIMARY = '#000';
export const COLOR_GPT_3 = '#19C37D';
export const COLOR_GPT_4 = '#AB68FF';
export const COLOR_O_1 = '#F9C322';
export const COLOR_PLATFORM = '#0000FE';
+31 -9
View File
@@ -5,6 +5,7 @@ import Ai21 from '@/Ai21';
import Ai360 from '@/Ai360';
import AiMass from '@/AiMass';
import AionLabs from '@/AionLabs';
import Anthropic from '@/Anthropic';
import AssemblyAI from '@/AssemblyAI';
import Aws from '@/Aws';
import Aya from '@/Aya';
@@ -53,6 +54,7 @@ import Stepfun from '@/Stepfun';
import Suno from '@/Suno';
import Udio from '@/Udio';
import Upstage from '@/Upstage';
import VertexAI from '@/VertexAI';
import Voyage from '@/Voyage';
import Wenxin from '@/Wenxin';
import Yi from '@/Yi';
@@ -86,18 +88,37 @@ export const modelMappings: ModelMapping[] = [
props: { type: 'o1' },
},
{ Icon: Dalle, keywords: ['dalle', 'dall-e'] },
{ Icon: OpenAI, keywords: ['^gpt-', '/gpt-', 'openai', 'text-embedding-', 'tts-', 'whisper-'] },
{ Icon: ChatGLM, keywords: ['glm-', 'chatglm'] },
{ Icon: CodeGeeX, keywords: ['^codegeex'] },
{
Icon: OpenAI,
keywords: [
'text-embedding-',
'tts-',
'whisper-',
'codex',
'davinci',
'babbage',
'omni-moderation',
'text-moderation',
'text-adb',
'computer-use',
],
props: { type: 'platform' },
},
{
Icon: OpenAI,
keywords: ['^gpt-', '/gpt-', 'openai'],
},
{ Icon: ChatGLM, keywords: ['^glm-', '/glm-', 'chatglm'] },
{ Icon: CodeGeeX, keywords: ['^codegeex', '/codegeex'] },
{ Icon: Claude, keywords: ['claude'] },
{ Icon: Anthropic, keywords: ['anthropic'] },
{ Icon: Aws, keywords: ['titan'] },
{ Icon: Fireworks, keywords: ['accounts/fireworks/models/fire'] },
{ Icon: InternLM, keywords: ['internlm', 'internvl'] },
{ Icon: Meta, keywords: ['llama', '/l3'] },
{ Icon: LLaVA, keywords: ['llava'] },
{ Icon: Gemini, keywords: ['gemini'] },
// google is imagen-4.0-ultra-generate-exp-05-20; fal is imagen4/preview
{ Icon: DeepMind, keywords: ['^imagen-', '^imagen\\d/'] },
{ Icon: DeepMind, keywords: ['^imagen-', '/imagen-', '^imagen\\d/'] },
{ Icon: Gemma, keywords: ['gemma'] },
{ Icon: Moonshot, keywords: ['kimi', 'moonshot'] },
{ Icon: Qiniu, keywords: ['qiniu'] },
@@ -120,7 +141,7 @@ export const modelMappings: ModelMapping[] = [
{ Icon: Baichuan, keywords: ['baichuan'] },
{ Icon: Rwkv, keywords: ['rwkv', '/eagle-'] },
{ Icon: Wenxin, keywords: ['ernie'] },
{ Icon: Jina, keywords: ['^jina'] },
{ Icon: Jina, keywords: ['^jina', '/jina'] },
{ Icon: Doubao, keywords: ['^ep-', 'doubao-'] },
{ Icon: Hunyuan, keywords: ['hunyuan'] },
{ Icon: FishAudio, keywords: ['^d_', '^g_', '^wd_'] },
@@ -141,14 +162,13 @@ export const modelMappings: ModelMapping[] = [
},
{ Icon: Flux, keywords: ['flux'] },
{ Icon: Suno, keywords: ['suno'] },
{ Icon: Microsoft, keywords: ['wizardlm', 'phi3', 'phi4', '^/phi-', '^phi-'] },
{ Icon: Microsoft, keywords: ['wizardlm', '/phi-', '^phi-', '-phi-'] },
{ Icon: Adobe, keywords: ['firefly'] },
{ Icon: Ai21, keywords: ['jamba', '^j2-', 'ai21'] },
{ Icon: Upstage, keywords: ['^solar-', '/solar'] },
{ Icon: PaLM, keywords: ['palm'] },
{ Icon: Google, keywords: ['google'] },
{ Icon: SenseNova, keywords: ['SenseChat', 'SenseNova'] },
{ Icon: Grok, keywords: ['^grok-'] },
{ Icon: Grok, keywords: ['^grok-', '/grok-'] },
{ Icon: Ideogram, keywords: ['ideogram'] },
{
Icon: Spark,
@@ -171,4 +191,6 @@ export const modelMappings: ModelMapping[] = [
{ Icon: Liquid, keywords: ['liquid', 'lfm'] },
{ Icon: Inflection, keywords: ['inflection-'] },
{ Icon: AionLabs, keywords: ['aion-'] },
{ Icon: VertexAI, keywords: ['^veo-', '/veo-'] },
{ Icon: Google, keywords: ['google'] },
];