From 1dd4bd5988c24d16b5ef3d6624bb8ed7ed3b7bf4 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Mon, 9 Mar 2026 01:23:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/AgentChatComponent.vue | 21 ++++- web/src/components/AgentInputArea.vue | 3 - web/src/components/AgentPanel.vue | 19 +++- .../components/AttachmentOptionsComponent.vue | 4 - web/src/components/ChatSidebarComponent.vue | 69 ++++++++++++--- web/src/components/MessageInputComponent.vue | 4 +- .../ToolCallingResult/BaseToolCall.vue | 5 +- .../ToolCallingResult/ToolCallRenderer.vue | 4 + .../tools/AskUserQuestionTool.vue | 86 +++++++++++++++++++ 9 files changed, 188 insertions(+), 27 deletions(-) create mode 100644 web/src/components/ToolCallingResult/tools/AskUserQuestionTool.vue diff --git a/web/src/components/AgentChatComponent.vue b/web/src/components/AgentChatComponent.vue index 947892a5..1c4b3396 100644 --- a/web/src/components/AgentChatComponent.vue +++ b/web/src/components/AgentChatComponent.vue @@ -381,6 +381,14 @@ const hasAgentStateContent = computed(() => { return todoCount > 0 || fileCount > 0 }) +// 监听 hasAgentStateContent 从 false → true 时,自动展开面板 +watch(hasAgentStateContent, (newVal, oldVal) => { + if (newVal && !oldVal) { + // 从无状态变为有状态时,自动展开面板 + isAgentPanelOpen.value = true + } +}) + const mentionConfig = computed(() => { const rawFiles = currentAgentState.value?.files || {} const files = [] @@ -1273,20 +1281,25 @@ const sendMessage = async ({ // 检查第一个对话是否为空 const isFirstChatEmpty = () => { if (threads.value.length === 0) return false - const firstThread = threads.value[0] - const firstThreadMessages = threadMessages.value[firstThread.id] || [] - return firstThreadMessages.length === 0 + const chatToReuse = getFirstNonPinnedChat(threads.value) + const messages = threadMessages.value[chatToReuse.id] + // 只有当消息已加载且为空时才返回 true + return messages !== undefined && messages.length === 0 } // 获取第一个非置顶的对话 const getFirstNonPinnedChat = (chatList) => { + if (!chatList || chatList.length === 0) return null return chatList.find((chat) => !chat.is_pinned) || chatList[0] } // 如果第一个对话为空,直接切换到第一个非置顶对话 const switchToFirstChatIfEmpty = async () => { if (threads.value.length > 0 && isFirstChatEmpty()) { - await selectChat(getFirstNonPinnedChat(threads.value).id) + const chatToReuse = getFirstNonPinnedChat(threads.value) + if (chatState.currentThreadId !== chatToReuse.id) { + await selectChat(chatToReuse.id) + } return true } return false diff --git a/web/src/components/AgentInputArea.vue b/web/src/components/AgentInputArea.vue index 1f2ab9b3..c564c590 100644 --- a/web/src/components/AgentInputArea.vue +++ b/web/src/components/AgentInputArea.vue @@ -210,9 +210,6 @@ defineExpose({ font-weight: 500; } - &:active { - transform: scale(0.95); - } &.disabled { opacity: 0.5; diff --git a/web/src/components/AgentPanel.vue b/web/src/components/AgentPanel.vue index 68b77903..786c6e02 100644 --- a/web/src/components/AgentPanel.vue +++ b/web/src/components/AgentPanel.vue @@ -137,7 +137,7 @@ + +