Compare commits

..

2 Commits

3 changed files with 36 additions and 28 deletions

View File

@@ -415,7 +415,12 @@ function renderAgentsPage() {
<!-- 最近使用 -->
${recentAgents.length > 0 ? `
<div class="agents-section">
<div class="section-title">🕐 最近使用</div>
<div class="section-title-row">
<div class="section-title">🕐 最近使用</div>
${totalRecentCount > 5 ? `
<div class="section-more" id="showAllRecentBtn">更多&gt;&gt;</div>
` : ''}
</div>
<div class="recent-agents-list">
${recentAgents.map(agent => `
<div class="recent-agent-item" data-id="${agent.id}">
@@ -429,11 +434,6 @@ function renderAgentsPage() {
</div>
</div>
`).join('')}
${totalRecentCount > 5 ? `
<div class="recent-agent-more" id="showAllRecentBtn">
<span>查看全部 ${totalRecentCount} 个历史使用...</span>
</div>
` : ''}
</div>
</div>
` : ''}
@@ -634,9 +634,6 @@ function openAgent(agentId) {
currentAgent = agents.find(a => a.id === agentId);
if (!currentAgent) return;
// 记录智能体使用历史
recordAgentUsage(agentId);
// 创建新对话并设置智能体
createNewConversation();
currentConversation.agentId = agentId;
@@ -1565,6 +1562,11 @@ async function sendMessage() {
// 隐藏欢迎界面
welcome.style.display = 'none';
// 如果是智能体对话的第一条消息,记录智能体使用
if (currentConversation.agentId && currentConversation.messages.length === 0) {
recordAgentUsage(currentConversation.agentId);
}
// 添加用户消息
currentConversation.messages.push({ role: 'user', content: text });

View File

@@ -8,12 +8,12 @@
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>AI助手</title>
<link rel="stylesheet" href="style.css?v=3.1.0">
<link rel="stylesheet" href="style.css?v=3.1.2">
<link rel="manifest" href="manifest.json">
</head>
<body>
<div id="app"></div>
<script src="marked.min.js?v=3.1.0"></script>
<script src="app.js?v=3.1.0"></script>
<script src="marked.min.js?v=3.1.2"></script>
<script src="app.js?v=3.1.2"></script>
</body>
</html>

View File

@@ -185,6 +185,28 @@ body {
margin-bottom: 12px;
}
.section-title-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.section-title-row .section-title {
margin-bottom: 0;
}
.section-more {
font-size: 14px;
color: var(--primary);
cursor: pointer;
transition: color 0.2s;
}
.section-more:hover {
color: #5a67d8;
}
.agents-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
@@ -279,22 +301,6 @@ body {
color: var(--primary);
}
.recent-agent-more {
padding: 12px 16px;
background: white;
border: 1px solid var(--border-color);
border-radius: 10px;
cursor: pointer;
text-align: center;
font-size: 14px;
color: var(--primary);
transition: all 0.2s;
}
.recent-agent-more:hover {
background: rgba(102, 126, 234, 0.05);
}
/* 智能体历史页面 */
.agent-history-page {
display: flex;