mastermind-comms / index.html
MarcRyan's picture
Add 2 files
e9fd489 verified
Raw History Blame Contribute Delete
68.2 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Advanced Multi-Model AI Agent System</title> <script src="https://cdn.tailwindcss.com"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> /* Previous styles remain the same */ @keyframes float { 0% { transform: translateY(0px); } 50% { transform: translateY(-10px); } 100% { transform: translateY(0px); } } .model-icon { animation: float 4s ease-in-out infinite; transition: all 0.3s ease; border: 2px solid; cursor: pointer; } .model-icon:hover { transform: scale(1.05) !important; animation-play-state: paused; } .llama { animation-delay: 0s; border-color: #3b82f6; } .gemma { animation-delay: 0.5s; border-color: #ef4444; } .hermes { animation-delay: 1s; border-color: #10b981; } .chat-container { height: 600px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #4b5563 #1f2937; } .chat-container::-webkit-scrollbar { width: 8px; } .chat-container::-webkit-scrollbar-track { background: #1f2937; } .chat-container::-webkit-scrollbar-thumb { background-color: #4b5563; border-radius: 4px; } .message { max-width: 80%; word-wrap: break-word; } .typing-indicator { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background-color: #6b7280; margin-right: 4px; animation: bounce 1.5s infinite ease-in-out; } .typing-indicator:nth-child(2) { animation-delay: 0.2s; } .typing-indicator:nth-child(3) { animation-delay: 0.4s; } @keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } } .model-badge { background: linear-gradient(135deg, #6b46c1 0%, #3b82f6 100%); color: white; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: bold; margin-left: 5px; } .processing-queue { position: fixed; bottom: 20px; right: 20px; background: rgba(30, 41, 59, 0.9); border: 1px solid #334155; border-radius: 8px; padding: 15px; width: 300px; z-index: 100; box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); } .queue-header { font-weight: bold; color: #f59e0b; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; } .queue-item { padding: 5px 0; border-bottom: 1px solid #334155; display: flex; align-items: center; } .queue-item:last-child { border-bottom: none; } .queue-status { width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; } .status-pending { background-color: #f59e0b; animation: pulse 2s infinite; } .status-processing { background-color: #3b82f6; animation: pulse 1s infinite; } .status-completed { background-color: #10b981; } .status-failed { background-color: #ef4444; } .queue-item-name { flex-grow: 1; font-size: 0.9rem; } .queue-item-time { font-size: 0.8rem; color: #9ca3af; } .priority-badge { background-color: #ef4444; color: white; font-size: 0.6rem; padding: 2px 4px; border-radius: 4px; margin-left: 5px; } .task-container { background: rgba(30, 41, 59, 0.8); border: 1px solid #334155; border-radius: 8px; padding: 15px; margin: 10px 0; } .task-header { font-weight: bold; color: #f59e0b; margin-bottom: 8px; display: flex; align-items: center; } .task-content { background: rgba(15, 23, 42, 0.5); padding: 10px; border-radius: 5px; font-family: monospace; white-space: pre-wrap; font-size: 0.9rem; } .model-analysis { border-left: 4px solid; padding: 10px; margin: 10px 0; border-radius: 0 5px 5px 0; } .llama-analysis { border-left-color: #3b82f6; background: rgba(59, 130, 246, 0.1); } .gemma-analysis { border-left-color: #ef4444; background: rgba(239, 68, 68, 0.1); } .hermes-analysis { border-left-color: #10b981; background: rgba(16, 185, 129, 0.1); } @keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); } 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); } } .highlight { animation: highlight-pulse 1.5s ease-out; } @keyframes highlight-pulse { 0% { background-color: rgba(245, 158, 11, 0); } 50% { background-color: rgba(245, 158, 11, 0.3); } 100% { background-color: rgba(245, 158, 11, 0); } } /* New styles for agent system */ .agent-panel { background: rgba(15, 23, 42, 0.8); border: 1px solid #334155; border-radius: 8px; padding: 15px; margin-bottom: 20px; } .agent-controls { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; } .agent-status { display: flex; align-items: center; padding: 5px 10px; border-radius: 4px; font-size: 0.85rem; } .status-active { background-color: rgba(16, 185, 129, 0.2); color: #10b981; } .status-inactive { background-color: rgba(239, 68, 68, 0.2); color: #ef4444; } .agent-memory { background: rgba(30, 41, 59, 0.5); border-radius: 6px; padding: 10px; margin-top: 10px; font-size: 0.85rem; } .model-config { background: rgba(30, 41, 59, 0.5); border-radius: 6px; padding: 10px; margin-top: 10px; } .config-item { margin-bottom: 8px; display: flex; align-items: center; } .config-label { width: 120px; font-size: 0.85rem; color: #9ca3af; } .config-value { flex-grow: 1; font-size: 0.85rem; } .toggle-switch { position: relative; display: inline-block; width: 50px; height: 24px; } .toggle-switch input { opacity: 0; width: 0; height: 0; } .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #4b5563; transition: .4s; border-radius: 24px; } .slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; } input:checked + .slider { background-color: #3b82f6; } input:checked + .slider:before { transform: translateX(26px); } .agent-task { background: rgba(30, 41, 59, 0.5); border-radius: 6px; padding: 10px; margin-top: 10px; font-size: 0.85rem; } .task-progress { height: 6px; background-color: #1e293b; border-radius: 3px; margin-top: 5px; overflow: hidden; } .progress-bar { height: 100%; background-color: #3b82f6; border-radius: 3px; transition: width 0.3s ease; } .system-monitor { background: rgba(15, 23, 42, 0.8); border: 1px solid #334155; border-radius: 8px; padding: 15px; margin-bottom: 20px; } .monitor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; } .monitor-card { background: rgba(30, 41, 59, 0.5); border-radius: 6px; padding: 10px; text-align: center; } .monitor-value { font-size: 1.2rem; font-weight: bold; margin: 5px 0; } .monitor-label { font-size: 0.75rem; color: #9ca3af; } .resource-graph { height: 120px; margin-top: 10px; } /* New styles for context awareness */ .context-badge { background-color: #8b5cf6; color: white; font-size: 0.6rem; padding: 2px 4px; border-radius: 4px; margin-left: 5px; } .context-memory { background: rgba(30, 41, 59, 0.7); border-radius: 6px; padding: 10px; margin-top: 10px; font-size: 0.85rem; border-left: 3px solid #8b5cf6; } .context-item { margin-bottom: 5px; display: flex; align-items: center; } .context-key { font-weight: bold; color: #8b5cf6; margin-right: 5px; } .context-value { flex-grow: 1; font-size: 0.85rem; } .follow-up-button { background-color: rgba(139, 92, 246, 0.2); color: #8b5cf6; border: 1px solid #8b5cf6; border-radius: 4px; padding: 2px 6px; font-size: 0.75rem; margin-top: 5px; cursor: pointer; transition: all 0.2s; } .follow-up-button:hover { background-color: rgba(139, 92, 246, 0.4); } .analysis-section { background: rgba(30, 41, 59, 0.5); border-radius: 6px; padding: 10px; margin-top: 10px; font-size: 0.85rem; border-left: 3px solid #f59e0b; } .analysis-title { font-weight: bold; color: #f59e0b; margin-bottom: 5px; } </style> </head> <body class="bg-gray-900 text-gray-100 min-h-screen"> <!-- Processing Queue --> <div class="processing-queue" id="processingQueue"> <div class="queue-header"> <span><i class="fas fa-tasks mr-2"></i>AI Processing Queue</span> <span id="queueCount">0</span> </div> <div id="queueItems"> <!-- Queue items will be added here --> </div> </div> <div class="container mx-auto px-4 py-8"> <h1 class="text-4xl font-bold text-center mb-8 text-yellow-500"> <i class="fas fa-robot mr-2"></i>Advanced Multi-Model AI Agent System <i class="fas fa-brain ml-2"></i> </h1> <div class="text-center mb-8"> <p class="text-lg text-gray-400">Context-aware agent system with LLaMA 3.2:1B, Gemma 3:1B, and Nous-Hermes 2</p> </div> <!-- System Monitor --> <div class="system-monitor mb-8"> <h2 class="text-2xl font-semibold mb-4 text-yellow-500"> <i class="fas fa-chart-line mr-2"></i>System Monitor </h2> <div class="monitor-grid"> <div class="monitor-card"> <div class="monitor-label">Total Models</div> <div class="monitor-value" id="totalModels">3</div> <div class="monitor-label">Active</div> </div> <div class="monitor-card"> <div class="monitor-label">Queue Length</div> <div class="monitor-value" id="queueLength">0</div> <div class="monitor-label">Tasks</div> </div> <div class="monitor-card"> <div class="monitor-label">LLaMA Load</div> <div class="monitor-value" id="llamaLoad">0%</div> <div class="resource-graph"> <canvas id="llamaChart"></canvas> </div> </div> <div class="monitor-card"> <div class="monitor-label">Gemma Load</div> <div class="monitor-value" id="gemmaLoad">0%</div> <div class="resource-graph"> <canvas id="gemmaChart"></canvas> </div> </div> <div class="monitor-card"> <div class="monitor-label">Hermes Load</div> <div class="monitor-value" id="hermesLoad">0%</div> <div class="resource-graph"> <canvas id="hermesChart"></canvas> </div> </div> <div class="monitor-card"> <div class="monitor-label">Memory Usage</div> <div class="monitor-value" id="memoryUsage">0 MB</div> <div class="resource-graph"> <canvas id="memoryChart"></canvas> </div> </div> <div class="monitor-card"> <div class="monitor-label">Context Items</div> <div class="monitor-value" id="contextItems">0</div> <div class="monitor-label">Active</div> </div> </div> </div> <div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8"> <!-- Left Column - Model Configuration --> <div class="lg:col-span-1 space-y-6"> <!-- Model Configuration --> <div class="agent-panel"> <h2 class="text-2xl font-semibold mb-4 text-yellow-500"> <i class="fas fa-cog mr-2"></i>Model Configuration </h2> <div class="model-config"> <div class="config-item"> <div class="config-label">LLaMA 3.2:1B</div> <div class="config-value"> <label class="toggle-switch"> <input type="checkbox" id="llamaToggle" checked> <span class="slider"></span> </label> <span class="ml-2 text-sm" id="llamaStatus">Active</span> </div> </div> <div class="config-item"> <div class="config-label">Gemma 3:1B</div> <div class="config-value"> <label class="toggle-switch"> <input type="checkbox" id="gemmaToggle" checked> <span class="slider"></span> </label> <span class="ml-2 text-sm" id="gemmaStatus">Active</span> </div> </div> <div class="config-item"> <div class="config-label">Hermes 2</div> <div class="config-value"> <label class="toggle-switch"> <input type="checkbox" id="hermesToggle" checked> <span class="slider"></span> </label> <span class="ml-2 text-sm" id="hermesStatus">Active</span> </div> </div> <div class="config-item"> <div class="config-label">Priority Mode</div> <div class="config-value"> <label class="toggle-switch"> <input type="checkbox" id="priorityToggle" checked> <span class="slider"></span> </label> <span class="ml-2 text-sm" id="priorityStatus">Enabled</span> </div> </div> <div class="config-item"> <div class="config-label">Context Mode</div> <div class="config-value"> <label class="toggle-switch"> <input type="checkbox" id="contextToggle" checked> <span class="slider"></span> </label> <span class="ml-2 text-sm" id="contextStatus">Enabled</span> </div> </div> </div> <div class="mt-4"> <button id="saveConfig" class="bg-yellow-700 hover:bg-yellow-800 text-gray-100 font-bold px-4 py-2 rounded-lg transition border border-yellow-800 w-full"> <i class="fas fa-save mr-2"></i>Save Configuration </button> </div> </div> <!-- Agent Controls --> <div class="agent-panel"> <h2 class="text-2xl font-semibold mb-4 text-yellow-500"> <i class="fas fa-sliders-h mr-2"></i>Agent Controls </h2> <div class="agent-controls"> <button id="startAgent" class="bg-green-700 hover:bg-green-800 text-gray-100 font-bold px-4 py-2 rounded-lg transition border border-green-800 flex-1"> <i class="fas fa-play mr-2"></i>Start </button> <button id="pauseAgent" class="bg-yellow-700 hover:bg-yellow-800 text-gray-100 font-bold px-4 py-2 rounded-lg transition border border-yellow-800 flex-1"> <i class="fas fa-pause mr-2"></i>Pause </button> <button id="resetAgent" class="bg-red-700 hover:bg-red-800 text-gray-100 font-bold px-4 py-2 rounded-lg transition border border-red-800 flex-1"> <i class="fas fa-redo mr-2"></i>Reset </button> </div> <div class="agent-status status-active mt-4" id="agentStatusDisplay"> <i class="fas fa-circle mr-2"></i>System Status: <span id="agentStatusText">Running</span> </div> <div class="agent-memory"> <div class="flex justify-between"> <span>Agent Memory:</span> <span id="memoryUsageSmall">0 MB</span> </div> <div class="task-progress"> <div class="progress-bar" id="memoryProgress" style="width: 0%"></div> </div> </div> </div> <!-- Context Memory --> <div class="agent-panel" id="contextPanel"> <h2 class="text-2xl font-semibold mb-4 text-yellow-500"> <i class="fas fa-memory mr-2"></i>Context Memory </h2> <div id="contextMemory" class="context-memory"> <div class="text-center text-gray-400">No context items yet</div> </div> <div class="mt-4"> <button id="clearContext" class="bg-purple-700 hover:bg-purple-800 text-gray-100 font-bold px-4 py-2 rounded-lg transition border border-purple-800 w-full"> <i class="fas fa-trash-alt mr-2"></i>Clear Context </button> </div> </div> </div> <!-- Middle Column - Chat Interface --> <div class="lg:col-span-2"> <div class="agent-panel"> <h2 class="text-2xl font-semibold mb-4 text-yellow-500"> <i class="fas fa-comments mr-2"></i>Multi-Model Conversation </h2> <div class="chat-container bg-gray-700 rounded-lg p-4 mb-4 border border-gray-600"> <div id="chatLog" class="space-y-3"> <div class="message bg-blue-900/70 rounded-lg p-3 ml-0 border border-blue-700"> <div class="font-bold text-blue-300">System <span class="model-badge">Agent</span>:</div> <p>Advanced Multi-Model AI Agent System initialized with context awareness.</p> <p>LLaMA 3.2:1B, Gemma 3:1B, and Nous-Hermes 2 are ready for integrated processing.</p> </div> <div class="message bg-purple-900/70 rounded-lg p-3 ml-0 border border-purple-700"> <div class="font-bold text-purple-300">System <span class="model-badge">Priority</span>:</div> <p>LLaMA 3.2:1B has priority processing enabled. Other models will wait for LLaMA completion before proceeding.</p> </div> <div class="message bg-indigo-900/70 rounded-lg p-3 ml-0 border border-indigo-700"> <div class="font-bold text-indigo-300">System <span class="model-badge">Context</span>:</div> <p>Context awareness is enabled. The system will maintain conversation context for more coherent responses.</p> </div> </div> </div> <div id="typingIndicator" class="hidden flex items-center space-x-1 mb-2 pl-2"> <span class="text-sm text-gray-400">AI typing:</span> <div class="typing-indicator"></div> <div class="typing-indicator"></div> <div class="typing-indicator"></div> <span class="text-sm text-gray-400 ml-2" id="typingModel"></span> </div> <div class="flex space-x-2"> <input type="text" id="userInput" placeholder="Enter your query or task for the AI agents..." class="flex-1 bg-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-yellow-700 border border-gray-600 placeholder-gray-500"> <button id="sendButton" class="bg-yellow-700 hover:bg-yellow-800 text-gray-100 font-bold px-4 py-2 rounded-lg transition border border-yellow-800"> <i class="fas fa-paper-plane mr-1"></i>Send </button> </div> <div class="mt-4 flex flex-wrap gap-2"> <button class="model-prompt bg-blue-900/50 hover:bg-blue-800 text-blue-100 font-bold px-3 py-1 rounded-lg transition border border-blue-700 text-sm" data-model="llama"> <i class="fas fa-brain mr-1"></i>Ask LLaMA 3.2 </button> <button class="model-prompt bg-red-900/50 hover:bg-red-800 text-red-100 font-bold px-3 py-1 rounded-lg transition border border-red-700 text-sm" data-model="gemma"> <i class="fas fa-gem mr-1"></i>Ask Gemma 3 </button> <button class="model-prompt bg-green-900/50 hover:bg-green-800 text-green-100 font-bold px-3 py-1 rounded-lg transition border border-green-700 text-sm" data-model="hermes"> <i class="fas fa-feather-alt mr-1"></i>Ask Hermes 2 </button> <button class="model-prompt bg-purple-900/50 hover:bg-purple-800 text-purple-100 font-bold px-3 py-1 rounded-lg transition border border-purple-700 text-sm" data-model="all"> <i class="fas fa-robot mr-1"></i>Ask All Models </button> <button class="model-prompt bg-yellow-900/50 hover:bg-yellow-800 text-yellow-100 font-bold px-3 py-1 rounded-lg transition border border-yellow-700 text-sm" data-model="task"> <i class="fas fa-tasks mr-1"></i>Create Task </button> <button class="model-prompt bg-indigo-900/50 hover:bg-indigo-800 text-indigo-100 font-bold px-3 py-1 rounded-lg transition border border-indigo-700 text-sm" data-model="clarify"> <i class="fas fa-question-circle mr-1"></i>Request Clarification </button> </div> </div> <!-- Task Management --> <div class="agent-panel mt-6"> <h2 class="text-2xl font-semibold mb-4 text-yellow-500"> <i class="fas fa-tasks mr-2"></i>Task Management </h2> <div id="activeTasks" class="space-y-3"> <div class="agent-task"> <div class="flex justify-between"> <span class="font-medium">System Initialization</span> <span class="text-sm text-green-400">Completed</span> </div> <div class="text-sm text-gray-400 mt-1">Initialized all AI models and agent systems</div> <div class="task-progress"> <div class="progress-bar" style="width: 100%"></div> </div> </div> </div> <div class="mt-4"> <button id="clearTasks" class="bg-red-700 hover:bg-red-800 text-gray-100 font-bold px-4 py-2 rounded-lg transition border border-red-800 w-full"> <i class="fas fa-trash-alt mr-2"></i>Clear Completed Tasks </button> </div> </div> </div> </div> </div> <script> document.addEventListener('DOMContentLoaded', function() { // DOM Elements const chatLog = document.getElementById('chatLog'); const userInput = document.getElementById('userInput'); const sendButton = document.getElementById('sendButton'); const typingIndicator = document.getElementById('typingIndicator'); const typingModel = document.getElementById('typingModel'); const processingQueue = document.getElementById('processingQueue'); const queueItems = document.getElementById('queueItems'); const queueCount = document.getElementById('queueCount'); const modelPrompts = document.querySelectorAll('.model-prompt'); const activeTasks = document.getElementById('activeTasks'); const contextMemory = document.getElementById('contextMemory'); const clearContext = document.getElementById('clearContext'); const contextItems = document.getElementById('contextItems'); // Configuration elements const llamaToggle = document.getElementById('llamaToggle'); const gemmaToggle = document.getElementById('gemmaToggle'); const hermesToggle = document.getElementById('hermesToggle'); const priorityToggle = document.getElementById('priorityToggle'); const contextToggle = document.getElementById('contextToggle'); const llamaStatus = document.getElementById('llamaStatus'); const gemmaStatus = document.getElementById('gemmaStatus'); const hermesStatus = document.getElementById('hermesStatus'); const priorityStatus = document.getElementById('priorityStatus'); const contextStatus = document.getElementById('contextStatus'); const saveConfig = document.getElementById('saveConfig'); // Agent control elements const startAgent = document.getElementById('startAgent'); const pauseAgent = document.getElementById('pauseAgent'); const resetAgent = document.getElementById('resetAgent'); const agentStatusDisplay = document.getElementById('agentStatusDisplay'); const agentStatusText = document.getElementById('agentStatusText'); const clearTasks = document.getElementById('clearTasks'); // Monitor elements const totalModels = document.getElementById('totalModels'); const queueLength = document.getElementById('queueLength'); const llamaLoad = document.getElementById('llamaLoad'); const gemmaLoad = document.getElementById('gemmaLoad'); const hermesLoad = document.getElementById('hermesLoad'); const memoryUsage = document.getElementById('memoryUsage'); const memoryUsageSmall = document.getElementById('memoryUsageSmall'); const memoryProgress = document.getElementById('memoryProgress'); // System state let isAgentRunning = true; let processingQueueItems = []; let currentProcessingItem = null; let isProcessing = false; let activeTaskCount = 1; let memoryUsageValue = 0; let conversationContext = []; let isContextEnabled = true; // Initialize charts const llamaChart = initChart('llamaChart', '#3b82f6'); const gemmaChart = initChart('gemmaChart', '#ef4444'); const hermesChart = initChart('hermesChart', '#10b981'); const memoryChart = initChart('memoryChart', '#f59e0b'); // Available models const models = { llama: { name: "LLaMA 3.2:1B", color: "blue", icon: "brain", description: "Most advanced model with priority processing", endpoint: "http://localhost:11434/api/generate", isActive: true, isPriority: true, load: 0, personality: "analytical and thorough", capabilities: ["deep analysis", "complex reasoning", "contextual understanding"] }, gemma: { name: "Gemma 3:1B", color: "red", icon: "gem", description: "Fast inference for less critical tasks", endpoint: "http://localhost:11434/api/generate", isActive: true, isPriority: false, load: 0, personality: "concise and factual", capabilities: ["quick responses", "fact retrieval", "summarization"] }, hermes: { name: "Nous-Hermes 2", color: "green", icon: "feather-alt", description: "Creative and nuanced responses", endpoint: "http://localhost:11434/api/generate", isActive: true, isPriority: false, load: 0, personality: "creative and expressive", capabilities: ["creative writing", "alternative perspectives", "nuanced interpretation"] } }; // Initialize the system initSystem(); // Event listeners sendButton.addEventListener('click', handleSendMessage); userInput.addEventListener('keypress', function(e) { if (e.key === 'Enter') handleSendMessage(); }); modelPrompts.forEach(button => { button.addEventListener('click', function() { const model = this.getAttribute('data-model'); if (model === 'all') { handleSendMessage(true); } else if (model === 'task') { createTask(userInput.value || "New task from user"); } else if (model === 'clarify') { requestClarification(); } else { userInput.value = `[${model}] ${userInput.value}`; handleSendMessage(); } }); }); // Configuration event listeners llamaToggle.addEventListener('change', function() { models.llama.isActive = this.checked; llamaStatus.textContent = this.checked ? 'Active' : 'Inactive'; llamaStatus.className = `ml-2 text-sm ${this.checked ? 'text-green-400' : 'text-red-400'}`; updateSystemMonitor(); }); gemmaToggle.addEventListener('change', function() { models.gemma.isActive = this.checked; gemmaStatus.textContent = this.checked ? 'Active' : 'Inactive'; gemmaStatus.className = `ml-2 text-sm ${this.checked ? 'text-green-400' : 'text-red-400'}`; updateSystemMonitor(); }); hermesToggle.addEventListener('change', function() { models.hermes.isActive = this.checked; hermesStatus.textContent = this.checked ? 'Active' : 'Inactive'; hermesStatus.className = `ml-2 text-sm ${this.checked ? 'text-green-400' : 'text-red-400'}`; updateSystemMonitor(); }); priorityToggle.addEventListener('change', function() { models.llama.isPriority = this.checked; priorityStatus.textContent = this.checked ? 'Enabled' : 'Disabled'; priorityStatus.className = `ml-2 text-sm ${this.checked ? 'text-green-400' : 'text-red-400'}`; // Add system message addSystemMessage( `Priority processing ${this.checked ? 'enabled' : 'disabled'} for LLaMA 3.2:1B`, this.checked ? 'blue' : 'gray' ); updateSystemMonitor(); }); contextToggle.addEventListener('change', function() { isContextEnabled = this.checked; contextStatus.textContent = this.checked ? 'Enabled' : 'Disabled'; contextStatus.className = `ml-2 text-sm ${this.checked ? 'text-green-400' : 'text-red-400'}`; // Add system message addSystemMessage( `Context awareness ${this.checked ? 'enabled' : 'disabled'}`, this.checked ? 'indigo' : 'gray' ); updateSystemMonitor(); }); saveConfig.addEventListener('click', function() { addSystemMessage("Configuration saved successfully", "green"); }); // Agent control event listeners startAgent.addEventListener('click', function() { isAgentRunning = true; agentStatusText.textContent = "Running"; agentStatusDisplay.className = "agent-status status-active mt-4"; addSystemMessage("Agent system started", "green"); }); pauseAgent.addEventListener('click', function() { isAgentRunning = false; agentStatusText.textContent = "Paused"; agentStatusDisplay.className = "agent-status status-inactive mt-4"; addSystemMessage("Agent system paused", "yellow"); }); resetAgent.addEventListener('click', function() { if (confirm("Are you sure you want to reset the agent system? This will clear all pending tasks and context.")) { processingQueueItems = []; conversationContext = []; updateQueueDisplay(); updateContextDisplay(); isAgentRunning = true; agentStatusText.textContent = "Running"; agentStatusDisplay.className = "agent-status status-active mt-4"; addSystemMessage("Agent system reset", "blue"); } }); clearTasks.addEventListener('click', function() { const completedTasks = activeTasks.querySelectorAll('.agent-task'); completedTasks.forEach(task => { if (task.querySelector('.text-green-400')) { task.remove(); } }); }); clearContext.addEventListener('click', function() { if (confirm("Are you sure you want to clear all context memory?")) { conversationContext = []; updateContextDisplay(); addSystemMessage("Context memory cleared", "indigo"); } }); // Initialize the system function initSystem() { // Start monitoring system resources setInterval(updateSystemResources, 2000); // Add initial tasks createTask("Initialize LLaMA 3.2:1B model"); createTask("Initialize Gemma 3:1B model"); createTask("Initialize Hermes 2 model"); createTask("Start agent system"); createTask("Load context awareness module"); // Simulate task completion setTimeout(() => { const tasks = activeTasks.querySelectorAll('.agent-task'); tasks.forEach(task => { const progress = task.querySelector('.progress-bar'); if (progress) progress.style.width = "100%"; const status = task.querySelector('.text-sm'); if (status) { status.textContent = "Completed"; status.className = "text-sm text-green-400"; } }); }, 3000); } // Handle sending messages function handleSendMessage(sendToAll = false) { const message = userInput.value.trim(); if (!message) return; // Add user message to chat addMessage("user", message); // Add to context if enabled if (isContextEnabled) { addToContext("user", message); } // Clear input userInput.value = ''; if (sendToAll) { // Send to all active models Object.keys(models).forEach(model => { if (models[model].isActive) { const taskName = `Process "${message.substring(0, 20)}..." with ${models[model].name}`; const taskId = addToQueue(taskName, model, models[model].isPriority); createTask(taskName, taskId); } }); } else { // Determine which model to use let selectedModel = 'llama'; // default // Check for model specifier in message if (message.match(/\[llama\]|\[LLaMA\]/i)) { selectedModel = 'llama'; } else if (message.match(/\[gemma\]|\[Gemma\]/i)) { selectedModel = 'gemma'; } else if (message.match(/\[hermes\]|\[Hermes\]/i)) { selectedModel = 'hermes'; } // Clean the message by removing model specifier const cleanMessage = message.replace(/^\[[^\]]+\]\s*/i, ''); if (models[selectedModel].isActive) { const taskName = `Process "${cleanMessage.substring(0, 20)}..." with ${models[selectedModel].name}`; const taskId = addToQueue(taskName, selectedModel, models[selectedModel].isPriority); createTask(taskName, taskId); } else { addSystemMessage(`${models[selectedModel].name} is currently inactive`, "red"); } } } // Request clarification from user function requestClarification() { const message = userInput.value.trim(); if (!message) return; // Add user message to chat addMessage("user", message); // Add to context if enabled if (isContextEnabled) { addToContext("user", message); } // Clear input userInput.value = ''; // Create clarification request task const taskName = `Request clarification for: "${message.substring(0, 20)}..."`; const taskId = addToQueue(taskName, 'llama', true); createTask(taskName, taskId); } // Add message to chat function addMessage(sender, message, model = null) { const messageDiv = document.createElement('div'); if (sender === 'user') { messageDiv.className = 'message bg-gray-800 rounded-lg p-3 mr-0 ml-auto border border-gray-600'; messageDiv.innerHTML = ` <div class="font-bold text-gray-300">You:</div> <p>${message}</p> `; } else if (sender === 'ai') { const modelData = models[model] || { name: 'AI', color: 'gray' }; messageDiv.className = `message bg-${modelData.color}-900/70 rounded-lg p-3 ml-0 border border-${modelData.color}-700`; // Check if message contains analysis sections if (message.includes('Analysis:')) { const parts = message.split('Analysis:'); messageDiv.innerHTML = ` <div class="font-bold text-${modelData.color}-300">${modelData.name} <span class="model-badge">${modelData.name.split(' ')[0]}</span>:</div> <p>${parts[0]}</p> <div class="analysis-section"> <div class="analysis-title">Analysis:</div> <div>${parts[1]}</div> </div> `; } else { messageDiv.innerHTML = ` <div class="font-bold text-${modelData.color}-300">${modelData.name} <span class="model-badge">${modelData.name.split(' ')[0]}</span>:</div> <p>${message}</p> `; } // Add follow-up buttons if context is enabled if (isContextEnabled) { const followUpDiv = document.createElement('div'); followUpDiv.className = 'mt-2 flex gap-2'; const expandButton = document.createElement('button'); expandButton.className = 'follow-up-button'; expandButton.innerHTML = '<i class="fas fa-expand mr-1"></i>Expand'; expandButton.addEventListener('click', () => { const expandedTaskName = `Expand on: "${message.substring(0, 20)}..."`; const expandedTaskId = addToQueue(expandedTaskName, model, models[model].isPriority); createTask(expandedTaskName, expandedTaskId); }); const exampleButton = document.createElement('button'); exampleButton.className = 'follow-up-button'; exampleButton.innerHTML = '<i class="fas fa-lightbulb mr-1"></i>Examples'; exampleButton.addEventListener('click', () => { const exampleTaskName = `Provide examples for: "${message.substring(0, 20)}..."`; const exampleTaskId = addToQueue(exampleTaskName, model, models[model].isPriority); createTask(exampleTaskName, exampleTaskId); }); followUpDiv.appendChild(expandButton); followUpDiv.appendChild(exampleButton); messageDiv.appendChild(followUpDiv); } } chatLog.appendChild(messageDiv); chatLog.scrollTop = chatLog.scrollHeight; } // Add system message function addSystemMessage(message, color = 'blue') { const messageDiv = document.createElement('div'); messageDiv.className = `message bg-${color}-900/70 rounded-lg p-3 ml-0 border border-${color}-700`; messageDiv.innerHTML = ` <div class="font-bold text-${color}-300">System <span class="model-badge">${color === 'blue' ? 'Priority' : (color === 'green' ? 'Success' : (color === 'indigo' ? 'Context' : 'Alert'))}</span>:</div> <p>${message}</p> `; chatLog.appendChild(messageDiv); chatLog.scrollTop = chatLog.scrollHeight; } // Add to conversation context function addToContext(sender, message) { conversationContext.push({ sender: sender, message: message, timestamp: new Date() }); // Keep only the last 10 messages to prevent memory overload if (conversationContext.length > 10) { conversationContext.shift(); } updateContextDisplay(); } // Update context display function updateContextDisplay() { contextMemory.innerHTML = ''; if (conversationContext.length === 0) { contextMemory.innerHTML = '<div class="text-center text-gray-400">No context items yet</div>'; contextItems.textContent = '0'; return; } contextItems.textContent = conversationContext.length; conversationContext.forEach((item, index) => { const contextItem = document.createElement('div'); contextItem.className = 'context-item'; const senderClass = item.sender === 'user' ? 'text-gray-300' : `text-${models[item.model]?.color || 'gray'}-300`; const senderName = item.sender === 'user' ? 'You' : (models[item.model]?.name || 'AI'); contextItem.innerHTML = ` <div class="context-key">${senderName}:</div> <div class="context-value">${item.message.substring(0, 50)}${item.message.length > 50 ? '...' : ''}</div> `; contextMemory.appendChild(contextItem); }); } // Add item to processing queue function addToQueue(itemName, model, isPriority = false) { if (!isAgentRunning) { addSystemMessage("Agent system is paused. Start the agent to process tasks.", "red"); return null; } const queueItem = { id: Date.now(), name: itemName, model: model, status: 'pending', timestamp: new Date(), isPriority: isPriority || models[model].isPriority, context: isContextEnabled ? [...conversationContext] : [] }; // Add to beginning if priority, else to end if (queueItem.isPriority) { processingQueueItems.unshift(queueItem); } else { processingQueueItems.push(queueItem); } updateQueueDisplay(); processQueue(); return queueItem.id; } // Update queue display function updateQueueDisplay() { queueItems.innerHTML = ''; queueCount.textContent = processingQueueItems.length; queueLength.textContent = processingQueueItems.length; // Sort items: processing first, then priority, then by timestamp const sortedItems = [...processingQueueItems].sort((a, b) => { if (a.status === 'processing') return -1; if (b.status === 'processing') return 1; if (a.isPriority && !b.isPriority) return -1; if (!a.isPriority && b.isPriority) return 1; return a.timestamp - b.timestamp; }); sortedItems.forEach(item => { const itemDiv = document.createElement('div'); itemDiv.className = 'queue-item'; let statusClass = ''; switch(item.status) { case 'pending': statusClass = 'status-pending'; break; case 'processing': statusClass = 'status-processing'; break; case 'completed': statusClass = 'status-completed'; break; case 'failed': statusClass = 'status-failed'; break; } const modelColor = models[item.model] ? models[item.model].color : 'gray'; itemDiv.innerHTML = ` <div class="queue-status ${statusClass}"></div> <div class="queue-item-name"> ${item.name} ${item.isPriority ? '<span class="priority-badge">PRIORITY</span>' : ''} <span class="text-xs text-${modelColor}-400">${models[item.model]?.name || item.model}</span> </div> <div class="queue-item-time">${formatTime(item.timestamp)}</div> `; queueItems.appendChild(itemDiv); }); } // Process queue items async function processQueue() { if (isProcessing || processingQueueItems.length === 0) return; isProcessing = true; // Find next item to process (prioritize pending priority items) let nextItem = processingQueueItems.find(item => item.status === 'pending' && item.isPriority ) || processingQueueItems.find(item => item.status === 'pending' ); if (!nextItem) { isProcessing = false; return; } // Mark as processing updateQueueItemStatus(nextItem.id, 'processing'); currentProcessingItem = nextItem; // Show typing indicator typingModel.textContent = models[nextItem.model].name; typingIndicator.classList.remove('hidden'); try { // Update model load models[nextItem.model].load = 70 + Math.random() * 20; updateSystemMonitor(); // Simulate processing delay based on model let processingTime = 1500 + Math.random() * 1000; // Default if (nextItem.model === 'llama') processingTime = 2500 + Math.random() * 1500; else if (nextItem.model === 'gemma') processingTime = 800 + Math.random() * 500; await new Promise(resolve => setTimeout(resolve, processingTime)); // Mark as completed updateQueueItemStatus(nextItem.id, 'completed'); // Generate response with context awareness const response = generateResponse(nextItem.name, nextItem.model, nextItem.context); displayResponse(response, nextItem.model); // Add to context if enabled if (isContextEnabled) { addToContext('ai', response, nextItem.model); } // Update task status updateTaskStatus(nextItem.id); } catch (error) { // Mark as failed updateQueueItemStatus(nextItem.id, 'failed'); console.error('Processing error:', error); // Show error message addSystemMessage(`Failed to process ${models[nextItem.model]?.name || nextItem.model} request: ${error.message}`, "red"); } finally { // Hide typing indicator typingIndicator.classList.add('hidden'); // Update model load models[nextItem.model].load = 0; updateSystemMonitor(); currentProcessingItem = null; isProcessing = false; // Process next item if available setTimeout(processQueue, 500); } } // Update queue item status function updateQueueItemStatus(id, status) { const item = processingQueueItems.find(i => i.id === id); if (item) { item.status = status; updateQueueDisplay(); } } // Generate mock response based on model and context function generateResponse(prompt, model, context = []) { const modelData = models[model]; const contextSummary = context.length > 0 ? `Context summary:\n${context.map(c => `${c.sender}: ${c.message}`).join('\n')}\n\n` : ''; const modelResponses = { llama: `LLaMA 3.2:1B Response: ${contextSummary}Based on your input "${prompt}", I've conducted a comprehensive analysis. Key insights: 1. This appears to be a complex query requiring deep understanding 2. The context suggests multiple interpretation paths 3. My architecture enables nuanced understanding Analysis: - Context relevance: ${context.length ? 'High' : 'None'} - Complexity level: Advanced - Suggested approach: Multi-stage analysis Recommendation: For best results, consider breaking this down into smaller tasks that can be distributed across our model ensemble.`, gemma: `Gemma 3:1B Response: ${contextSummary}Your query "${prompt}" can be addressed efficiently with these points: • Processing time: 1.2s • Context items: ${context.length} • Key takeaways: 1. [Main point 1] 2. [Supporting fact] 3. [Actionable item] Note: For deeper analysis, consider using LLaMA 3.2`, hermes: `Hermes 2 Creative Response: ${contextSummary}Your prompt "${prompt}" inspires this interpretation: [Creative narrative or poetic response] Alternative perspectives: 1. [Creative angle 1] 2. [Creative angle 2] 3. [Creative angle 3] Let me know if you'd like me to elaborate on any of these approaches.` }; // Special case for clarification requests if (prompt.includes("Request clarification")) { return `Clarification Request: I noticed you asked about "${prompt.replace(/Request clarification for: /, '')}". To provide the best response, could you please: 1. Specify which aspects are most important to you? 2. Provide any additional context or examples? 3. Indicate your preferred response format (bullet points, narrative, etc.)? This will help me tailor my response to your exact needs.`; } return modelResponses[model] || `Response from ${model}: Processed "${prompt}"`; } // Display response in chat function displayResponse(response, model) { addMessage('ai', response, model); } // Create a new task function createTask(name, queueId = null) { activeTaskCount++; const taskId = queueId || Date.now(); const taskDiv = document.createElement('div'); taskDiv.className = 'agent-task'; taskDiv.setAttribute('data-task-id', taskId); taskDiv.innerHTML = ` <div class="flex justify-between"> <span class="font-medium">${name}</span> <span class="text-sm text-yellow-400">Pending</span> </div> <div class="text-sm text-gray-400 mt-1">Added ${formatTime(new Date())}</div> <div class="task-progress"> <div class="progress-bar" style="width: 5%"></div> </div> `; activeTasks.prepend(taskDiv); // Simulate progress updates if (!queueId) { let progress = 5; const interval = setInterval(() => { progress += Math.random() * 15; const progressBar = taskDiv.querySelector('.progress-bar'); if (progressBar) progressBar.style.width = `${Math.min(progress, 100)}%`; if (progress >= 100) { clearInterval(interval); const status = taskDiv.querySelector('.text-sm'); if (status) { status.textContent = "Completed"; status.className = "text-sm text-green-400"; } } }, 500); } return taskId; } // Update task status function updateTaskStatus(queueId) { const task = activeTasks.querySelector(`[data-task-id="${queueId}"]`); if (task) { const status = task.querySelector('.text-sm'); if (status) { status.textContent = "Completed"; status.className = "text-sm text-green-400"; } const progressBar = task.querySelector('.progress-bar'); if (progressBar) progressBar.style.width = "100%"; } } // Format time for display function formatTime(date) { return date.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'}); } // Initialize chart function initChart(canvasId, color) { const ctx = document.getElementById(canvasId).getContext('2d'); return new Chart(ctx, { type: 'line', data: { labels: Array(10).fill(''), datasets: [{ data: Array(10).fill(0), borderColor: color, borderWidth: 2, pointRadius: 0, tension: 0.4, fill: true, backgroundColor: `${color}20` }] }, options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { display: false } }, scales: { x: { display: false }, y: { display: false, min: 0, max: 100 } } } }); } // Update chart data function updateChart(chart, value) { if (chart.data.datasets[0].data.length >= 10) { chart.data.datasets[0].data.shift(); } chart.data.datasets[0].data.push(value); chart.update(); } // Update system resources function updateSystemResources() { // Update memory usage memoryUsageValue = 300 + Math.random() * 200; memoryUsage.textContent = `${Math.round(memoryUsageValue)} MB`; memoryUsageSmall.textContent = `${Math.round(memoryUsageValue)} MB`; memoryProgress.style.width = `${Math.min(100, memoryUsageValue / 8)}%`; // Update charts updateChart(llamaChart, models.llama.load); updateChart(gemmaChart, models.gemma.load); updateChart(hermesChart, models.hermes.load); updateChart(memoryChart, memoryUsageValue / 8); // Update load indicators llamaLoad.textContent = `${Math.round(models.llama.load)}%`; gemmaLoad.textContent = `${Math.round(models.gemma.load)}%`; hermesLoad.textContent = `${Math.round(models.hermes.load)}%`; } // Update system monitor function updateSystemMonitor() { const activeModels = Object.values(models).filter(m => m.isActive).length; totalModels.textContent = activeModels; } }); </script> <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=MarcRyan/mastermind-comms" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> </html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Advanced Multi-Model AI Agent System</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* Previous styles remain the same */
@keyframes float {
0% { transform: translateY(0px); }
50% { transform: translateY(-10px); }
100% { transform: translateY(0px); }
}
.model-icon {
animation: float 4s ease-in-out infinite;
transition: all 0.3s ease;
border: 2px solid;
cursor: pointer;
}
.model-icon:hover {
transform: scale(1.05) !important;
animation-play-state: paused;
}
.llama {
animation-delay: 0s;
border-color: #3b82f6;
}
.gemma {
animation-delay: 0.5s;
border-color: #ef4444;
}
.hermes {
animation-delay: 1s;
border-color: #10b981;
}
.chat-container {
height: 600px;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: #4b5563 #1f2937;
}
.chat-container::-webkit-scrollbar {
width: 8px;
}
.chat-container::-webkit-scrollbar-track {
background: #1f2937;
}
.chat-container::-webkit-scrollbar-thumb {
background-color: #4b5563;
border-radius: 4px;
}
.message {
max-width: 80%;
word-wrap: break-word;
}
.typing-indicator {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 50%;
background-color: #6b7280;
margin-right: 4px;
animation: bounce 1.5s infinite ease-in-out;
}
.typing-indicator:nth-child(2) {
animation-delay: 0.2s;
}
.typing-indicator:nth-child(3) {
animation-delay: 0.4s;
}
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-5px); }
}
.model-badge {
background: linear-gradient(135deg, #6b46c1 0%, #3b82f6 100%);
color: white;
padding: 2px 6px;
border-radius: 4px;
font-size: 0.7rem;
font-weight: bold;