From cfb0ed7609c7cf827625bab44fdac087f0f015c3 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Sat, 31 Jan 2026 17:04:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(agent-panel):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8F=AF=E8=B0=83=E6=95=B4=E5=AE=BD=E5=BA=A6=E7=9A=84agent?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为 AgentPanel 组件添加拖拽调整宽度功能 - 引入 resize-handle 组件处理拖拽交互 - 设置面板宽度范围限制(280px-600px) --- web/src/components/AgentChatComponent.vue | 21 ++++++- web/src/components/AgentPanel.vue | 71 ++++++++++++++++++++--- 2 files changed, 82 insertions(+), 10 deletions(-) diff --git a/web/src/components/AgentChatComponent.vue b/web/src/components/AgentChatComponent.vue index 83721615..97639b02 100644 --- a/web/src/components/AgentChatComponent.vue +++ b/web/src/components/AgentChatComponent.vue @@ -167,12 +167,18 @@ -
+
@@ -257,6 +263,9 @@ const localUIState = reactive({ // Agent Panel State const isAgentPanelOpen = ref(false) +const panelWidth = ref(360) +const minPanelWidth = 280 +const maxPanelWidth = 600 // ==================== COMPUTED PROPERTIES ==================== const currentAgentId = computed(() => { @@ -973,6 +982,12 @@ const toggleAgentPanel = () => { isAgentPanelOpen.value = !isAgentPanelOpen.value } +// 处理面板宽度调整 +// 反转 deltaX:向左拖动时让面板变宽(像拉出更多空间) +const handlePanelResize = (deltaX) => { + panelWidth.value = Math.min(maxPanelWidth, Math.max(minPanelWidth, panelWidth.value - deltaX)) +} + // ==================== HELPER FUNCTIONS ==================== const getLastMessage = (conv) => { if (!conv?.messages?.length) return null @@ -1153,7 +1168,7 @@ watch( } .agent-panel-wrapper { - flex: 3; /* 4:3 ratio with chat-main */ + flex: 0 0 auto; height: calc(100% - 32px); overflow: hidden; z-index: 20; @@ -1163,7 +1178,7 @@ watch( border-radius: 12px; box-shadow: 0 4px 20px var(--shadow-1); border: 1px solid var(--gray-200); - min-width: 0; /* Prevent flex item from overflowing */ + min-width: 0; } /* Workbench transition animations */ diff --git a/web/src/components/AgentPanel.vue b/web/src/components/AgentPanel.vue index b2e80367..56ca439f 100644 --- a/web/src/components/AgentPanel.vue +++ b/web/src/components/AgentPanel.vue @@ -1,5 +1,7 @@