diff --git a/www/app.js b/www/app.js index 83cb9e9..3b1ab61 100644 --- a/www/app.js +++ b/www/app.js @@ -287,6 +287,9 @@ function bindPageEvents() { // ==================== 对话页面 ==================== function renderChatsPage() { + // 只显示没有智能体的普通对话 + const normalConversations = conversations.filter(conv => !conv.agentId); + return `
@@ -303,9 +306,9 @@ function renderChatsPage() {
- ${conversations.length === 0 + ${normalConversations.length === 0 ? '
暂无对话记录

点击右上角 + 开始新对话
' - : sortConversations().map(conv => ` + : sortNormalConversations(normalConversations).map(conv => `
${conv.is_pinned ? '📌' : ''}
${escapeHtml(conv.title)}
@@ -1138,7 +1141,7 @@ function renderProfilePage() {
@@ -1730,15 +1733,29 @@ function sortConversations() { }); } -// 搜索对话 +// 排序普通对话(没有智能体的) +function sortNormalConversations(convList) { + return [...convList].sort((a, b) => { + // 置顶优先 + if (a.is_pinned && !b.is_pinned) return -1; + if (!a.is_pinned && b.is_pinned) return 1; + // 然后按更新时间 + return b.updatedAt - a.updatedAt; + }); +} + +// 搜索普通对话(不包含智能体对话) function searchConversations(keyword) { const searchResults = document.getElementById('searchResults'); if (!searchResults) return; keyword = keyword.toLowerCase(); + // 只搜索没有智能体的普通对话 + const normalConversations = conversations.filter(conv => !conv.agentId); + // 搜索标题和消息内容 - const results = conversations.filter(conv => { + const results = normalConversations.filter(conv => { // 搜索标题 if (conv.title.toLowerCase().includes(keyword)) return true;