From 8dbc20b9b3e38acb70dfa55ecb5f387b821dce3c Mon Sep 17 00:00:00 2001 From: wizardchen Date: Tue, 16 Jun 2026 00:49:07 +0800 Subject: [PATCH] feat(im): enhance IMChannelPanel and SettingDrawer components Refactor settings drawer for consistency, add role-based empty states, and improve save loading UX for IM channel configuration. --- frontend/src/components/IMChannelPanel.vue | 28 ++- .../src/components/settings/SettingDrawer.vue | 175 +++++++++++------- 2 files changed, 131 insertions(+), 72 deletions(-) diff --git a/frontend/src/components/IMChannelPanel.vue b/frontend/src/components/IMChannelPanel.vue index 3f38d6ad..076b4161 100644 --- a/frontend/src/components/IMChannelPanel.vue +++ b/frontend/src/components/IMChannelPanel.vue @@ -7,7 +7,7 @@ -
+
@@ -71,15 +71,16 @@
- -
@@ -419,7 +420,7 @@
-
+ @@ -434,6 +435,7 @@ import { import { useChatResourcesStore } from '@/stores/chatResources'; import type { IMChannel } from '@/api/agent'; import { useAuthStore } from '@/stores/auth'; +import SettingDrawer from '@/components/settings/SettingDrawer.vue'; const { t } = useI18n(); const authStore = useAuthStore(); @@ -444,9 +446,14 @@ const props = defineProps<{ const channels = ref([]); const loading = ref(false); +const saving = ref(false); const showCreateDialog = ref(false); const editingChannel = ref(null); +const drawerTitle = computed(() => + editingChannel.value ? t('agentEditor.im.editChannel') : t('agentEditor.im.addChannel'), +); + // Knowledge base options for file-to-KB feature const knowledgeBases = ref<{ id: string; name: string }[]>([]); @@ -706,6 +713,7 @@ function resetForm() { } async function handleSave() { + saving.value = true; try { // For WeChat, validate that credentials are bound if (formData.value.platform === 'wechat' && !formData.value.credentials.bot_token) { @@ -741,6 +749,8 @@ async function handleSave() { } catch (e: any) { const msg = e?.message || (typeof e?.error === 'string' ? e.error : null) || t('common.operationFailed'); MessagePlugin.error(msg); + } finally { + saving.value = false; } } diff --git a/frontend/src/components/settings/SettingDrawer.vue b/frontend/src/components/settings/SettingDrawer.vue index 0d169faa..1838ec1b 100644 --- a/frontend/src/components/settings/SettingDrawer.vue +++ b/frontend/src/components/settings/SettingDrawer.vue @@ -1,13 +1,13 @@