yourgui's picture
🧩 PRODUCT REQUIREMENTS DOCUMENT (PRD)
5350fe7 verified
Raw
History Blame Contribute Delete
2.01 kB
// Shared functionality
document.addEventListener('DOMContentLoaded', () => {
// Initialize any shared components
console.log('VAI platform initialized');
// Example: API connection status monitoring
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);
});
// Workspace agent management
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';
});
}
}
// Initialize agent manager if on workspace page
if (window.location.pathname.includes('workspace')) {
window.agentManager = new AgentManager();
// Add default agents
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' });
// Activate first agent by default
if (window.agentManager.agents.length > 0) {
window.agentManager.activateAgent(window.agentManager.agents[0].id);
}
}