Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 439743c051 |
27
www/app.js
27
www/app.js
@@ -287,6 +287,9 @@ function bindPageEvents() {
|
||||
// ==================== 对话页面 ====================
|
||||
|
||||
function renderChatsPage() {
|
||||
// 只显示没有智能体的普通对话
|
||||
const normalConversations = conversations.filter(conv => !conv.agentId);
|
||||
|
||||
return `
|
||||
<div class="chats-page">
|
||||
<header class="chats-header">
|
||||
@@ -303,9 +306,9 @@ function renderChatsPage() {
|
||||
|
||||
<div class="chats-content">
|
||||
<div class="conversation-list" id="conversationList">
|
||||
${conversations.length === 0
|
||||
${normalConversations.length === 0
|
||||
? '<div class="empty-list">暂无对话记录<br><br>点击右上角 + 开始新对话</div>'
|
||||
: sortConversations().map(conv => `
|
||||
: sortNormalConversations(normalConversations).map(conv => `
|
||||
<div class="conversation-item ${conv.is_pinned ? 'pinned' : ''}" data-id="${conv.id}">
|
||||
${conv.is_pinned ? '<span class="pin-icon">📌</span>' : ''}
|
||||
<div class="conv-title">${escapeHtml(conv.title)}</div>
|
||||
@@ -1138,7 +1141,7 @@ function renderProfilePage() {
|
||||
</div>
|
||||
|
||||
<div class="profile-footer">
|
||||
<p>AI助手 v3.0.0</p>
|
||||
<p>AI助手 v3.2.1</p>
|
||||
<p>基于智谱 GLM-4.5-Air</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user