diff --git a/internal/web/html.go b/internal/web/html.go index e901b66..0497a13 100644 --- a/internal/web/html.go +++ b/internal/web/html.go @@ -312,6 +312,23 @@ const indexHTML = ` font-style: italic; } .typing-indicator.active { display: block; } + .agent-call-indicator { + display: none; + padding: 8px 16px; + color: #9ece6a; + font-size: 13px; + font-weight: 600; + background: #2b3a2b; + border-top: 1px solid #414868; + } + .agent-call-indicator.active { display: block; } + .agent-name-highlight { + color: #bb9af7; + font-weight: 700; + background: #2a1f3a; + padding: 2px 6px; + border-radius: 4px; + } ::-webkit-scrollbar { width: 6px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: #414868; border-radius: 3px; } @@ -327,6 +344,7 @@ const indexHTML = `
Processing...
+
@@ -360,6 +378,7 @@ const indexHTML = ` const messageInput = document.getElementById('messageInput'); const sendBtn = document.getElementById('sendBtn'); const typingIndicator = document.getElementById('typingIndicator'); + const agentCallIndicator = document.getElementById('agentCallIndicator'); const statTools = document.getElementById('statTools'); const statSkills = document.getElementById('statSkills'); const statAgents = document.getElementById('statAgents'); @@ -424,6 +443,14 @@ const indexHTML = ` console.log('SSE data received:', e.data.substring(0, 50) + '...'); if (currentAssistantDiv) { currentContent += e.data; + const agentMatch = currentContent.match(/正在执行工具:\s*agent_call.*?agent[:"]\s*["']?([^"'\s,}]+)/); + if (agentMatch) { + const agentName = agentMatch[1]; + agentCallIndicator.innerHTML = '[' + agentName + '] 正在执行...'; + agentCallIndicator.classList.add('active'); + } else if (currentContent.includes('工具执行完成') || currentContent.includes('agent_call')) { + agentCallIndicator.classList.remove('active'); + } const content = currentAssistantDiv.querySelector('.message-content'); content.innerHTML = renderMarkdown(currentContent); if (typeof hljs !== 'undefined') { @@ -508,6 +535,7 @@ const indexHTML = ` messageInput.disabled = false; sendBtn.disabled = false; typingIndicator.classList.remove('active'); + agentCallIndicator.classList.remove('active'); messageInput.focus(); currentAssistantDiv = null; currentContent = '';