feat(user-models): fall back to category icon when no brand logo matches

This commit is contained in:
jialin
2026-07-16 18:00:27 +08:00
committed by jialin
parent e30dd10fe4
commit d8cb5261b9
8 changed files with 172 additions and 6 deletions
+17 -2
View File
@@ -20,7 +20,11 @@ import {
MyModelsStatusValueMap
} from '../config';
import { categoryToPathMap } from '../config/button-actions';
import { getModelLogo } from '../utils/model-logo';
import {
defaultModelLogo,
getCategoryLogo,
getModelLogo
} from '../utils/model-logo';
const CardWrapper = styled.div`
&:hover {
@@ -165,6 +169,11 @@ const ModelItem: React.FC<{
navigate(`/playground/chat?model=${modelName}`);
};
// Logo priority: brand logo matched from the name → tinted category
// icon (from model_icons) → generic default image.
const brandLogo = getModelLogo(model.name);
const categoryLogo = brandLogo ? null : getCategoryLogo(model.categories);
// context length
const maxToken = useMemo(() => {
const meta = model.meta || {};
@@ -194,7 +203,13 @@ const ModelItem: React.FC<{
header={
<Header>
<span className="text gap-16">
<ModelLogo src={getModelLogo(model.name)} alt="" />
{brandLogo ? (
<ModelLogo src={brandLogo} alt="" />
) : categoryLogo ? (
<ModelLogo src={categoryLogo} alt="" />
) : (
<ModelLogo src={defaultModelLogo} alt="" />
)}
<span>{model.name}</span>
</span>
<StatusTag