fix: 更新聊天删除逻辑以自动创建新对话
- 修改 `AgentChatComponent.vue` 中的删除聊天逻辑,确保删除当前对话时自动创建新对话。 - 更新 `ChatSidebarComponent.vue` 中的删除菜单项,移除对当前聊天 ID 的限制,允许删除任何聊天。
This commit is contained in:
parent
ee7b149381
commit
18fc7d57b4
@ -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');
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user