diff --git a/packages/client/src/components/hermes/settings/PlatformSettings.vue b/packages/client/src/components/hermes/settings/PlatformSettings.vue index 7bc49967..b1761cc7 100644 --- a/packages/client/src/components/hermes/settings/PlatformSettings.vue +++ b/packages/client/src/components/hermes/settings/PlatformSettings.vue @@ -22,25 +22,6 @@ function isSaving(platform: string, field: string) { return !!saving[savingKey(platform, field)] } -// Debounce timers -const debounceTimers: Record> = {} - -function debounceSave(platform: string, field: string, saveFn: () => Promise, delay = 600) { - const key = savingKey(platform, field) - if (debounceTimers[key]) clearTimeout(debounceTimers[key]) - debounceTimers[key] = setTimeout(async () => { - saving[key] = true - try { - await saveFn() - message.success(t('settings.saved')) - } catch (err: any) { - message.error(t('settings.saveFailed')) - } finally { - saving[key] = false - } - }, delay) -} - // Immediate save for switches async function immediateSave(platform: string, field: string, saveFn: () => Promise) { const key = savingKey(platform, field) @@ -59,10 +40,6 @@ async function saveChannel(platform: string, field: string, values: Record settingsStore.saveSection(platform, values)) } -function debouncedSaveChannel(platform: string, field: string, values: Record) { - debounceSave(platform, field, () => settingsStore.saveSection(platform, values)) -} - // Save credentials to .env (matching hermes gateway setup behavior) async function saveCredentials(platform: string, field: string, values: Record) { immediateSave(platform, field, async () => { @@ -71,13 +48,6 @@ async function saveCredentials(platform: string, field: string, values: Record) { - debounceSave(platform, field, async () => { - await saveCredsApi(platform, values) - await settingsStore.fetchSettings() - }) -} - function getCreds(key: string) { return (settingsStore.platforms[key] || {}) as Record } @@ -121,7 +91,6 @@ function pollWeixinStatus() { wxQrStatus.value = 'expired' } else if (data.status === 'confirmed') { wxQrStatus.value = 'confirmed' - // Save credentials to .env await saveWeixinCredentials({ account_id: data.account_id!, token: data.token!, @@ -131,7 +100,6 @@ function pollWeixinStatus() { message.success(t('settings.saved')) } } catch { - // Retry poll on network error pollWeixinStatus() } }, 3000) @@ -146,7 +114,6 @@ function stopWeixinPoll() { onUnmounted(() => { stopWeixinPoll() - Object.values(debounceTimers).forEach(t => clearTimeout(t)) }) const platforms = [ @@ -180,11 +147,6 @@ const platforms = [ name: 'Feishu', icon: '', }, - // { - // key: 'dingtalk', - // name: 'DingTalk', - // icon: '', - // }, { key: 'weixin', name: 'Weixin', @@ -211,7 +173,7 @@ const platforms = [ @@ -280,20 +242,20 @@ const platforms = [ - + - + @@ -361,20 +323,20 @@ const platforms = [ - + - + diff --git a/packages/client/src/views/hermes/SettingsView.vue b/packages/client/src/views/hermes/SettingsView.vue index fad91efd..4ee4236b 100644 --- a/packages/client/src/views/hermes/SettingsView.vue +++ b/packages/client/src/views/hermes/SettingsView.vue @@ -1,29 +1,36 @@ @@ -31,11 +38,15 @@ async function saveApiServer(values: Record) {