File size: 2,186 Bytes
5d4ecc9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | document.addEventListener('DOMContentLoaded', () => {
// Sample agent data
const agents = [
{
id: 1,
name: "Data Miner",
status: "active",
skills: ["Web Scraping", "Data Analysis", "Pattern Recognition"],
avatar: "http://static.photos/technology/200x200/101"
},
{
id: 2,
name: "Security Sentinel",
status: "idle",
skills: ["Threat Detection", "Vulnerability Scanning", "Log Analysis"],
avatar: "http://static.photos/black/200x200/202"
},
{
id: 3,
name: "Customer Scout",
status: "active",
skills: ["Sentiment Analysis", "Chatbot", "FAQ Generation"],
avatar: "http://static.photos/blue/200x200/303"
}
];
// Render agent cards
const agentsContainer = document.getElementById('agents-container');
agents.forEach(agent => {
const card = document.createElement('custom-agent-card');
card.setAttribute('name', agent.name);
card.setAttribute('status', agent.status);
card.setAttribute('skills', JSON.stringify(agent.skills));
card.setAttribute('avatar', agent.avatar);
agentsContainer.appendChild(card);
});
// New agent button functionality
document.getElementById('new-agent-btn').addEventListener('click', () => {
const newAgentId = agents.length + 1;
const newAgent = {
id: newAgentId,
name: `Agent ${newAgentId}`,
status: "idle",
skills: ["Learning..."],
avatar: `http://static.photos/abstract/200x200/${newAgentId}00`
};
agents.push(newAgent);
const card = document.createElement('custom-agent-card');
card.setAttribute('name', newAgent.name);
card.setAttribute('status', newAgent.status);
card.setAttribute('skills', JSON.stringify(newAgent.skills));
card.setAttribute('avatar', newAgent.avatar);
agentsContainer.appendChild(card);
// Force icon refresh
feather.replace();
});
}); |