diff --git a/templates/agent_management.html b/templates/agent_management.html index 73a2e8a..fd9c9a2 100644 --- a/templates/agent_management.html +++ b/templates/agent_management.html @@ -97,6 +97,8 @@ + +
@@ -605,13 +607,15 @@ function displayAgents(agentsToShow) {
${agent.agent_name}

${agent.agent_description || 'No description'}

-
+
${agent.agent_status || 'Development'} ${agent.agent_version ? `v${agent.agent_version}` : ''} ${agent.quality_audit_status ? '' : ''} ${agent.quality_audit_status && agent.risk_factor ? getRiskFactorBadge(agent.risk_factor) : ''} + ${agent.total_messages ? `${agent.total_messages.toLocaleString()}` : ''} + ${agent.unique_users ? `${agent.unique_users}` : ''}
@@ -1040,14 +1044,15 @@ async function deleteAgent() { function filterAgents() { const searchTerm = document.getElementById('searchInput').value.toLowerCase(); const statusFilter = document.getElementById('statusFilter').value; - + let filtered = agents.filter(agent => { const matchesSearch = agent.agent_name.toLowerCase().includes(searchTerm) || - (agent.agent_description || '').toLowerCase().includes(searchTerm); + (agent.agent_description || '').toLowerCase().includes(searchTerm) || + (agent.agent_tags || []).some(tag => tag.toLowerCase().includes(searchTerm)); const matchesStatus = !statusFilter || agent.agent_status === statusFilter; return matchesSearch && matchesStatus; }); - + displayAgents(filtered); } @@ -1058,11 +1063,22 @@ function sortAndDisplayAgents() { return a.agent_name.localeCompare(b.agent_name); } else if (sortBy === 'status') { return (a.agent_status || 'Development').localeCompare(b.agent_status || 'Development'); + } else if (sortBy === 'total_messages') { + // High to low (most used first), treat null/undefined as 0 + const aVal = a.total_messages || 0; + const bVal = b.total_messages || 0; + return bVal - aVal; // Descending order + } else if (sortBy === 'unique_users') { + // High to low (most users first), treat null/undefined as 0 + const aVal = a.unique_users || 0; + const bVal = b.unique_users || 0; + return bVal - aVal; // Descending order } else { + // Default: created_at (newest first) return new Date(b.agent_created_at) - new Date(a.agent_created_at); } }); - + displayAgents(sorted); }