fix(pricing): sync custom model icons #5224

Merge pull request #5224 from QuantumNous/fix/pricing-model-icons
This commit is contained in:
同語
2026-06-01 18:17:58 +08:00
committed by GitHub
4 changed files with 13 additions and 9 deletions
+4 -3
View File
@@ -56,8 +56,9 @@ export const ModelCard = memo(function ModelCard(props: ModelCardProps) {
const tags = parseTags(props.model.tags) const tags = parseTags(props.model.tags)
const groups = props.model.enable_groups || [] const groups = props.model.enable_groups || []
const endpoints = props.model.supported_endpoint_types || [] const endpoints = props.model.supported_endpoint_types || []
const vendorIcon = props.model.vendor_icon const modelIconKey = props.model.icon || props.model.vendor_icon
? getLobeIcon(props.model.vendor_icon, 28) const modelIcon = modelIconKey
? getLobeIcon(modelIconKey, 28)
: null : null
const initial = props.model.model_name?.charAt(0).toUpperCase() || '?' const initial = props.model.model_name?.charAt(0).toUpperCase() || '?'
const isDynamicPricing = const isDynamicPricing =
@@ -97,7 +98,7 @@ export const ModelCard = memo(function ModelCard(props: ModelCardProps) {
<div className='flex items-start justify-between gap-2.5 sm:gap-3'> <div className='flex items-start justify-between gap-2.5 sm:gap-3'>
<div className='flex min-w-0 items-start gap-2.5 sm:gap-3'> <div className='flex min-w-0 items-start gap-2.5 sm:gap-3'>
<div className='bg-muted/40 flex size-9 shrink-0 items-center justify-center rounded-lg sm:size-10 sm:rounded-xl'> <div className='bg-muted/40 flex size-9 shrink-0 items-center justify-center rounded-lg sm:size-10 sm:rounded-xl'>
{vendorIcon || ( {modelIcon || (
<span className='text-muted-foreground text-sm font-bold'> <span className='text-muted-foreground text-sm font-bold'>
{initial} {initial}
</span> </span>
@@ -268,8 +268,9 @@ function OverviewSummaryGrid(props: { model: PricingModel }) {
function ModelHeader(props: { model: PricingModel }) { function ModelHeader(props: { model: PricingModel }) {
const { t } = useTranslation() const { t } = useTranslation()
const model = props.model const model = props.model
const vendorIcon = model.vendor_icon const modelIconKey = model.icon || model.vendor_icon
? getLobeIcon(model.vendor_icon, 20) const modelIcon = modelIconKey
? getLobeIcon(modelIconKey, 20)
: null : null
const description = model.description || model.vendor_description || null const description = model.description || model.vendor_description || null
const tags = parseTags(model.tags) const tags = parseTags(model.tags)
@@ -281,7 +282,7 @@ function ModelHeader(props: { model: PricingModel }) {
return ( return (
<header className='pb-4'> <header className='pb-4'>
<div className='flex items-center gap-2.5'> <div className='flex items-center gap-2.5'>
{vendorIcon} {modelIcon}
<h1 className='font-mono text-xl font-bold tracking-tight sm:text-2xl'> <h1 className='font-mono text-xl font-bold tracking-tight sm:text-2xl'>
{model.model_name} {model.model_name}
</h1> </h1>
@@ -106,13 +106,14 @@ export function usePricingColumns(
), ),
cell: ({ row }) => { cell: ({ row }) => {
const model = row.original const model = row.original
const vendorIcon = model.vendor_icon const modelIconKey = model.icon || model.vendor_icon
? getLobeIcon(model.vendor_icon, 14) const modelIcon = modelIconKey
? getLobeIcon(modelIconKey, 14)
: null : null
return ( return (
<div className='flex min-w-[200px] items-center gap-2'> <div className='flex min-w-[200px] items-center gap-2'>
{vendorIcon} {modelIcon}
<span className='truncate font-mono text-sm font-medium'> <span className='truncate font-mono text-sm font-medium'>
{model.model_name} {model.model_name}
</span> </span>
+1
View File
@@ -31,6 +31,7 @@ export type PricingModel = {
id: number id: number
model_name: string model_name: string
description?: string description?: string
icon?: string
vendor_id?: number vendor_id?: number
vendor_name?: string vendor_name?: string
vendor_icon?: string vendor_icon?: string