fix: 更新聊天删除逻辑以自动创建新对话

- 修改 `AgentChatComponent.vue` 中的删除聊天逻辑,确保删除当前对话时自动创建新对话。
- 更新 `ChatSidebarComponent.vue` 中的删除菜单项,移除对当前聊天 ID 的限制,允许删除任何聊天。
This commit is contained in:
Wenjie Zhang 2025-11-09 15:09:23 +08:00
parent ee7b149381
commit 18fc7d57b4
2 changed files with 6 additions and 4 deletions

View File

@ -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');

View File

@ -44,7 +44,7 @@
<a-menu-item key="rename" @click.stop="renameChat(chat.id)">
<EditOutlined /> 重命名
</a-menu-item>
<a-menu-item key="delete" @click.stop="deleteChat(chat.id)" v-if="chat.id !== currentChatId">
<a-menu-item key="delete" @click.stop="deleteChat(chat.id)">
<DeleteOutlined /> 删除
</a-menu-item>
</a-menu>