Spaces:
Running
Running
edit the code and implement for the user to actually have work with LLM model locally running on local lm-studios api server (localhost:1234). remove the simulated example showcase
1ae5c82
verified
| <html lang="en" class="dark"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Nexus AI Framework - Advanced Multi-Agent System</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/animejs/lib/anime.iife.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> | |
| <script src="https://unpkg.com/feather-icons"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.net.min.js"></script> | |
| <script> | |
| tailwind.config = { | |
| darkMode: 'class', | |
| theme: { | |
| extend: { | |
| colors: { | |
| violet: { | |
| 50: '#f5f3ff', | |
| 100: '#ede9fe', | |
| 200: '#ddd6fe', | |
| 300: '#c4b5fd', | |
| 400: '#a78bfa', | |
| 500: '#8b5cf6', | |
| 600: '#7c3aed', | |
| 700: '#6d28d9', | |
| 800: '#5b21b6', | |
| 900: '#4c1d95', | |
| } | |
| }, | |
| animation: { | |
| 'pulse-slow': 'pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite', | |
| 'float': 'float 6s ease-in-out infinite', | |
| 'glow': 'glow 2s ease-in-out infinite alternate', | |
| }, | |
| keyframes: { | |
| float: { | |
| '0%, 100%': { transform: 'translateY(0)' }, | |
| '50%': { transform: 'translateY(-10px)' }, | |
| }, | |
| glow: { | |
| '0%': { boxShadow: '0 0 20px rgba(139, 92, 246, 0.5)' }, | |
| '100%': { boxShadow: '0 0 30px rgba(139, 92, 246, 0.8)' }, | |
| } | |
| } | |
| } | |
| } | |
| } | |
| </script> | |
| <style> | |
| .glass-morphism { | |
| background: rgba(17, 24, 39, 0.7); | |
| backdrop-filter: blur(10px); | |
| border: 1px solid rgba(139, 92, 246, 0.2); | |
| } | |
| .neon-border { | |
| box-shadow: 0 0 20px rgba(139, 92, 246, 0.3), inset 0 0 20px rgba(139, 92, 246, 0.1); | |
| } | |
| .agent-card { | |
| transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); | |
| } | |
| .agent-card:hover { | |
| transform: translateY(-5px) scale(1.02); | |
| } | |
| .message-bubble { | |
| animation: slideIn 0.3s ease-out; | |
| } | |
| @keyframes slideIn { | |
| from { | |
| opacity: 0; | |
| transform: translateX(-20px); | |
| } | |
| to { | |
| opacity: 1; | |
| transform: translateX(0); | |
| } | |
| } | |
| .neural-network { | |
| background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.1) 0%, transparent 70%); | |
| } | |
| .code-block { | |
| background: linear-gradient(135deg, #1e1b4b 0%, #0f0f23 100%); | |
| } | |
| .pulse-ring { | |
| animation: pulseRing 2s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite; | |
| } | |
| @keyframes pulseRing { | |
| 0% { | |
| transform: scale(0.95); | |
| opacity: 1; | |
| } | |
| 100% { | |
| transform: scale(1.4); | |
| opacity: 0; | |
| } | |
| } | |
| ::-webkit-scrollbar { | |
| width: 8px; | |
| height: 8px; | |
| } | |
| ::-webkit-scrollbar-track { | |
| background: #1f2937; | |
| } | |
| ::-webkit-scrollbar-thumb { | |
| background: #8b5cf6; | |
| border-radius: 4px; | |
| } | |
| ::-webkit-scrollbar-thumb:hover { | |
| background: #7c3aed; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-900 text-gray-100 min-h-screen overflow-x-hidden"> | |
| <!-- Vanta.js Background --> | |
| <div id="vanta-bg" class="fixed inset-0 z-0"></div> | |
| <!-- Main Content --> | |
| <div class="relative z-10"> | |
| <!-- Navigation Header --> | |
| <nav class="glass-morphism sticky top-0 z-50 px-6 py-4 border-b border-violet-500/20"> | |
| <div class="max-w-7xl mx-auto flex items-center justify-between"> | |
| <div class="flex items-center space-x-4"> | |
| <div class="relative"> | |
| <div class="w-10 h-10 bg-violet-600 rounded-lg flex items-center justify-center"> | |
| <i data-feather="cpu" class="w-6 h-6"></i> | |
| </div> | |
| <div class="absolute -inset-1 bg-violet-600 rounded-lg pulse-ring"></div> | |
| </div> | |
| <h1 class="text-2xl font-bold bg-gradient-to-r from-violet-400 to-violet-600 bg-clip-text text-transparent"> | |
| Nexus AI Framework | |
| </h1> | |
| </div> | |
| <div class="flex items-center space-x-6"> | |
| <button class="flex items-center space-x-2 px-4 py-2 rounded-lg bg-violet-600 hover:bg-violet-700 transition-colors"> | |
| <i data-feather="play" class="w-4 h-4"></i> | |
| <span>Start Simulation</span> | |
| </button> | |
| <button class="p-2 rounded-lg hover:bg-gray-800 transition-colors"> | |
| <i data-feather="settings" class="w-5 h-5"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </nav> | |
| <!-- Main Interface --> | |
| <div class="max-w-7xl mx-auto p-6 space-y-6"> | |
| <!-- LLM Configuration --> | |
| <div class="glass-morphism rounded-xl p-6 neon-border"> | |
| <h2 class="text-xl font-semibold mb-6 flex items-center space-x-2"> | |
| <i data-feather="settings" class="w-5 h-5 text-violet-400"></i> | |
| <span>LLM Configuration</span> | |
| </h2> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-6"> | |
| <div class="space-y-4"> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-300 mb-2">LM Studio Server</label> | |
| <input type="text" id="lm-studio-url" value="http://localhost:1234" class="w-full px-3 py-2 bg-gray-800 border border-gray-700 rounded-lg focus:outline-none focus:border-violet-500"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-300 mb-2">Model Name</label> | |
| <input type="text" id="model-name" placeholder="Enter model name" class="w-full px-3 py-2 bg-gray-800 border border-gray-700 rounded-lg focus:outline-none focus:border-violet-500"> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-300 mb-2">Temperature</label> | |
| <input type="range" id="temperature" min="0" max="1" step="0.1" value="0.7" class="w-full"> | |
| <div class="flex justify-between text-xs text-gray-400"> | |
| <span>0</span> | |
| <span>0.5</span> | |
| <span>1.0</span> | |
| </div> | |
| </div> | |
| <div class="space-y-4"> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-300 mb-2">Max Tokens</label> | |
| <input type="number" id="max-tokens" value="512" class="w-full px-3 py-2 bg-gray-800 border border-gray-700 rounded-lg focus:outline-none focus:border-violet-500"> | |
| </div> | |
| <div class="flex items-center space-x-4"> | |
| <button onclick="testConnection()" class="px-4 py-2 bg-violet-600 rounded-lg hover:bg-violet-700 transition-colors"> | |
| Test Connection | |
| </button> | |
| <button onclick="loadModels()" class="px-4 py-2 bg-violet-600 rounded-lg hover:bg-violet-700 transition-colors"> | |
| Load Models | |
| </button> | |
| </div> | |
| <div id="connection-status" class="text-sm"> | |
| <!-- Connection status will be shown here --> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Chat Interface --> | |
| <div class="glass-morphism rounded-xl p-6 neon-border"> | |
| <h2 class="text-xl font-semibold mb-6 flex items-center space-x-2"> | |
| <i data-feather="message-square" class="w-5 h-5 text-violet-400"></i> | |
| <span>LLM Chat Interface</span> | |
| </h2> | |
| <div class="space-y-4"> | |
| <div class="flex space-x-4"> | |
| <input type="text" id="user-input" placeholder="Enter your message..." class="flex-1 px-3 py-2 bg-gray-800 border border-gray-700 rounded-lg focus:outline-none focus:border-violet-500"> | |
| <button onclick="sendMessage()" class="px-6 py-2 bg-violet-600 rounded-lg hover:bg-violet-700 transition-colors"> | |
| <i data-feather="send" class="w-4 h-4"></i> | |
| </button> | |
| </div> | |
| <div id="chat-messages" class="space-y-4 max-h-96 overflow-y-auto"> | |
| <!-- Chat messages will be displayed here --> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- System Logs --> | |
| <div class="glass-morphism rounded-xl p-6 neon-border"> | |
| <h2 class="text-xl font-semibold mb-6 flex items-center space-x-2"> | |
| <i data-feather="terminal" class="w-5 h-5 text-violet-400"></i> | |
| <span>System Logs</span> | |
| </h2> | |
| <div id="system-logs" class="space-y-2 max-h-64 overflow-y-auto font-mono text-sm"> | |
| <!-- System logs will be displayed here --> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // Initialize Vanta.js background | |
| VANTA.NET({ | |
| el: "#vanta-bg", | |
| mouseControls: true, | |
| touchControls: true, | |
| gyroControls: false, | |
| minHeight: 200.00, | |
| minWidth: 200.00, | |
| scale: 1.00, | |
| scaleMobile: 1.00, | |
| color: 0x8b5cf6, | |
| backgroundColor: 0x111827, | |
| points: 10.00, | |
| maxDistance: 20.00, | |
| spacing: 15.00 | |
| }); | |
| // Agent System Core | |
| class AgentSystem { | |
| constructor() { | |
| this.agents = new Map(); | |
| this.messages = []; | |
| this.tasks = []; | |
| this.performanceData = { | |
| labels: [], | |
| datasets: [{ | |
| label: 'CPU Usage', | |
| data: [], | |
| borderColor: 'rgb(139, 92, 246)', | |
| backgroundColor: 'rgba(139, 92, 246, 0.1)', | |
| tension: 0.4 | |
| }] | |
| }; | |
| this.initializeAgents(); | |
| this.startSimulation(); | |
| } | |
| initializeAgents() { | |
| const agentTypes = [ | |
| { name: 'Analyzer', type: 'analytical', specialization: 'data-analysis', status: 'active' }, | |
| { name: 'Creator', type: 'creative', specialization: 'content-generation', status: 'active' }, | |
| { name: 'Decider', type: 'decision', specialization: 'strategic-planning', status: 'idle' }, | |
| { name: 'Coordinator', type: 'coordination', specialization: 'task-orchestration', status: 'active' } | |
| ]; | |
| agentTypes.forEach((config, index) => { | |
| this.createAgent(config); | |
| }); | |
| } | |
| createAgent(config) { | |
| const agent = { | |
| id: `agent-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, | |
| ...config, | |
| thoughts: [], | |
| goals: [], | |
| memory: { | |
| short: [], | |
| long: [], | |
| working: [] | |
| }, | |
| tools: this.assignTools(config.specialization), | |
| metrics: { | |
| tasksCompleted: 0, | |
| messagesProcessed: 0, | |
| accuracy: Math.random() * 20 + 80, | |
| efficiency: Math.random() * 30 + 70 | |
| } | |
| }; | |
| this.agents.set(agent.id, agent); | |
| this.renderAgent(agent); | |
| return agent; | |
| } | |
| assignTools(specialization) { | |
| const toolsets = { | |
| 'data-analysis': ['python', 'sql', 'pandas', 'numpy'], | |
| 'content-generation': ['nlp', 'gpt', 'image-gen', 'text-to-speech'], | |
| 'strategic-planning': ['frameworks', 'models', 'simulator', 'optimizer'], | |
| 'task-orchestration': ['scheduler', 'queue', 'monitor', 'balancer'] | |
| }; | |
| return toolsets[specialization] || ['basic-tools']; | |
| } | |
| renderAgent(agent) { | |
| const container = document.getElementById('agents-container'); | |
| const agentCard = document.createElement('div'); | |
| agentCard.className = 'agent-card glass-morphism rounded-lg p-4 border border-violet-500/20 hover:border-violet-500/40'; | |
| agentCard.id = `card-${agent.id}`; | |
| agentCard.innerHTML = ` | |
| <div class="flex items-start justify-between mb-3"> | |
| <div class="flex items-center space-x-3"> | |
| <div class="w-10 h-10 bg-violet-600 rounded-lg flex items-center justify-center"> | |
| <i data-feather="${this.getAgentIcon(agent.type)}" class="w-5 h-5"></i> | |
| </div> | |
| <div> | |
| <h4 class="font-semibold">${agent.name}</h4> | |
| <span class="text-xs px-2 py-1 rounded-full ${ | |
| agent.status === 'active' ? 'bg-green-500/20 text-green-400' : 'bg-gray-500/20 text-gray-400' | |
| }">${agent.status}</span> | |
| </div> | |
| </div> | |
| <button onclick="agentSystem.removeAgent('${agent.id}')" class="p-1 hover:bg-red-500/20 rounded transition-colors"> | |
| <i data-feather="x" class="w-4 h-4"></i> | |
| </button> | |
| </div> | |
| <div class="space-y-2 text-sm"> | |
| <div class="flex justify-between"> | |
| <span class="text-gray-400">Specialization:</span> | |
| <span class="text-violet-400">${agent.specialization}</span> | |
| </div> | |
| <div class="flex justify-between"> | |
| <span class="text-gray-400">Accuracy:</span> | |
| <span>${agent.metrics.accuracy.toFixed(1)}%</span> | |
| </div> | |
| <div class="flex justify-between"> | |
| <span class="text-gray-400">Efficiency:</span> | |
| <span>${agent.metrics.efficiency.toFixed(1)}%</span> | |
| </div> | |
| </div> | |
| <div class="mt-3 pt-3 border-t border-gray-700"> | |
| <div class="text-xs text-gray-400"> | |
| <div>Tasks: ${agent.metrics.tasksCompleted}</div> | |
| <div>Messages: ${agent.metrics.messagesProcessed}</div> | |
| </div> | |
| </div> | |
| `; | |
| container.appendChild(agentCard); | |
| feather.replace(); | |
| } | |
| getAgentIcon(type) { | |
| const icons = { | |
| 'analytical': 'bar-chart-2', | |
| 'creative': 'pen-tool', | |
| 'decision': 'git-branch', | |
| 'coordination': 'git-pull-request' | |
| }; | |
| return icons[type] || 'cpu'; | |
| } | |
| removeAgent(agentId) { | |
| this.agents.delete(agentId); | |
| const card = document.getElementById(`card-${agentId}`); | |
| if (card) { | |
| anime({ | |
| targets: card, | |
| opacity: 0, | |
| scale: 0.8, | |
| duration: 300, | |
| easing: 'easeInOutQuad', | |
| complete: () => card.remove() | |
| }); | |
| } | |
| } | |
| startSimulation() { | |
| setInterval(() => this.simulateAgentActivity(), 2000); | |
| setInterval(() => this.updatePerformanceMetrics(), 1000); | |
| setInterval(() => this.simulateMemoryUsage(), 3000); | |
| this.initializeChart(); | |
| } | |
| simulateAgentActivity() { | |
| const agents = Array.from(this.agents.values()); | |
| if (agents.length < 2) return; | |
| const sender = agents[Math.floor(Math.random() * agents.length)]; | |
| const receiver = agents[Math.floor(Math.random() * agents.length)]; | |
| if (sender.id !== receiver.id) { | |
| this.sendMessage(sender, receiver); | |
| this.processTask(sender); | |
| } | |
| } | |
| sendMessage(sender, receiver) { | |
| const intents = ['ask', 'respond', 'delegate', 'alert', 'inform']; | |
| const intent = intents[Math.floor(Math.random() * intents.length)]; | |
| const message = { | |
| id: `msg-${Date.now()}`, | |
| from: sender.id, | |
| to: receiver.id, | |
| intent: intent, | |
| content: this.generateMessageContent(intent, sender.specialization), | |
| timestamp: new Date(), | |
| priority: Math.random() > 0.7 ? 'high' : 'normal' | |
| }; | |
| this.messages.push(message); | |
| this.renderMessage(message); | |
| sender.metrics.messagesProcessed++; | |
| this.updateAgentCard(sender); | |
| } | |
| generateMessageContent(intent, specialization) { | |
| const templates = { | |
| 'ask': [ | |
| `Requesting analysis on ${specialization} data`, | |
| `Need input on current ${specialization} strategy`, | |
| `Query regarding ${specialization} optimization` | |
| ], | |
| 'respond': [ | |
| `Analysis complete for ${specialization} module`, | |
| `Response to ${specialization} query received`, | |
| `Updated ${specialization} parameters` | |
| ], | |
| 'delegate': [ | |
| `Delegating ${specialization} task to your queue`, | |
| `Please handle this ${specialization} request`, | |
| `${specialization} processing required` | |
| ], | |
| 'alert': [ | |
| `Alert: ${specialization} threshold exceeded`, | |
| `Warning: ${specialization} anomaly detected`, | |
| `Critical: ${specialization} system stress` | |
| ], | |
| 'inform': [ | |
| `Update: ${specialization} status changed`, | |
| `Info: ${specialization} module updated`, | |
| `Notification: ${specialization} complete` | |
| ] | |
| }; | |
| const messages = templates[intent] || templates['inform']; | |
| return messages[Math.floor(Math.random() * messages.length)]; | |
| } | |
| renderMessage(message) { | |
| const container = document.getElementById('message-flow'); | |
| const messageEl = document.createElement('div'); | |
| messageEl.className = 'message-bubble flex items-start space-x-3 p-3 rounded-lg bg-gray-800/50 border-l-4 border-violet-500'; | |
| const sender = this.agents.get(message.from); | |
| const receiver = this.agents.get(message.to); | |
| messageEl.innerHTML = ` | |
| <div class="flex-1"> | |
| <div class="flex items-center justify-between mb-1"> | |
| <span class="text-sm font-semibold">${sender.name} → ${receiver.name}</span> | |
| <span class="text-xs text-gray-400">${message.timestamp.toLocaleTimeString()}</span> | |
| </div> | |
| <p class="text-sm text-gray-300">${message.content}</p> | |
| <div class="flex items-center space-x-2 mt-2"> | |
| <span class="text-xs px-2 py-1 rounded bg-violet-500/20 text-violet-400">${message.intent}</span> | |
| ${message.priority === 'high' ? '<span class="text-xs px-2 py-1 rounded bg-red-500/20 text-red-400">HIGH</span>' : ''} | |
| </div> | |
| </div> | |
| `; | |
| container.insertBefore(messageEl, container.firstChild); | |
| if (container.children.length > 10) { | |
| container.removeChild(container.lastChild); | |
| } | |
| } | |
| processTask(agent) { | |
| const taskTypes = ['analysis', 'generation', 'optimization', 'coordination']; | |
| const task = { | |
| id: `task-${Date.now()}`, | |
| type: taskTypes[Math.floor(Math.random() * taskTypes.length)], | |
| assignedTo: agent.id, | |
| status: 'processing', | |
| progress: 0, | |
| createdAt: new Date() | |
| }; | |
| this.tasks.push(task); | |
| this.renderTask(task); | |
| // Simulate task progress | |
| const progressInterval = setInterval(() => { | |
| task.progress += Math.random() * 30; | |
| if (task.progress >= 100) { | |
| task.progress = 100; | |
| task.status = 'completed'; | |
| agent.metrics.tasksCompleted++; | |
| this.updateAgentCard(agent); | |
| clearInterval(progressInterval); | |
| setTimeout(() => this.removeTask(task.id), 2000); | |
| } | |
| this.updateTaskProgress(task); | |
| }, 1000); | |
| } | |
| renderTask(task) { | |
| const container = document.getElementById('task-queue'); | |
| const taskEl = document.createElement('div'); | |
| taskEl.className = 'p-3 rounded-lg bg-gray-800/50 border border-gray-700'; | |
| taskEl.id = `task-${task.id}`; | |
| const agent = this.agents.get(task.assignedTo); | |
| taskEl.innerHTML = ` | |
| <div class="flex items-center justify-between mb-2"> | |
| <span class="text-sm font-medium">${task.type}</span> | |
| <span class="text-xs px-2 py-1 rounded ${ | |
| task.status === 'completed' ? 'bg-green-500/20 text-green-400' : 'bg-yellow-500/20 text-yellow-400' | |
| }">${task.status}</span> | |
| </div> | |
| <div class="text-xs text-gray-400 mb-2">Assigned to: ${agent.name}</div> | |
| <div class="w-full bg-gray-700 rounded-full h-1.5"> | |
| <div class="bg-violet-500 h-1.5 rounded-full transition-all duration-500" style="width: ${task.progress}%"></div> | |
| </div> | |
| `; | |
| container.insertBefore(taskEl, container.firstChild); | |
| if (container.children.length > 5) { | |
| container.removeChild(container.lastChild); | |
| } | |
| } | |
| updateTaskProgress(task) { | |
| const taskEl = document.getElementById(`task-${task.id}`); | |
| if (taskEl) { | |
| const progressBar = taskEl.querySelector('.bg-violet-500'); | |
| const statusBadge = taskEl.querySelector('.rounded'); | |
| progressBar.style.width = `${task.progress}%`; | |
| if (task.status === 'completed') { | |
| statusBadge.className = 'text-xs px-2 py-1 rounded bg-green-500/20 text-green-400'; | |
| statusBadge.textContent = 'completed'; | |
| } | |
| } | |
| } | |
| removeTask(taskId) { | |
| const taskEl = document.getElementById(`task-${taskId}`); | |
| if (taskEl) { | |
| anime({ | |
| targets: taskEl, | |
| opacity: 0, | |
| translateX: -20, | |
| duration: 300, | |
| easing: 'easeInOutQuad', | |
| complete: () => taskEl.remove() | |
| }); | |
| } | |
| } | |
| updateAgentCard(agent) { | |
| const card = document.getElementById(`card-${agent.id}`); | |
| if (card) { | |
| const metricsDiv = card.querySelector('.text-xs.text-gray-400'); | |
| metricsDiv.innerHTML = ` | |
| <div>Tasks: ${agent.metrics.tasksCompleted}</div> | |
| <div>Messages: ${agent.metrics.messagesProcessed}</div> | |
| `; | |
| } | |
| } | |
| updatePerformanceMetrics() { | |
| const cpuUsage = Math.random() * 30 + 40; | |
| const time = new Date().toLocaleTimeString(); | |
| this.performanceData.labels.push(time); | |
| this.performanceData.datasets[0].data.push(cpuUsage); | |
| if (this.performanceData.labels.length > 10) { | |
| this.performanceData.labels.shift(); | |
| this.performanceData.datasets[0].data.shift(); | |
| } | |
| if (window.performanceChart) { | |
| window.performanceChart.update('none'); | |
| } | |
| } | |
| simulateMemoryUsage() { | |
| const shortTerm = Math.random() * 30 + 40; | |
| const longTerm = Math.random() * 20 + 60; | |
| const working = Math.random() * 40 + 20; | |
| document.getElementById('short-term-memory').textContent = `${shortTerm.toFixed(0)}%`; | |
| document.getElementById('long-term-memory').textContent = `${longTerm.toFixed(0)}%`; | |
| document.getElementById('working-memory').textContent = `${working.toFixed(0)}%`; | |
| document.getElementById('short-term-bar').style.width = `${shortTerm}%`; | |
| document.getElementById('long-term-bar').style.width = `${longTerm}%`; | |
| document.getElementById('working-bar').style.width = `${working}%`; | |
| } | |
| initializeChart() { | |
| const ctx = document.getElementById('performance-chart').getContext('2d'); | |
| window.performanceChart = new Chart(ctx, { | |
| type: 'line', | |
| data: this.performanceData, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| plugins: { | |
| legend: { | |
| display: false | |
| } | |
| }, | |
| scales: { | |
| x: { | |
| display: false | |
| }, | |
| y: { | |
| beginAtZero: true, | |
| max: 100, | |
| ticks: { | |
| color: '#9ca3af', | |
| callback: function(value) { | |
| return value + '%'; | |
| } | |
| }, | |
| grid: { | |
| color: 'rgba(75, 85, 99, 0.3)' | |
| } | |
| } | |
| } | |
| } | |
| }); | |
| } | |
| } | |
| // Initialize the system | |
| let agentSystem; | |
| document.addEventListener('DOMContentLoaded', () => { | |
| feather.replace(); | |
| agentSystem = new AgentSystem(); | |
| // Add animations | |
| anime({ | |
| targets: '.agent-card', | |
| opacity: [0, 1], | |
| translateY: [20, 0], | |
| delay: anime.stagger(100), | |
| duration: 800, | |
| easing: 'easeOutQuad' | |
| }); | |
| }); | |
| // Global functions | |
| function createAgent() { | |
| const types = ['analytical', 'creative', 'decision', 'coordination']; | |
| const specializations = ['data-analysis', 'content-generation', 'strategic-planning', 'task-orchestration']; | |
| const names = ['Quantum', 'Nova', 'Phoenix', 'Titan', 'Oracle', 'Matrix', 'Nexus', 'Vertex']; | |
| const config = { | |
| name: names[Math.floor(Math.random() * names.length)] + '-' + Math.floor(Math.random() * 100), | |
| type: types[Math.floor(Math.random() * types.length)], | |
| specialization: specializations[Math.floor(Math.random() * specializations.length)], | |
| status: Math.random() > 0.3 ? 'active' : 'idle' | |
| }; | |
| agentSystem.createAgent(config); | |
| // Animate new agent card | |
| setTimeout(() => { | |
| const newCard = document.querySelectorAll('.agent-card')[document.querySelectorAll('.agent-card').length - 1]; | |
| anime({ | |
| targets: newCard, | |
| scale: [0.8, 1], | |
| opacity: [0, 1], | |
| duration: 500, | |
| easing: 'easeOutBack' | |
| }); | |
| }, 100); | |
| } | |
| </script> | |
| </body> | |
| </html> | |