diff --git a/web/src/components/table/TokensTable.js b/web/src/components/table/TokensTable.js
index 05f7067d..18303da7 100644
--- a/web/src/components/table/TokensTable.js
+++ b/web/src/components/table/TokensTable.js
@@ -60,50 +60,6 @@ const TokensTable = () => {
title: t('名称'),
dataIndex: 'name',
},
- {
- title: t('余额'),
- key: 'quota',
- render: (text, record) => {
- if (record.unlimited_quota) {
- return {t('无限制')};
- }
-
- const used = parseInt(record.used_quota) || 0;
- const remain = parseInt(record.remain_quota) || 0;
- const total = used + remain;
- const percent = total > 0 ? (remain / total) * 100 : 0;
-
- const getProgressColor = (pct) => {
- if (pct === 100) return 'var(--semi-color-success)';
- if (pct <= 10) return 'var(--semi-color-danger)';
- if (pct <= 30) return 'var(--semi-color-warning)';
- return undefined;
- };
-
- return (
-
- {t('已用额度')}: {renderQuota(used)}
- {t('剩余额度')}: {renderQuota(remain)} ({percent.toFixed(0)}%)
- {t('总额度')}: {renderQuota(total)}
-
- }
- >
-
-
-
- );
- },
- },
{
title: t('状态'),
dataIndex: 'status',
@@ -134,11 +90,39 @@ const TokensTable = () => {
tagText = t('已耗尽');
}
- return (
+ const used = parseInt(record.used_quota) || 0;
+ const remain = parseInt(record.remain_quota) || 0;
+ const total = used + remain;
+ const percent = total > 0 ? (remain / total) * 100 : 0;
+
+ const getProgressColor = (pct) => {
+ if (pct === 100) return 'var(--semi-color-success)';
+ if (pct <= 10) return 'var(--semi-color-danger)';
+ if (pct <= 30) return 'var(--semi-color-warning)';
+ return undefined;
+ };
+
+ const quotaSuffix = record.unlimited_quota ? (
+
{t('无限额度')}
+ ) : (
+
+
{`${renderQuota(remain)} / ${renderQuota(total)}`}
+
+ );
+
+ const content = (
{
aria-label='token status switch'
/>
}
+ suffixIcon={quotaSuffix}
>
{tagText}
);
+
+ if (record.unlimited_quota) {
+ return content;
+ }
+
+ return (
+
+ {t('已用额度')}: {renderQuota(used)}
+ {t('剩余额度')}: {renderQuota(remain)} ({percent.toFixed(0)}%)
+ {t('总额度')}: {renderQuota(total)}
+
+ }
+ >
+ {content}
+
+ );
},
},
{