diff --git a/web-vue/src/components/ChatDialog.vue b/web-vue/src/components/ChatDialog.vue index f4e178b..864ce0f 100644 --- a/web-vue/src/components/ChatDialog.vue +++ b/web-vue/src/components/ChatDialog.vue @@ -39,18 +39,17 @@ - - - + + +
+ + 删除会话 +
+
@@ -589,6 +588,17 @@ const handleChatAction = async (command, chat) => { } } +const deleteRecentChat = async (chat) => { + try { + await deleteConversation(chat.id) + } catch (e) { + // 即使 API 失败也删本地 + } + const idx = recentChats.value.findIndex(c => c.id === chat.id) + if (idx > -1) recentChats.value.splice(idx, 1) + if (currentContact.value?.id === chat.id) currentContact.value = null +} + const scrollToBottom = () => { nextTick(() => { if (messagesRef.value) { @@ -698,6 +708,8 @@ onUnmounted(() => { if (unsubscribeWs) unsubscribeWs() }) .sidebar-empty { padding: 20px; text-align: center; color: #909399; font-size: 12px; } .chat-action-btn { display: flex; align-items: center; cursor: pointer; padding: 4px; border-radius: 4px; color: #909399; transition: all 0.2s; } .chat-action-btn:hover { color: #409eff; background: #f0f9ff; } +.chat-action-list { display: flex; align-items: center; gap: 8px; padding: 8px; cursor: pointer; border-radius: 4px; font-size: 13px; color: #f56c6c; transition: background 0.2s; } +.chat-action-list:hover { background: #fef0f0; } .chat-main { flex: 1; display: flex; flex-direction: column; } .chat-header { display: flex; align-items: center; gap: 8px; padding: 12px; border-bottom: 1px solid #e4e7ed; }