fix: 智能体历史使用记录只显示真正有对话的智能体

This commit is contained in:
2026-04-27 17:03:50 +08:00
parent d1ddd340c0
commit 24ba04b3e3

View File

@@ -263,9 +263,10 @@ function getRemainingQuota() {
}
// 获取使用智能体的对话列表(按时间倒序)
// 只返回真正有对话消息的记录messages.length > 0
function getAgentConversationHistory(limit = 5) {
return conversations
.filter(conv => conv.agentId) // 筛选有智能体的对话
.filter(conv => conv.agentId && conv.messages && conv.messages.length > 0) // 筛选有智能体且有消息的对话
.sort((a, b) => b.updatedAt - a.updatedAt) // 按更新时间倒序
.slice(0, limit)
.map(conv => {