Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5acd9f08f1 | |||
| 31732a6303 | |||
| 7f576827b0 | |||
| 8287be10ea | |||
| a56bad11f1 |
18
www/app.js
18
www/app.js
@@ -789,7 +789,7 @@ function renderAgentsPage() {
|
|||||||
<div class="recent-agent-item" data-conv-id="${conv.id}">
|
<div class="recent-agent-item" data-conv-id="${conv.id}">
|
||||||
<div class="recent-agent-left">
|
<div class="recent-agent-left">
|
||||||
<span class="recent-agent-avatar">${conv.agent ? conv.agent.avatar : '🤖'}</span>
|
<span class="recent-agent-avatar">${conv.agent ? conv.agent.avatar : '🤖'}</span>
|
||||||
<span class="recent-agent-name">${conv.title}</span>
|
<span class="recent-agent-title">${conv.title}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="recent-agent-right">
|
<div class="recent-agent-right">
|
||||||
<span class="recent-agent-agent-name">${conv.agent ? conv.agent.name : '未知智能体'}</span>
|
<span class="recent-agent-agent-name">${conv.agent ? conv.agent.name : '未知智能体'}</span>
|
||||||
@@ -1324,6 +1324,7 @@ function filterDiscoverAgents(keyword) {
|
|||||||
if (!keyword) {
|
if (!keyword) {
|
||||||
// 显示所有
|
// 显示所有
|
||||||
showDiscoverSection('hot', systemAgents.filter(a => a.category === 'hot'));
|
showDiscoverSection('hot', systemAgents.filter(a => a.category === 'hot'));
|
||||||
|
showDiscoverSection('basic', systemAgents.filter(a => a.category === 'basic'));
|
||||||
showDiscoverSection('work', systemAgents.filter(a => a.category === 'work'));
|
showDiscoverSection('work', systemAgents.filter(a => a.category === 'work'));
|
||||||
showDiscoverSection('study', systemAgents.filter(a => a.category === 'study'));
|
showDiscoverSection('study', systemAgents.filter(a => a.category === 'study'));
|
||||||
showDiscoverSection('life', systemAgents.filter(a => a.category === 'life'));
|
showDiscoverSection('life', systemAgents.filter(a => a.category === 'life'));
|
||||||
@@ -1338,6 +1339,7 @@ function filterDiscoverAgents(keyword) {
|
|||||||
|
|
||||||
// 显示搜索结果
|
// 显示搜索结果
|
||||||
showDiscoverSection('hot', filtered.filter(a => a.category === 'hot'));
|
showDiscoverSection('hot', filtered.filter(a => a.category === 'hot'));
|
||||||
|
showDiscoverSection('basic', filtered.filter(a => a.category === 'basic'));
|
||||||
showDiscoverSection('work', filtered.filter(a => a.category === 'work'));
|
showDiscoverSection('work', filtered.filter(a => a.category === 'work'));
|
||||||
showDiscoverSection('study', filtered.filter(a => a.category === 'study'));
|
showDiscoverSection('study', filtered.filter(a => a.category === 'study'));
|
||||||
showDiscoverSection('life', filtered.filter(a => a.category === 'life'));
|
showDiscoverSection('life', filtered.filter(a => a.category === 'life'));
|
||||||
@@ -3003,10 +3005,10 @@ function showAgentHistoryPage() {
|
|||||||
<div class="agent-history-item" data-conv-id="${conv.id}">
|
<div class="agent-history-item" data-conv-id="${conv.id}">
|
||||||
<div class="agent-history-left">
|
<div class="agent-history-left">
|
||||||
<span class="agent-history-avatar">${conv.agent ? conv.agent.avatar : '🤖'}</span>
|
<span class="agent-history-avatar">${conv.agent ? conv.agent.avatar : '🤖'}</span>
|
||||||
<span class="agent-history-name">${conv.title}</span>
|
<span class="agent-history-title">${conv.title}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="agent-history-right">
|
<div class="agent-history-right">
|
||||||
<span class="agent-history-agent">${conv.agent ? conv.agent.name : '未知智能体'}</span>
|
<span class="agent-history-agent-name">${conv.agent ? conv.agent.name : '未知智能体'}</span>
|
||||||
<span class="agent-history-time">${formatTime(conv.updatedAt)}</span>
|
<span class="agent-history-time">${formatTime(conv.updatedAt)}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -3087,7 +3089,7 @@ async function openAgent(agentId) {
|
|||||||
// 创建新对话并设置智能体
|
// 创建新对话并设置智能体
|
||||||
const newConv = {
|
const newConv = {
|
||||||
id: backendId || Date.now().toString(),
|
id: backendId || Date.now().toString(),
|
||||||
title: currentAgent.name,
|
title: '新对话', // 和普通对话一样,初始标题为"新对话",后续自动生成
|
||||||
messages: [],
|
messages: [],
|
||||||
agentId: agentId,
|
agentId: agentId,
|
||||||
createdAt: Date.now(),
|
createdAt: Date.now(),
|
||||||
@@ -4541,7 +4543,11 @@ function renderMessages() {
|
|||||||
|
|
||||||
messagesDiv.innerHTML = currentConversation.messages.map((msg, index) => {
|
messagesDiv.innerHTML = currentConversation.messages.map((msg, index) => {
|
||||||
const isUser = msg.role === 'user';
|
const isUser = msg.role === 'user';
|
||||||
const avatar = isUser ? '👤' : '🤖';
|
// 用户头像使用实际头像,AI头像使用智能体头像或默认
|
||||||
|
const avatar = isUser
|
||||||
|
? (currentUser?.avatar || '👤')
|
||||||
|
: (currentAgent?.avatar || '🤖');
|
||||||
|
const avatarHtml = isUser ? renderAvatar(avatar) : avatar;
|
||||||
|
|
||||||
// 处理消息内容(支持图片)
|
// 处理消息内容(支持图片)
|
||||||
let contentHtml = '';
|
let contentHtml = '';
|
||||||
@@ -4616,7 +4622,7 @@ function renderMessages() {
|
|||||||
|
|
||||||
return `
|
return `
|
||||||
<div class="message ${msg.role}" data-index="${index}">
|
<div class="message ${msg.role}" data-index="${index}">
|
||||||
<div class="message-avatar">${avatar}</div>
|
<div class="message-avatar">${avatarHtml}</div>
|
||||||
<div class="message-body">
|
<div class="message-body">
|
||||||
${searchHtml}
|
${searchHtml}
|
||||||
${thinkingHtml}
|
${thinkingHtml}
|
||||||
|
|||||||
@@ -1730,6 +1730,16 @@ body {
|
|||||||
color: var(--primary);
|
color: var(--primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.recent-agent-title {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 500;
|
||||||
|
max-width: 120px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
.recent-agent-agent-name {
|
.recent-agent-agent-name {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: var(--primary);
|
color: var(--primary);
|
||||||
@@ -1807,7 +1817,17 @@ body {
|
|||||||
color: var(--primary);
|
color: var(--primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.agent-history-agent {
|
.agent-history-title {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 500;
|
||||||
|
max-width: 150px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agent-history-agent-name {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: var(--primary);
|
color: var(--primary);
|
||||||
background: rgba(102, 126, 234, 0.1);
|
background: rgba(102, 126, 234, 0.1);
|
||||||
|
|||||||
Reference in New Issue
Block a user