|
|
|
|
|
|
|
|
function setupModal(modalId, openBtnId, closeBtnId) { |
|
|
const modal = document.getElementById(modalId); |
|
|
const openBtn = document.getElementById(openBtnId); |
|
|
const closeBtn = document.getElementById(closeBtnId); |
|
|
|
|
|
if (openBtn) { |
|
|
openBtn.addEventListener('click', () => { |
|
|
modal.classList.remove('hidden'); |
|
|
}); |
|
|
} |
|
|
|
|
|
if (closeBtn) { |
|
|
closeBtn.addEventListener('click', () => { |
|
|
modal.classList.add('hidden'); |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
window.addEventListener('click', (event) => { |
|
|
if (event.target === modal) { |
|
|
modal.classList.add('hidden'); |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', () => { |
|
|
|
|
|
setupModal('upload-modal', 'upload-btn', 'close-modal'); |
|
|
setupModal('training-modal', 'train-btn', 'close-training-modal'); |
|
|
|
|
|
|
|
|
document.addEventListener('upload-clicked', () => { |
|
|
document.getElementById('upload-modal').classList.remove('hidden'); |
|
|
}); |
|
|
|
|
|
document.addEventListener('train-clicked', () => { |
|
|
document.getElementById('training-modal').classList.remove('hidden'); |
|
|
}); |
|
|
|
|
|
|
|
|
const fileUpload = document.querySelector('.file-upload'); |
|
|
const fileInput = document.getElementById('file-input'); |
|
|
|
|
|
if (fileUpload && fileInput) { |
|
|
fileUpload.addEventListener('click', function() { |
|
|
fileInput.click(); |
|
|
}); |
|
|
|
|
|
fileUpload.addEventListener('dragover', function(e) { |
|
|
e.preventDefault(); |
|
|
this.classList.add('border-purple-500', 'bg-purple-900'); |
|
|
}); |
|
|
|
|
|
fileUpload.addEventListener('dragleave', function(e) { |
|
|
e.preventDefault(); |
|
|
this.classList.remove('border-purple-500', 'bg-purple-900'); |
|
|
}); |
|
|
|
|
|
fileUpload.addEventListener('drop', function(e) { |
|
|
e.preventDefault(); |
|
|
this.classList.remove('border-purple-500', 'bg-purple-900'); |
|
|
|
|
|
console.log('Files dropped:', e.dataTransfer.files); |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
const API_BASE = 'https://basic.mo-overlord.tech/realtime'; |
|
|
const QUANTUM_TIER = 'basic'; |
|
|
const TEMPORAL_MODE = 'realtime'; |
|
|
|
|
|
|
|
|
async function getAIAssistant() { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/ai-assistant`, { |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE', |
|
|
'Content-Type': 'application/json' |
|
|
} |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('AI Assistant:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error fetching AI assistant:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function getEnhancementRoadmap() { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/enhancement-roadmap`); |
|
|
const data = await response.json(); |
|
|
console.log('Enhancement Roadmap:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error fetching enhancement roadmap:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function submitRoadmapFeedback(feedback) { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/roadmap-feedback`, { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Content-Type': 'application/json' |
|
|
}, |
|
|
body: JSON.stringify(feedback) |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Feedback submitted:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error submitting feedback:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function generateImage(prompt, n = 1, size = '512x512') { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/images/generations`, { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE', |
|
|
'Content-Type': 'application/json' |
|
|
}, |
|
|
body: JSON.stringify({ prompt, n, size }) |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Generated images:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error generating image:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function createEmbedding(model, input) { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/embeddings`, { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE', |
|
|
'Content-Type': 'application/json' |
|
|
}, |
|
|
body: JSON.stringify({ model, input }) |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Embedding created:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error creating embedding:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function createTranscription(file, model, prompt = '', responseFormat = 'json') { |
|
|
try { |
|
|
const formData = new FormData(); |
|
|
formData.append('file', file); |
|
|
formData.append('model', model); |
|
|
formData.append('prompt', prompt); |
|
|
formData.append('response_format', responseFormat); |
|
|
|
|
|
const response = await fetch(`${API_BASE}/audio/transcriptions`, { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE' |
|
|
}, |
|
|
body: formData |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Transcription created:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error creating transcription:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function createModeration(input, model = 'text-moderation-stable') { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/moderations`, { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE', |
|
|
'Content-Type': 'application/json' |
|
|
}, |
|
|
body: JSON.stringify({ input, model }) |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Moderation result:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error creating moderation:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function uploadFile(file, purpose) { |
|
|
try { |
|
|
const formData = new FormData(); |
|
|
formData.append('file', file); |
|
|
formData.append('purpose', purpose); |
|
|
|
|
|
const response = await fetch(`${API_BASE}/files`, { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE' |
|
|
}, |
|
|
body: formData |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('File uploaded:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error uploading file:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function getFileDetails(fileId) { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/files/${fileId}`, { |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE' |
|
|
} |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('File details:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error getting file details:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function createFineTune(trainingFile, model, nEpochs = 4) { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/fine-tunes`, { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE', |
|
|
'Content-Type': 'application/json' |
|
|
}, |
|
|
body: JSON.stringify({ training_file: trainingFile, model, n_epochs: nEpochs }) |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Fine tune created:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error creating fine tune:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function getUsage() { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/usage`, { |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE' |
|
|
} |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Usage data:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error getting usage data:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function getBillingUsage() { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/billing/usage`, { |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE' |
|
|
} |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Billing usage:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error getting billing usage:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function listSubscriptions() { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/subscriptions`, { |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE' |
|
|
} |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Subscriptions:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error listing subscriptions:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function enhanceSecurityMeasures(securityLevel, description) { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/security/enhanced`, { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE', |
|
|
'Content-Type': 'application/json' |
|
|
}, |
|
|
body: JSON.stringify({ securityLevel, description }) |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Security enhanced:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error enhancing security:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function integrateDHL(dhlUrl, dhlToken) { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/integration/supply-chain/dhl`, { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE', |
|
|
'Content-Type': 'application/json' |
|
|
}, |
|
|
body: JSON.stringify({ dhl_url: dhlUrl, dhl_token: dhlToken }) |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('DHL integrated:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error integrating DHL:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function integrateFigma(figmaUrl, figmaToken) { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/integration/design/figma`, { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE', |
|
|
'Content-Type': 'application/json' |
|
|
}, |
|
|
body: JSON.stringify({ figma_url: figmaUrl, figma_token: figmaToken }) |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Figma integrated:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error integrating Figma:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function registerFederatedNode(nodeId, modelType) { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/federated-node/register`, { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Content-Type': 'application/json' |
|
|
}, |
|
|
body: JSON.stringify({ node_id: nodeId, model_type: modelType }) |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Node registered:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error registering node:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function submitFederatedTraining(weights) { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/federated-training/submit`, { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Content-Type': 'application/json' |
|
|
}, |
|
|
body: JSON.stringify({ weights }) |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Training submitted:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error submitting training:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function getGlobalModel() { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/federated-training/global-model`); |
|
|
const data = await response.json(); |
|
|
console.log('Global model:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error getting global model:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function validateHypothesis(facts, rules, hypothesis) { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/reasoning/validate-hypothesis`, { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Content-Type': 'application/json' |
|
|
}, |
|
|
body: JSON.stringify({ facts, rules, hypothesis }) |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Hypothesis validation:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error validating hypothesis:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function getMostarManifest() { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/mostar/manifest`); |
|
|
const data = await response.json(); |
|
|
console.log('MoStar manifest:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error getting MoStar manifest:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function getMostarCore() { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/mostar/core`, { |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE' |
|
|
} |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('MoStar core:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error getting MoStar core:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async function activateQuantumPersona(persona, particleDensity, statusColors) { |
|
|
try { |
|
|
const response = await fetch(`${API_BASE}/quantum/activate`, { |
|
|
method: 'POST', |
|
|
headers: { |
|
|
'Authorization': 'Bearer YOUR_BEARER_TOKEN_HERE', |
|
|
'Content-Type': 'application/json' |
|
|
}, |
|
|
body: JSON.stringify({ persona, particle_density: particleDensity, status_colors: statusColors }) |
|
|
}); |
|
|
const data = await response.json(); |
|
|
console.log('Quantum persona activated:', data); |
|
|
return data; |
|
|
} catch (error) { |
|
|
console.error('Error activating quantum persona:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function updateFeed() { |
|
|
try { |
|
|
|
|
|
const tickerEl = document.getElementById('mostar-feed'); |
|
|
if (tickerEl) { |
|
|
tickerEl.textContent = "🔸 [Mostar Feed] Grid sync stable – Neural nodes: 427 active – Last signal: 2.3s ago – Coherence: 99.98% – Flow: Optimal"; |
|
|
} |
|
|
} catch (error) { |
|
|
console.error('Failed to fetch grid feed:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
setInterval(updateFeed, 2000); |
|
|
updateFeed(); |
|
|
|
|
|
async function updateStats() { |
|
|
try { |
|
|
|
|
|
const cards = document.querySelectorAll('.grid-card'); |
|
|
if (cards.length > 0) { |
|
|
cards[0].querySelector('h3').textContent = '427'; |
|
|
} |
|
|
if (cards.length > 1) { |
|
|
cards[1].querySelector('h3').textContent = '5'; |
|
|
} |
|
|
if (cards.length > 2) { |
|
|
cards[2].querySelector('h3').textContent = '99.98%'; |
|
|
} |
|
|
if (cards.length > 3) { |
|
|
cards[3].querySelector('h3').textContent = '2.3s ago'; |
|
|
} |
|
|
if (cards.length > 4) { |
|
|
cards[4].querySelector('h3').textContent = '12'; |
|
|
} |
|
|
if (cards.length > 5) { |
|
|
cards[5].querySelector('h3').textContent = 'Verified'; |
|
|
} |
|
|
if (cards.length > 6) { |
|
|
cards[6].querySelector('h3').textContent = '1.2TB'; |
|
|
} |
|
|
if (cards.length > 7) { |
|
|
cards[7].querySelector('h3').textContent = 'Optimal'; |
|
|
} |
|
|
} catch (error) { |
|
|
console.error('Failed to fetch grid status:', error); |
|
|
} |
|
|
} |
|
|
setInterval(updateStats, 5000); |
|
|
updateStats(); |
|
|
}); |
|
|
|