|
697 | 697 | display: flex; |
698 | 698 | align-items: center; |
699 | 699 | justify-content: center; |
700 | | - font-size: 11px; |
701 | | - font-weight: 700; |
702 | | - letter-spacing: .02em; |
| 700 | + font-size: 16px; |
| 701 | + font-weight: 600; |
| 702 | + letter-spacing: 0; |
703 | 703 | margin-top: 2px; |
704 | 704 | } |
705 | 705 |
|
|
1187 | 1187 | text-align: center; |
1188 | 1188 | } |
1189 | 1189 |
|
| 1190 | + .agent-status-state-emoji { |
| 1191 | + margin-left: auto; |
| 1192 | + font-size: 16px; |
| 1193 | + width: 20px; |
| 1194 | + display: flex; |
| 1195 | + align-items: center; |
| 1196 | + justify-content: center; |
| 1197 | + } |
| 1198 | + |
1190 | 1199 | #agent-status-info { |
1191 | 1200 | display: flex; |
1192 | 1201 | align-items: center; |
|
2169 | 2178 | const isHuman = authorLabel.toLowerCase() === 'human'; |
2170 | 2179 | const authorKey = isHuman ? 'human' : (isSystem ? 'system' : String(m.author_id ?? authorLabel)); |
2171 | 2180 | const color = authorColor(authorKey); |
2172 | | - let initials = authorLabel.slice(0, 2).toUpperCase(); |
2173 | | - if (!isHuman && !isSystem) { |
2174 | | - const base = authorLabel.split('(')[0].trim().toUpperCase(); |
2175 | | - initials = base.substring(0, 3); |
2176 | | - } |
| 2181 | + const avatarEmoji = window.AcbUtils?.getAgentAvatarEmoji ? window.AcbUtils.getAgentAvatarEmoji(authorKey) : '🤖'; |
2177 | 2182 | const bgAlpha = `${color}22`; // ~13% alpha tint for avatar bg |
2178 | 2183 |
|
2179 | 2184 | const row = document.createElement('div'); |
|
2192 | 2197 | } |
2193 | 2198 |
|
2194 | 2199 | row.innerHTML = ` |
2195 | | - <div class="msg-avatar" style="background:${bgAlpha};color:${color};border:1px solid ${color}44">${initials}</div> |
| 2200 | + <div class="msg-avatar" style="background:${bgAlpha};color:${color};border:1px solid ${color}44">${avatarEmoji}</div> |
2196 | 2201 | <div class="msg-col"> |
2197 | 2202 | <div class="msg-header"> |
2198 | 2203 | <span class="msg-author-label" style="color:${color}">${esc(authorLabel)}</span> |
|
2273 | 2278 | let el = document.getElementById(`typing-${agentId}`); |
2274 | 2279 | if (!el) { |
2275 | 2280 | const color = authorColor(agentId); |
2276 | | - const base = agentId.split('(')[0].trim().toUpperCase(); |
2277 | | - const initials = base.substring(0, 3); |
| 2281 | + const avatarEmoji = window.AcbUtils?.getAgentAvatarEmoji ? window.AcbUtils.getAgentAvatarEmoji(agentId) : '🤖'; |
2278 | 2282 | const row = document.createElement('div'); |
2279 | 2283 | row.className = 'msg-row msg-row-left'; |
2280 | 2284 | row.id = `typing-${agentId}`; |
2281 | 2285 | row.innerHTML = ` |
2282 | | - <div class="msg-avatar" style="background:${color}22;color:${color};border:1px solid ${color}44">${initials}</div> |
| 2286 | + <div class="msg-avatar" style="background:${color}22;color:${color};border:1px solid ${color}44">${avatarEmoji}</div> |
2283 | 2287 | <div class="msg-col"> |
2284 | 2288 | <div class="msg-header"> |
2285 | 2289 | <span class="msg-author-label" style="color:${color}">${esc(agentId)}</span> |
|
2347 | 2351 | return window.AcbUtils.escapeHtml(t); |
2348 | 2352 | } |
2349 | 2353 |
|
2350 | | - // ============================================================================================== |
2351 | | - // Agent Status Bar Update |
2352 | | - // ============================================================================================== |
2353 | | - async function updateStatusBar() { |
2354 | | - const allAgents = await api('/api/agents') || []; |
2355 | | - currentAgents = allAgents; // Cache for tooltip lookups |
2356 | | - const container = document.getElementById('agent-status-list'); |
2357 | | - if (!container) { |
2358 | | - return; |
2359 | | - } |
2360 | | - |
2361 | | - let participants = []; |
2362 | | - let isThreadMode = false; // Track if showing thread-specific agents |
2363 | | - |
2364 | | - // If a thread is selected, show agents in that thread |
2365 | | - if (activeThreadId) { |
2366 | | - // Σ╗Äσ╜ôσëìthreadτÜäµ╢êµü»Σ╕¡µÉσûµëǵ£ëσéΣ╕Äagents∩╝êµîëauthor_id∩╝ë |
2367 | | - const participantIdMap = new Map(); // id -> agent数据 |
2368 | | - const msgArea = document.getElementById('messages'); |
2369 | | - if (msgArea) { |
2370 | | - const rows = msgArea.querySelectorAll('[data-author-id]'); |
2371 | | - rows.forEach(row => { |
2372 | | - const authorId = row.getAttribute('data-author-id'); |
2373 | | - if (authorId && authorId !== 'system' && authorId !== 'human' && !participantIdMap.has(authorId)) { |
2374 | | - // 查找该author_id对应的agent |
2375 | | - const agent = allAgents.find(a => (a.id === authorId || a.agent_id === authorId)); |
2376 | | - if (agent) { |
2377 | | - participantIdMap.set(authorId, agent); |
2378 | | - } else { |
2379 | | - // 即使agent不在allAgents中,也创建一个离线表示 |
2380 | | - participantIdMap.set(authorId, { |
2381 | | - id: authorId, |
2382 | | - display_name: authorId, |
2383 | | - name: authorId, |
2384 | | - is_online: false, |
2385 | | - }); |
2386 | | - } |
2387 | | - } |
2388 | | - }); |
2389 | | - } |
2390 | | - participants = Array.from(participantIdMap.values()); |
2391 | | - isThreadMode = participants.length > 0; // Only thread mode if we have participants |
2392 | | - } |
2393 | | - |
2394 | | - // If no thread selected or no participants in thread, show all agents |
2395 | | - if (!isThreadMode) { |
2396 | | - participants = allAgents; |
2397 | | - isThreadMode = false; // Global mode - no thread context |
2398 | | - } |
2399 | | - |
2400 | | - // µÄÆσ║∩╝Üσ£¿τ║┐Σ╝ÿσàê∩╝îτä╢σÉĵîëµ£ÇσÉĵ┤╗σ迵ù╢Θù┤µÄÆσ║ |
2401 | | - participants.sort((a, b) => { |
2402 | | - if (a.is_online !== b.is_online) { |
2403 | | - return a.is_online ? -1 : 1; // 在线优先 |
2404 | | - } |
2405 | | - if (a.is_online && b.is_online) { |
2406 | | - const timeA = a.last_activity_time ? new Date(a.last_activity_time) : new Date(0); |
2407 | | - const timeB = b.last_activity_time ? new Date(b.last_activity_time) : new Date(0); |
2408 | | - return timeB - timeA; // 最近活动优先 |
2409 | | - } |
2410 | | - return 0; |
2411 | | - }); |
2412 | | - |
2413 | | - container.innerHTML = ''; |
2414 | | - |
2415 | | - if (participants.length === 0) { |
2416 | | - container.innerHTML = '<div style="color:var(--text-3);font-size:11px;padding:4px 12px;">No active agents</div>'; |
2417 | | - return; |
2418 | | - } |
2419 | | - |
2420 | | - participants.forEach(a => { |
2421 | | - const state = getAgentState(a); |
2422 | | - const emoji = getStateEmoji(state); |
2423 | | - const label = String(a.display_name ?? a.name ?? '').trim() || 'Unknown'; |
2424 | | - const offlineTime = getOfflineTime(a); |
2425 | | - const offlineDisplay = offlineTime ? ` (${offlineTime})` : ''; |
2426 | | - const isLongOffline = isOfflineMoreThanHour(a); |
2427 | | - |
2428 | | - const compressedChar = getCompressedOfflineChar(offlineTime); |
2429 | | - const item = document.createElement('acb-agent-status-item'); |
2430 | | - item.setData({ |
2431 | | - emoji, |
2432 | | - label, |
2433 | | - state, |
2434 | | - offlineDisplay, |
2435 | | - isLongOffline, |
2436 | | - compressedChar, |
2437 | | - escapeHtml, |
2438 | | - }); |
2439 | | - |
2440 | | - // Set data-agent-id for click-to-mention functionality |
2441 | | - if (a && a.id) { |
2442 | | - item.dataset.agentId = a.id; |
2443 | | - bindAgentTooltipEvents(item, a); |
2444 | | - } else if (a && a.agent_id) { |
2445 | | - item.dataset.agentId = a.agent_id; |
2446 | | - } |
2447 | | - container.appendChild(item); |
2448 | | - }); |
2449 | | - } |
2450 | | - |
2451 | 2354 | function getAgentState(agent) { |
2452 | 2355 | // 优先使用last_activity_time判断状态,而非is_online(后者基于heartbeat超时) |
2453 | 2356 | const activityTime = agent.last_activity_time ? new Date(agent.last_activity_time) : null; |
|
0 commit comments