From 18fc7d57b4747895845d833648173e9a5e700d45 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Sun, 9 Nov 2025 15:09:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=80=BB=E8=BE=91=E4=BB=A5=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=96=B0=E5=AF=B9=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 `AgentChatComponent.vue` 中的删除聊天逻辑,确保删除当前对话时自动创建新对话。 - 更新 `ChatSidebarComponent.vue` 中的删除菜单项,移除对当前聊天 ID 的限制,允许删除任何聊天。 --- web/src/components/AgentChatComponent.vue | 8 +++++--- web/src/components/ChatSidebarComponent.vue | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/web/src/components/AgentChatComponent.vue b/web/src/components/AgentChatComponent.vue index 52cf5eac..90a587b6 100644 --- a/web/src/components/AgentChatComponent.vue +++ b/web/src/components/AgentChatComponent.vue @@ -838,9 +838,11 @@ const deleteChat = async (chatId) => { await deleteThread(chatId); if (chatState.currentThreadId === chatId) { chatState.currentThreadId = null; - if (chatsList.value.length > 0) { - await selectChat(chatsList.value[0].id); - } + // 如果删除的是当前对话,自动创建新对话 + await createNewChat(); + } else if (chatsList.value.length > 0) { + // 如果删除的不是当前对话,选择第一个可用对话 + await selectChat(chatsList.value[0].id); } } catch (error) { handleChatError(error, 'delete'); diff --git a/web/src/components/ChatSidebarComponent.vue b/web/src/components/ChatSidebarComponent.vue index 07ab0a7b..2856561c 100644 --- a/web/src/components/ChatSidebarComponent.vue +++ b/web/src/components/ChatSidebarComponent.vue @@ -44,7 +44,7 @@ 重命名 - + 删除