From a0a3d0c33e41c36125d40cab7799f1c59c6c95d8 Mon Sep 17 00:00:00 2001 From: 315944211 <50852960+315944211@users.noreply.github.com> Date: Tue, 30 Jun 2026 00:37:21 +0800 Subject: [PATCH] fix: show privacy setting result accurately --- frontend/src/views/admin/AccountsView.vue | 29 ++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/admin/AccountsView.vue b/frontend/src/views/admin/AccountsView.vue index acd736ff35..e21c54a818 100644 --- a/frontend/src/views/admin/AccountsView.vue +++ b/frontend/src/views/admin/AccountsView.vue @@ -1604,12 +1604,39 @@ const handleResetQuota = async (a: Account) => { console.error('Failed to reset quota:', error) } } + +const privacyResultMessageKey = (account: Account): { type: 'success' | 'error'; key: string } => { + const mode = typeof account.extra?.privacy_mode === 'string' ? account.extra.privacy_mode : '' + if (account.platform === 'openai') { + switch (mode) { + case 'training_off': + return { type: 'success', key: 'admin.accounts.privacyTrainingOff' } + case 'training_set_cf_blocked': + return { type: 'error', key: 'admin.accounts.privacyCfBlocked' } + default: + return { type: 'error', key: 'admin.accounts.privacyFailed' } + } + } + if (account.platform === 'antigravity') { + if (mode === 'privacy_set') { + return { type: 'success', key: 'admin.accounts.privacyAntigravitySet' } + } + return { type: 'error', key: 'admin.accounts.privacyAntigravityFailed' } + } + return { type: 'error', key: 'admin.accounts.privacyFailed' } +} + const handleSetPrivacy = async (a: Account) => { try { const updated = await adminAPI.accounts.setPrivacy(a.id) patchAccountInList(updated) enterAutoRefreshSilentWindow() - appStore.showSuccess(t('common.success')) + const result = privacyResultMessageKey(updated) + if (result.type === 'success') { + appStore.showSuccess(t(result.key)) + } else { + appStore.showError(t(result.key)) + } } catch (error: any) { console.error('Failed to set privacy:', error) appStore.showError(error?.response?.data?.message || t('admin.accounts.privacyFailed'))