From 01b3a09d7dd0c6a5b4bc3adcc369912795769084 Mon Sep 17 00:00:00 2001 From: erio Date: Fri, 6 Mar 2026 04:16:47 +0800 Subject: [PATCH] fix: validate account status before update and update load factor hint MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Normalize non-standard status (e.g. "error") to "active" on edit load - Add pre-submit validation for status field to prevent 400 errors - Update load factor hint: "提高负载因子可以提高对账号的调度频率" --- frontend/src/components/account/EditAccountModal.vue | 9 ++++++++- frontend/src/i18n/locales/en.ts | 3 ++- frontend/src/i18n/locales/zh.ts | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/account/EditAccountModal.vue b/frontend/src/components/account/EditAccountModal.vue index 764fd9be..196e346c 100644 --- a/frontend/src/components/account/EditAccountModal.vue +++ b/frontend/src/components/account/EditAccountModal.vue @@ -1508,7 +1508,9 @@ watch( form.load_factor = newAccount.load_factor ?? null form.priority = newAccount.priority form.rate_multiplier = newAccount.rate_multiplier ?? 1 - form.status = newAccount.status as 'active' | 'inactive' + form.status = (newAccount.status === 'active' || newAccount.status === 'inactive') + ? newAccount.status + : 'active' form.group_ids = newAccount.group_ids || [] form.expires_at = newAccount.expires_at ?? null @@ -2048,6 +2050,11 @@ const handleSubmit = async () => { if (!props.account) return const accountID = props.account.id + if (form.status !== 'active' && form.status !== 'inactive') { + appStore.showError(t('admin.accounts.pleaseSelectStatus')) + return + } + const updatePayload: Record = { ...form } try { // 后端期望 proxy_id: 0 表示清除代理,而不是 null diff --git a/frontend/src/i18n/locales/en.ts b/frontend/src/i18n/locales/en.ts index d08aed4d..89a4f0a0 100644 --- a/frontend/src/i18n/locales/en.ts +++ b/frontend/src/i18n/locales/en.ts @@ -1992,7 +1992,7 @@ export default { noProxy: 'No Proxy', concurrency: 'Concurrency', loadFactor: 'Load Factor', - loadFactorHint: 'Defaults to concurrency', + loadFactorHint: 'Higher load factor increases scheduling frequency', priority: 'Priority', priorityHint: 'Lower value accounts are used first', billingRateMultiplier: 'Billing Rate Multiplier', @@ -2012,6 +2012,7 @@ export default { accountUpdated: 'Account updated successfully', failedToCreate: 'Failed to create account', failedToUpdate: 'Failed to update account', + pleaseSelectStatus: 'Please select a valid account status', mixedChannelWarningTitle: 'Mixed Channel Warning', mixedChannelWarning: 'Warning: Group "{groupName}" contains both {currentPlatform} and {otherPlatform} accounts. Mixing different channels may cause thinking block signature validation issues, which will fallback to non-thinking mode. Are you sure you want to continue?', pleaseEnterAccountName: 'Please enter account name', diff --git a/frontend/src/i18n/locales/zh.ts b/frontend/src/i18n/locales/zh.ts index 3dc70d1e..67f50e83 100644 --- a/frontend/src/i18n/locales/zh.ts +++ b/frontend/src/i18n/locales/zh.ts @@ -2134,7 +2134,7 @@ export default { noProxy: '无代理', concurrency: '并发数', loadFactor: '负载因子', - loadFactorHint: '不填则等于并发数', + loadFactorHint: '提高负载因子可以提高对账号的调度频率', priority: '优先级', priorityHint: '优先级越小的账号优先使用', billingRateMultiplier: '账号计费倍率', @@ -2154,6 +2154,7 @@ export default { accountUpdated: '账号更新成功', failedToCreate: '创建账号失败', failedToUpdate: '更新账号失败', + pleaseSelectStatus: '请选择有效的账号状态', mixedChannelWarningTitle: '混合渠道警告', mixedChannelWarning: '警告:分组 "{groupName}" 中同时包含 {currentPlatform} 和 {otherPlatform} 账号。混合使用不同渠道可能导致 thinking block 签名验证问题,会自动回退到非 thinking 模式。确定要继续吗?', pleaseEnterAccountName: '请输入账号名称',