Skip to content

Commit c5826ce

Browse files
committed
💄 style: improve logo style
1 parent 1ba90d3 commit c5826ce

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

src/app/api/chat/models/[provider]/route.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@ export const runtime = 'edge';
1212

1313
export const preferredRegion = getPreferredRegion();
1414

15+
const noNeedAPIKey = (provider: string) =>
16+
[ModelProvider.OpenRouter, ModelProvider.TogetherAI].includes(provider as any);
17+
1518
export const GET = checkAuth(async (req, { params, jwtPayload }) => {
1619
const { provider } = params;
1720

1821
try {
19-
const openRouterKey = jwtPayload.apiKey || 'openrouter-dont-need-api-key-for-model-list';
22+
const hasDefaultApiKey = jwtPayload.apiKey || 'dont-need-api-key-for-model-list';
2023

2124
const agentRuntime = await AgentRuntime.initializeWithUserPayload(provider, {
2225
...jwtPayload,
23-
apiKey: provider === ModelProvider.OpenRouter ? openRouterKey : jwtPayload.apiKey,
26+
apiKey: noNeedAPIKey(provider) ? hasDefaultApiKey : jwtPayload.apiKey,
2427
});
2528

2629
const list = await agentRuntime.models();

src/components/ModelIcon/index.tsx

+19-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@ import {
33
Baichuan,
44
ChatGLM,
55
Claude,
6+
Cohere,
67
Gemini,
78
Gemma,
9+
Hunyuan,
810
LLaVA,
911
Meta,
1012
Minimax,
1113
Mistral,
1214
Moonshot,
1315
OpenAI,
16+
OpenRouter,
1417
Perplexity,
18+
Spark,
1519
Tongyi,
20+
Wenxin,
1621
Yi,
1722
} from '@lobehub/icons';
1823
import { memo } from 'react';
@@ -28,9 +33,9 @@ const ModelIcon = memo<ModelProviderIconProps>(({ model: originModel, size = 12
2833
// lower case the origin model so to better match more model id case
2934
const model = originModel.toLowerCase();
3035

31-
if (model.startsWith('gpt-3')) return <OpenAI.Avatar size={size} type={'gpt3'} />;
32-
if (model.startsWith('gpt-4')) return <OpenAI.Avatar size={size} type={'gpt4'} />;
33-
if (model.startsWith('glm')) return <ChatGLM.Avatar size={size} />;
36+
if (model.includes('gpt-3')) return <OpenAI.Avatar size={size} type={'gpt3'} />;
37+
if (model.includes('gpt-4')) return <OpenAI.Avatar size={size} type={'gpt4'} />;
38+
if (model.startsWith('glm') || model.includes('chatglm')) return <ChatGLM.Avatar size={size} />;
3439
if (model.includes('claude')) return <Claude.Avatar size={size} />;
3540
if (model.includes('titan')) return <Aws.Avatar size={size} />;
3641
if (model.includes('llama')) return <Meta.Avatar size={size} />;
@@ -42,9 +47,19 @@ const ModelIcon = memo<ModelProviderIconProps>(({ model: originModel, size = 12
4247
if (model.includes('moonshot')) return <Moonshot.Avatar size={size} />;
4348
if (model.includes('baichuan'))
4449
return <Baichuan.Avatar background={Baichuan.colorPrimary} size={size} />;
50+
4551
if (model.includes('mistral') || model.includes('mixtral')) return <Mistral.Avatar size={size} />;
46-
if (model.includes('pplx')) return <Perplexity.Avatar size={size} />;
52+
53+
if (model.includes('pplx') || model.includes('sonar')) return <Perplexity.Avatar size={size} />;
54+
4755
if (model.includes('yi-')) return <Yi.Avatar size={size} />;
56+
if (model.includes('openrouter')) return <OpenRouter.Avatar size={size} />;
57+
if (model.includes('command')) return <Cohere.Color size={size} />;
58+
59+
if (model.includes('ernie')) return <Wenxin.Avatar size={size} />;
60+
if (model.includes('spark')) return <Spark.Avatar size={size} />;
61+
if (model.includes('hunyuan')) return <Hunyuan.Avatar size={size} />;
62+
if (model.includes('abab')) return <Minimax.Avatar size={size} />;
4863
});
4964

5065
export default ModelIcon;

0 commit comments

Comments
 (0)