{presetAmounts.map((preset, index) => {
- const discount = preset.discount || topupInfo?.discount?.[preset.value] || 1.0;
+ const discount =
+ preset.discount ||
+ topupInfo?.discount?.[preset.value] ||
+ 1.0;
const originalPrice = preset.value * priceRatio;
const discountedPrice = originalPrice * discount;
const hasDiscount = discount < 1.0;
const actualPay = discountedPrice;
const save = originalPrice - discountedPrice;
-
+
return (
{
@@ -352,24 +373,35 @@ const RechargeCard = ({
}}
>
-
+
{formatLargeNumber(preset.value)}
{hasDiscount && (
-
- {t('折').includes('off') ?
- ((1 - parseFloat(discount)) * 100).toFixed(1) :
- (discount * 10).toFixed(1)}{t('折')}
-
+
+ {t('折').includes('off')
+ ? (
+ (1 - parseFloat(discount)) *
+ 100
+ ).toFixed(1)
+ : (discount * 10).toFixed(1)}
+ {t('折')}
+
)}
-
+
{t('实付')} {actualPay.toFixed(2)},
- {hasDiscount ? `${t('节省')} ${save.toFixed(2)}` : `${t('节省')} 0.00`}
+ {hasDiscount
+ ? `${t('节省')} ${save.toFixed(2)}`
+ : `${t('节省')} 0.00`}
diff --git a/web/src/components/topup/index.jsx b/web/src/components/topup/index.jsx
index 929a47e3..558c6705 100644
--- a/web/src/components/topup/index.jsx
+++ b/web/src/components/topup/index.jsx
@@ -80,11 +80,11 @@ const TopUp = () => {
// 预设充值额度选项
const [presetAmounts, setPresetAmounts] = useState([]);
const [selectedPreset, setSelectedPreset] = useState(null);
-
+
// 充值配置信息
const [topupInfo, setTopupInfo] = useState({
amount_options: [],
- discount: {}
+ discount: {},
});
const topUp = async () => {
@@ -262,9 +262,9 @@ const TopUp = () => {
if (success) {
setTopupInfo({
amount_options: data.amount_options || [],
- discount: data.discount || {}
+ discount: data.discount || {},
});
-
+
// 处理支付方式
let payMethods = data.pay_methods || [];
try {
@@ -280,10 +280,15 @@ const TopUp = () => {
payMethods = payMethods.map((method) => {
// 规范化最小充值数
const normalizedMinTopup = Number(method.min_topup);
- method.min_topup = Number.isFinite(normalizedMinTopup) ? normalizedMinTopup : 0;
+ method.min_topup = Number.isFinite(normalizedMinTopup)
+ ? normalizedMinTopup
+ : 0;
// Stripe 的最小充值从后端字段回填
- if (method.type === 'stripe' && (!method.min_topup || method.min_topup <= 0)) {
+ if (
+ method.type === 'stripe' &&
+ (!method.min_topup || method.min_topup <= 0)
+ ) {
const stripeMin = Number(data.stripe_min_topup);
if (Number.isFinite(stripeMin)) {
method.min_topup = stripeMin;
@@ -313,7 +318,11 @@ const TopUp = () => {
setPayMethods(payMethods);
const enableStripeTopUp = data.enable_stripe_topup || false;
const enableOnlineTopUp = data.enable_online_topup || false;
- const minTopUpValue = enableOnlineTopUp? data.min_topup : enableStripeTopUp? data.stripe_min_topup : 1;
+ const minTopUpValue = enableOnlineTopUp
+ ? data.min_topup
+ : enableStripeTopUp
+ ? data.stripe_min_topup
+ : 1;
setEnableOnlineTopUp(enableOnlineTopUp);
setEnableStripeTopUp(enableStripeTopUp);
setMinTopUp(minTopUpValue);
@@ -330,12 +339,12 @@ const TopUp = () => {
console.log('解析支付方式失败:', e);
setPayMethods([]);
}
-
+
// 如果有自定义充值数量选项,使用它们替换默认的预设选项
if (data.amount_options && data.amount_options.length > 0) {
- const customPresets = data.amount_options.map(amount => ({
+ const customPresets = data.amount_options.map((amount) => ({
value: amount,
- discount: data.discount[amount] || 1.0
+ discount: data.discount[amount] || 1.0,
}));
setPresetAmounts(customPresets);
}
@@ -483,7 +492,7 @@ const TopUp = () => {
const selectPresetAmount = (preset) => {
setTopUpCount(preset.value);
setSelectedPreset(preset.value);
-
+
// 计算实际支付金额,考虑折扣
const discount = preset.discount || topupInfo.discount[preset.value] || 1.0;
const discountedAmount = preset.value * priceRatio * discount;
diff --git a/web/src/components/topup/modals/PaymentConfirmModal.jsx b/web/src/components/topup/modals/PaymentConfirmModal.jsx
index 1bffbfed..8bd5455c 100644
--- a/web/src/components/topup/modals/PaymentConfirmModal.jsx
+++ b/web/src/components/topup/modals/PaymentConfirmModal.jsx
@@ -40,9 +40,10 @@ const PaymentConfirmModal = ({
amountNumber,
discountRate,
}) => {
- const hasDiscount = discountRate && discountRate > 0 && discountRate < 1 && amountNumber > 0;
- const originalAmount = hasDiscount ? (amountNumber / discountRate) : 0;
- const discountAmount = hasDiscount ? (originalAmount - amountNumber) : 0;
+ const hasDiscount =
+ discountRate && discountRate > 0 && discountRate < 1 && amountNumber > 0;
+ const originalAmount = hasDiscount ? amountNumber / discountRate : 0;
+ const discountAmount = hasDiscount ? originalAmount - amountNumber : 0;
return (
dayjs().startOf('day').toDate(),
- end: () => dayjs().endOf('day').toDate()
+ end: () => dayjs().endOf('day').toDate(),
},
{
text: '近 7 天',
start: () => dayjs().subtract(6, 'day').startOf('day').toDate(),
- end: () => dayjs().endOf('day').toDate()
+ end: () => dayjs().endOf('day').toDate(),
},
{
text: '本周',
start: () => dayjs().startOf('week').toDate(),
- end: () => dayjs().endOf('week').toDate()
+ end: () => dayjs().endOf('week').toDate(),
},
{
text: '近 30 天',
start: () => dayjs().subtract(29, 'day').startOf('day').toDate(),
- end: () => dayjs().endOf('day').toDate()
+ end: () => dayjs().endOf('day').toDate(),
},
{
text: '本月',
start: () => dayjs().startOf('month').toDate(),
- end: () => dayjs().endOf('month').toDate()
+ end: () => dayjs().endOf('month').toDate(),
},
];
diff --git a/web/src/helpers/api.js b/web/src/helpers/api.js
index bc389b2e..1ccfffaf 100644
--- a/web/src/helpers/api.js
+++ b/web/src/helpers/api.js
@@ -131,13 +131,11 @@ export const buildApiPayload = (
seed: 'seed',
};
-
Object.entries(parameterMappings).forEach(([key, param]) => {
const enabled = parameterEnabled[key];
const value = inputs[param];
const hasValue = value !== undefined && value !== null;
-
if (enabled && hasValue) {
payload[param] = value;
}
diff --git a/web/src/helpers/render.jsx b/web/src/helpers/render.jsx
index c19e2849..6dc54082 100644
--- a/web/src/helpers/render.jsx
+++ b/web/src/helpers/render.jsx
@@ -1072,7 +1072,7 @@ export function renderModelPrice(
(completionTokens / 1000000) * completionRatioPrice * groupRatio +
(webSearchCallCount / 1000) * webSearchPrice * groupRatio +
(fileSearchCallCount / 1000) * fileSearchPrice * groupRatio +
- (imageGenerationCallPrice * groupRatio);
+ imageGenerationCallPrice * groupRatio;
return (
<>
diff --git a/web/src/hooks/common/useSidebar.js b/web/src/hooks/common/useSidebar.js
index 13d76fd8..0b8eb3d8 100644
--- a/web/src/hooks/common/useSidebar.js
+++ b/web/src/hooks/common/useSidebar.js
@@ -128,7 +128,7 @@ export const useSidebar = () => {
// 刷新用户配置的方法(供外部调用)
const refreshUserConfig = async () => {
- if (Object.keys(adminConfig).length > 0) {
+ if (Object.keys(adminConfig).length > 0) {
await loadUserConfig();
}
@@ -155,7 +155,10 @@ export const useSidebar = () => {
sidebarEventTarget.addEventListener(SIDEBAR_REFRESH_EVENT, handleRefresh);
return () => {
- sidebarEventTarget.removeEventListener(SIDEBAR_REFRESH_EVENT, handleRefresh);
+ sidebarEventTarget.removeEventListener(
+ SIDEBAR_REFRESH_EVENT,
+ handleRefresh,
+ );
};
}, [adminConfig]);
diff --git a/web/src/pages/Setting/Operation/SettingsGeneral.jsx b/web/src/pages/Setting/Operation/SettingsGeneral.jsx
index 5af750ec..b8b925dc 100644
--- a/web/src/pages/Setting/Operation/SettingsGeneral.jsx
+++ b/web/src/pages/Setting/Operation/SettingsGeneral.jsx
@@ -130,19 +130,20 @@ export default function GeneralSettings(props) {
showClear
/>
- {inputs.QuotaPerUnit !== '500000' && inputs.QuotaPerUnit !== 500000 && (
-
- setShowQuotaWarning(true)}
- />
-
- )}
+ {inputs.QuotaPerUnit !== '500000' &&
+ inputs.QuotaPerUnit !== 500000 && (
+
+ setShowQuotaWarning(true)}
+ />
+
+ )}
setInputs({
...inputs,
- 'monitor_setting.auto_test_channel_minutes': parseInt(value),
+ 'monitor_setting.auto_test_channel_minutes':
+ parseInt(value),
})
}
/>
diff --git a/web/src/pages/Setting/Payment/SettingsPaymentGateway.jsx b/web/src/pages/Setting/Payment/SettingsPaymentGateway.jsx
index d681b6a2..a4f1029a 100644
--- a/web/src/pages/Setting/Payment/SettingsPaymentGateway.jsx
+++ b/web/src/pages/Setting/Payment/SettingsPaymentGateway.jsx
@@ -118,14 +118,20 @@ export default function SettingsPaymentGateway(props) {
}
}
- if (originInputs['AmountOptions'] !== inputs.AmountOptions && inputs.AmountOptions.trim() !== '') {
+ if (
+ originInputs['AmountOptions'] !== inputs.AmountOptions &&
+ inputs.AmountOptions.trim() !== ''
+ ) {
if (!verifyJSON(inputs.AmountOptions)) {
showError(t('自定义充值数量选项不是合法的 JSON 数组'));
return;
}
}
- if (originInputs['AmountDiscount'] !== inputs.AmountDiscount && inputs.AmountDiscount.trim() !== '') {
+ if (
+ originInputs['AmountDiscount'] !== inputs.AmountDiscount &&
+ inputs.AmountDiscount.trim() !== ''
+ ) {
if (!verifyJSON(inputs.AmountDiscount)) {
showError(t('充值金额折扣配置不是合法的 JSON 对象'));
return;
@@ -163,10 +169,16 @@ export default function SettingsPaymentGateway(props) {
options.push({ key: 'PayMethods', value: inputs.PayMethods });
}
if (originInputs['AmountOptions'] !== inputs.AmountOptions) {
- options.push({ key: 'payment_setting.amount_options', value: inputs.AmountOptions });
+ options.push({
+ key: 'payment_setting.amount_options',
+ value: inputs.AmountOptions,
+ });
}
if (originInputs['AmountDiscount'] !== inputs.AmountDiscount) {
- options.push({ key: 'payment_setting.amount_discount', value: inputs.AmountDiscount });
+ options.push({
+ key: 'payment_setting.amount_discount',
+ value: inputs.AmountDiscount,
+ });
}
// 发送请求
@@ -273,7 +285,7 @@ export default function SettingsPaymentGateway(props) {
placeholder={t('为一个 JSON 文本')}
autosize
/>
-
+
-
+
-
+
diff --git a/web/src/pages/Setting/Ratio/ModelRatioSettings.jsx b/web/src/pages/Setting/Ratio/ModelRatioSettings.jsx
index ed982edc..b298cc78 100644
--- a/web/src/pages/Setting/Ratio/ModelRatioSettings.jsx
+++ b/web/src/pages/Setting/Ratio/ModelRatioSettings.jsx
@@ -226,8 +226,12 @@ export default function ModelRatioSettings(props) {
- setInputs({ ...inputs, ImageRatio: value })
- }
+ onChange={(value) => setInputs({ ...inputs, ImageRatio: value })}
/>
@@ -249,7 +251,9 @@ export default function ModelRatioSettings(props) {
- setInputs({ ...inputs, AudioRatio: value })
- }
+ onChange={(value) => setInputs({ ...inputs, AudioRatio: value })}
/>
@@ -270,8 +272,12 @@ export default function ModelRatioSettings(props) {