diff --git a/web/src/components/common/ui/CardTable.js b/web/src/components/common/ui/CardTable.js index f91ff200..f7f443db 100644 --- a/web/src/components/common/ui/CardTable.js +++ b/web/src/components/common/ui/CardTable.js @@ -41,7 +41,7 @@ const CardTable = ({ }) => { const isMobile = useIsMobile(); const { t } = useTranslation(); - + const showSkeleton = useMinimumLoadingTime(loading); const getRowKey = (record, index) => { diff --git a/web/src/components/table/model-pricing/view/table/PricingTableColumns.js b/web/src/components/table/model-pricing/view/table/PricingTableColumns.js index e2b34cce..18e1fc89 100644 --- a/web/src/components/table/model-pricing/view/table/PricingTableColumns.js +++ b/web/src/components/table/model-pricing/view/table/PricingTableColumns.js @@ -23,31 +23,23 @@ import { IconHelpCircle } from '@douyinfe/semi-icons'; import { renderModelTag, stringToColor, calculateModelPrice, getLobeHubIcon } from '../../../../../helpers'; import { renderLimitedItems, renderDescription } from '../../../../common/ui/RenderUtils'; -function renderQuotaTypes(types, t) { - if (!Array.isArray(types) || types.length === 0) return '-'; - const renderOne = (type, idx) => { - switch (type) { - case 1: - return ( - - {t('按次计费')} - - ); - case 0: - return ( - - {t('按量计费')} - - ); - default: - return ( - - {type} - - ); - } - }; - return {types.map((t0, idx) => renderOne(t0, idx))}; +function renderQuotaType(type, t) { + switch (type) { + case 1: + return ( + + {t('按次计费')} + + ); + case 0: + return ( + + {t('按量计费')} + + ); + default: + return t('未知'); + } } // Render vendor name @@ -130,8 +122,11 @@ export const getPricingTableColumns = ({ const quotaColumn = { title: t('计费类型'), - dataIndex: 'quota_types', - render: (text, record, index) => renderQuotaTypes(text, t), + dataIndex: 'quota_type', + render: (text, record, index) => { + return renderQuotaType(parseInt(text), t); + }, + sorter: (a, b) => a.quota_type - b.quota_type, }; const descriptionColumn = { @@ -175,11 +170,11 @@ export const getPricingTableColumns = ({ const content = (
- {t('模型倍率')}:{Array.isArray(record.quota_types) && record.quota_types.includes(0) ? text : t('无')} + {t('模型倍率')}:{record.quota_type === 0 ? text : t('无')}
{t('补全倍率')}: - {Array.isArray(record.quota_types) && record.quota_types.includes(0) ? completionRatio : t('无')} + {record.quota_type === 0 ? completionRatio : t('无')}
{t('分组倍率')}:{groupRatio[selectedGroup]} diff --git a/web/src/components/table/models/ModelsColumnDefs.js b/web/src/components/table/models/ModelsColumnDefs.js index bee321d9..b428c10d 100644 --- a/web/src/components/table/models/ModelsColumnDefs.js +++ b/web/src/components/table/models/ModelsColumnDefs.js @@ -121,36 +121,34 @@ const renderEndpoints = (value) => { } }; -// Render quota types (array) +// Render quota types (array) using common limited items renderer const renderQuotaTypes = (arr, t) => { if (!Array.isArray(arr) || arr.length === 0) return '-'; - const renderOne = (qt, idx) => { - if (qt === 1) { + return renderLimitedItems({ + items: arr, + renderItem: (qt, idx) => { + if (qt === 1) { + return ( + + {t('按次计费')} + + ); + } + if (qt === 0) { + return ( + + {t('按量计费')} + + ); + } return ( - - {t('按次计费')} + + {qt} ); - } - if (qt === 0) { - return ( - - {t('按量计费')} - - ); - } - // 未来新增模式的兜底展示 - return ( - - {qt} - - ); - }; - return ( - - {arr.map((qt, idx) => renderOne(qt, idx))} - - ); + }, + maxDisplay: 3, + }); }; // Render bound channels