| |
| document.addEventListener('DOMContentLoaded', () => { |
| |
| console.log('VAI platform initialized'); |
| |
| |
| setInterval(() => { |
| const status = Math.random() > 0.1 ? 'Connected' : 'Connection Issues'; |
| const color = status === 'Connected' ? 'text-green-400' : 'text-yellow-400'; |
| const statusElement = document.getElementById('connection-status'); |
| if (statusElement) { |
| statusElement.textContent = status; |
| statusElement.className = `text-xs ${color}`; |
| } |
| }, 5000); |
| }); |
|
|
| |
| class AgentManager { |
| constructor() { |
| this.agents = []; |
| this.activeAgentId = null; |
| } |
| |
| addAgent(config) { |
| const agent = { |
| id: Date.now().toString(), |
| name: config.name || `Agent ${this.agents.length + 1}`, |
| model: config.model || 'ChatGPT', |
| status: 'waiting', |
| history: [] |
| }; |
| this.agents.push(agent); |
| return agent; |
| } |
| |
| activateAgent(agentId) { |
| this.activeAgentId = agentId; |
| this.agents.forEach(agent => { |
| agent.status = agent.id === agentId ? 'active' : 'waiting'; |
| }); |
| } |
| } |
|
|
| |
| if (window.location.pathname.includes('workspace')) { |
| window.agentManager = new AgentManager(); |
| |
| |
| window.agentManager.addAgent({ name: 'Research Agent', model: 'ChatGPT-4' }); |
| window.agentManager.addAgent({ name: 'Writing Agent', model: 'Claude-3' }); |
| window.agentManager.addAgent({ name: 'Analysis Agent', model: 'Lovable Agent' }); |
| window.agentManager.addAgent({ name: 'Execution Agent', model: 'GPT-4 Turbo' }); |
| |
| |
| if (window.agentManager.agents.length > 0) { |
| window.agentManager.activateAgent(window.agentManager.agents[0].id); |
| } |
| } |