♻️ Refactor: Move token unit toggle from table header to filter settings
- Remove K/M switch from model price column header in pricing table - Add "Display in K units" option to pricing display settings panel - Update parameter passing for tokenUnit and setTokenUnit across components: - PricingDisplaySettings: Add tokenUnit toggle functionality - PricingSidebar: Pass tokenUnit props to display settings - PricingFilterModal: Include tokenUnit in mobile filter modal - Enhance resetPricingFilters utility to reset token unit to default 'M' - Clean up PricingTableColumns by removing unused setTokenUnit parameter - Add English translation for "按K显示单位" as "Display in K units" This change improves UX by consolidating all display-related controls in the filter settings panel, making the interface more organized and the token unit setting more discoverable alongside other display options. Affected components: - PricingTableColumns.js - PricingDisplaySettings.jsx - PricingSidebar.jsx - PricingFilterModal.jsx - PricingTable.jsx - utils.js (resetPricingFilters) - en.json (translations)
This commit is contained in:
@@ -612,12 +612,25 @@ export const calculateModelPrice = ({
|
||||
}
|
||||
};
|
||||
|
||||
// 格式化价格信息为字符串(用于卡片视图)
|
||||
// 格式化价格信息(用于卡片视图)
|
||||
export const formatPriceInfo = (priceData, t) => {
|
||||
if (priceData.isPerToken) {
|
||||
return `${t('输入')} ${priceData.inputPrice}/${priceData.unitLabel} ${t('输出')} ${priceData.completionPrice}/${priceData.unitLabel}`;
|
||||
return (
|
||||
<>
|
||||
<span style={{ color: 'var(--semi-color-text-1)' }}>
|
||||
{t('提示')} {priceData.inputPrice}/{priceData.unitLabel}
|
||||
</span>
|
||||
<span style={{ color: 'var(--semi-color-text-1)' }}>
|
||||
{t('补全')} {priceData.completionPrice}/{priceData.unitLabel}
|
||||
</span>
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
return `${t('模型价格')} ${priceData.price}`;
|
||||
return (
|
||||
<span style={{ color: 'var(--semi-color-text-1)' }}>
|
||||
{t('模型价格')} {priceData.price}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -684,6 +697,7 @@ export const resetPricingFilters = ({
|
||||
setFilterQuotaType,
|
||||
setFilterEndpointType,
|
||||
setCurrentPage,
|
||||
setTokenUnit,
|
||||
}) => {
|
||||
// 重置搜索
|
||||
if (typeof handleChange === 'function') {
|
||||
@@ -719,6 +733,11 @@ export const resetPricingFilters = ({
|
||||
setViewMode('card');
|
||||
}
|
||||
|
||||
// 重置token单位
|
||||
if (typeof setTokenUnit === 'function') {
|
||||
setTokenUnit('M');
|
||||
}
|
||||
|
||||
// 重置分组筛选
|
||||
if (typeof setFilterGroup === 'function') {
|
||||
setFilterGroup('all');
|
||||
|
||||
Reference in New Issue
Block a user