Skip to content

Commit

Permalink
💄 style: improve logo style
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Apr 10, 2024
1 parent 1ba90d3 commit c5826ce
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/app/api/chat/models/[provider]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ export const runtime = 'edge';

export const preferredRegion = getPreferredRegion();

const noNeedAPIKey = (provider: string) =>
[ModelProvider.OpenRouter, ModelProvider.TogetherAI].includes(provider as any);

export const GET = checkAuth(async (req, { params, jwtPayload }) => {
const { provider } = params;

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

const agentRuntime = await AgentRuntime.initializeWithUserPayload(provider, {
...jwtPayload,
apiKey: provider === ModelProvider.OpenRouter ? openRouterKey : jwtPayload.apiKey,
apiKey: noNeedAPIKey(provider) ? hasDefaultApiKey : jwtPayload.apiKey,
});

const list = await agentRuntime.models();
Expand Down
23 changes: 19 additions & 4 deletions src/components/ModelIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@ import {
Baichuan,
ChatGLM,
Claude,
Cohere,
Gemini,
Gemma,
Hunyuan,
LLaVA,
Meta,
Minimax,
Mistral,
Moonshot,
OpenAI,
OpenRouter,
Perplexity,
Spark,
Tongyi,
Wenxin,
Yi,
} from '@lobehub/icons';
import { memo } from 'react';
Expand All @@ -28,9 +33,9 @@ const ModelIcon = memo<ModelProviderIconProps>(({ model: originModel, size = 12
// lower case the origin model so to better match more model id case
const model = originModel.toLowerCase();

if (model.startsWith('gpt-3')) return <OpenAI.Avatar size={size} type={'gpt3'} />;
if (model.startsWith('gpt-4')) return <OpenAI.Avatar size={size} type={'gpt4'} />;
if (model.startsWith('glm')) return <ChatGLM.Avatar size={size} />;
if (model.includes('gpt-3')) return <OpenAI.Avatar size={size} type={'gpt3'} />;
if (model.includes('gpt-4')) return <OpenAI.Avatar size={size} type={'gpt4'} />;
if (model.startsWith('glm') || model.includes('chatglm')) return <ChatGLM.Avatar size={size} />;
if (model.includes('claude')) return <Claude.Avatar size={size} />;
if (model.includes('titan')) return <Aws.Avatar size={size} />;
if (model.includes('llama')) return <Meta.Avatar size={size} />;
Expand All @@ -42,9 +47,19 @@ const ModelIcon = memo<ModelProviderIconProps>(({ model: originModel, size = 12
if (model.includes('moonshot')) return <Moonshot.Avatar size={size} />;
if (model.includes('baichuan'))
return <Baichuan.Avatar background={Baichuan.colorPrimary} size={size} />;

if (model.includes('mistral') || model.includes('mixtral')) return <Mistral.Avatar size={size} />;
if (model.includes('pplx')) return <Perplexity.Avatar size={size} />;

if (model.includes('pplx') || model.includes('sonar')) return <Perplexity.Avatar size={size} />;

if (model.includes('yi-')) return <Yi.Avatar size={size} />;
if (model.includes('openrouter')) return <OpenRouter.Avatar size={size} />;
if (model.includes('command')) return <Cohere.Color size={size} />;

if (model.includes('ernie')) return <Wenxin.Avatar size={size} />;
if (model.includes('spark')) return <Spark.Avatar size={size} />;
if (model.includes('hunyuan')) return <Hunyuan.Avatar size={size} />;
if (model.includes('abab')) return <Minimax.Avatar size={size} />;
});

export default ModelIcon;

0 comments on commit c5826ce

Please sign in to comment.