Buckets:
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>COSMOS Cloud Configuration Dashboard</title> | |
| <style> | |
| * { margin: 0; padding: 0; box-sizing: border-box; } | |
| body { | |
| font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| min-height: 100vh; | |
| padding: 20px; | |
| } | |
| .container { | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| background: white; | |
| border-radius: 10px; | |
| box-shadow: 0 10px 40px rgba(0,0,0,0.2); | |
| overflow: hidden; | |
| } | |
| .header { | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| color: white; | |
| padding: 30px; | |
| text-align: center; | |
| } | |
| .header h1 { font-size: 2.5em; margin-bottom: 10px; } | |
| .header p { opacity: 0.9; font-size: 1.1em; } | |
| .content { | |
| padding: 30px; | |
| } | |
| .section { | |
| margin-bottom: 30px; | |
| padding: 20px; | |
| background: #f8f9fa; | |
| border-radius: 8px; | |
| border-left: 4px solid #667eea; | |
| } | |
| .section h2 { | |
| color: #333; | |
| margin-bottom: 15px; | |
| font-size: 1.5em; | |
| } | |
| .provider-card { | |
| background: white; | |
| padding: 20px; | |
| margin-bottom: 15px; | |
| border-radius: 8px; | |
| border: 2px solid #ddd; | |
| transition: all 0.3s ease; | |
| } | |
| .provider-card:hover { | |
| border-color: #667eea; | |
| box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2); | |
| } | |
| .provider-card h3 { | |
| color: #667eea; | |
| margin-bottom: 10px; | |
| display: flex; | |
| align-items: center; | |
| gap: 10px; | |
| } | |
| .status-badge { | |
| display: inline-block; | |
| padding: 4px 12px; | |
| border-radius: 20px; | |
| font-size: 0.85em; | |
| font-weight: bold; | |
| } | |
| .status-enabled { background: #d4edda; color: #155724; } | |
| .status-disabled { background: #f8d7da; color: #721c24; } | |
| .form-group { | |
| margin-bottom: 15px; | |
| } | |
| label { | |
| display: block; | |
| margin-bottom: 5px; | |
| color: #333; | |
| font-weight: 500; | |
| } | |
| input, select, textarea { | |
| width: 100%; | |
| padding: 10px; | |
| border: 1px solid #ddd; | |
| border-radius: 4px; | |
| font-family: inherit; | |
| font-size: 1em; | |
| } | |
| input:focus, select:focus, textarea:focus { | |
| outline: none; | |
| border-color: #667eea; | |
| box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); | |
| } | |
| button { | |
| background: #667eea; | |
| color: white; | |
| border: none; | |
| padding: 10px 20px; | |
| border-radius: 4px; | |
| cursor: pointer; | |
| font-size: 1em; | |
| font-weight: 500; | |
| transition: background 0.3s ease; | |
| margin-right: 10px; | |
| margin-top: 10px; | |
| } | |
| button:hover { background: #5568d3; } | |
| button.secondary { | |
| background: #6c757d; | |
| } | |
| button.secondary:hover { | |
| background: #5a6268; | |
| } | |
| button.danger { | |
| background: #dc3545; | |
| } | |
| button.danger:hover { | |
| background: #c82333; | |
| } | |
| .button-group { | |
| display: flex; | |
| gap: 10px; | |
| flex-wrap: wrap; | |
| } | |
| .alert { | |
| padding: 15px; | |
| border-radius: 4px; | |
| margin-bottom: 15px; | |
| } | |
| .alert-success { | |
| background: #d4edda; | |
| color: #155724; | |
| border: 1px solid #c3e6cb; | |
| } | |
| .alert-error { | |
| background: #f8d7da; | |
| color: #721c24; | |
| border: 1px solid #f5c6cb; | |
| } | |
| .alert-info { | |
| background: #d1ecf1; | |
| color: #0c5460; | |
| border: 1px solid #bee5eb; | |
| } | |
| .tab-buttons { | |
| display: flex; | |
| gap: 10px; | |
| margin-bottom: 20px; | |
| border-bottom: 2px solid #ddd; | |
| } | |
| .tab-button { | |
| background: transparent; | |
| color: #667eea; | |
| border: none; | |
| padding: 10px 20px; | |
| cursor: pointer; | |
| border-bottom: 3px solid transparent; | |
| font-weight: 500; | |
| margin-bottom: -2px; | |
| } | |
| .tab-button.active { | |
| border-bottom-color: #667eea; | |
| } | |
| .tab-content { | |
| display: none; | |
| } | |
| .tab-content.active { | |
| display: block; | |
| } | |
| .code-block { | |
| background: #2d2d2d; | |
| color: #f8f8f2; | |
| padding: 15px; | |
| border-radius: 4px; | |
| overflow-x: auto; | |
| font-family: 'Courier New', monospace; | |
| font-size: 0.9em; | |
| } | |
| .footer { | |
| background: #f8f9fa; | |
| padding: 20px; | |
| text-align: center; | |
| color: #666; | |
| border-top: 1px solid #ddd; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <div class="header"> | |
| <h1>🌌 COSMOS Cloud Configuration</h1> | |
| <p>Manage your cloud service integrations</p> | |
| </div> | |
| <div class="content"> | |
| <div id="alerts"></div> | |
| <div class="tab-buttons"> | |
| <button class="tab-button active" onclick="showTab('overview')">Overview</button> | |
| <button class="tab-button" onclick="showTab('azure')">Azure</button> | |
| <button class="tab-button" onclick="showTab('ibm')">IBM</button> | |
| <button class="tab-button" onclick="showTab('test')">Test</button> | |
| </div> | |
| <!-- OVERVIEW TAB --> | |
| <div id="overview" class="tab-content active"> | |
| <div class="section"> | |
| <h2>System Status</h2> | |
| <div id="status-info"> | |
| <p>Loading...</p> | |
| </div> | |
| </div> | |
| <div class="section"> | |
| <h2>Default Provider</h2> | |
| <div class="form-group"> | |
| <label for="default-provider">Select Default Provider:</label> | |
| <select id="default-provider" onchange="setDefaultProvider()"> | |
| <option value="ollama">Ollama (Local)</option> | |
| <option value="azure">Azure OpenAI</option> | |
| <option value="ibm">IBM Watsonx</option> | |
| </select> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- AZURE TAB --> | |
| <div id="azure" class="tab-content"> | |
| <div class="section"> | |
| <h2>Azure OpenAI Configuration</h2> | |
| <div class="form-group"> | |
| <label> | |
| <input type="checkbox" id="azure-enabled" onchange="toggleAzure()"> | |
| Enable Azure OpenAI | |
| </label> | |
| </div> | |
| <div class="form-group"> | |
| <label for="azure-key">API Key:</label> | |
| <input type="password" id="azure-key" placeholder="Your Azure OpenAI API key"> | |
| <small>⚠️ Never commit your key to version control. Use environment variable: <code>COSMOS_AZURE_KEY</code></small> | |
| </div> | |
| <div class="form-group"> | |
| <label for="azure-endpoint">API Endpoint:</label> | |
| <input type="text" id="azure-endpoint" placeholder="https://{resource}.openai.azure.com/"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="azure-deployment">Deployment Name:</label> | |
| <input type="text" id="azure-deployment" placeholder="e.g., gpt-4"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="azure-model">Model Blob (for your reference):</label> | |
| <input type="text" id="azure-model" placeholder="e.g., gpt-4-vision"> | |
| </div> | |
| <div class="button-group"> | |
| <button onclick="saveAzureConfig()">Save Configuration</button> | |
| <button class="secondary" onclick="testAzure()">Test Connection</button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- IBM TAB --> | |
| <div id="ibm" class="tab-content"> | |
| <div class="section"> | |
| <h2>IBM Watsonx Configuration</h2> | |
| <div class="form-group"> | |
| <label> | |
| <input type="checkbox" id="ibm-enabled" onchange="toggleIBM()"> | |
| Enable IBM Watsonx | |
| </label> | |
| </div> | |
| <div class="form-group"> | |
| <label for="ibm-key">API Key:</label> | |
| <input type="password" id="ibm-key" placeholder="Your IBM API key"> | |
| <small>⚠️ Never commit your key to version control. Use environment variable: <code>COSMOS_IBM_KEY</code></small> | |
| </div> | |
| <div class="form-group"> | |
| <label for="ibm-endpoint">API Endpoint:</label> | |
| <input type="text" id="ibm-endpoint" placeholder="https://api.us-south.watson-platform.net/instances/..."> | |
| </div> | |
| <div class="form-group"> | |
| <label for="ibm-model">Model Name:</label> | |
| <input type="text" id="ibm-model" placeholder="e.g., granite-13b-chat-v2" value="granite-13b-chat-v2"> | |
| </div> | |
| <div class="form-group"> | |
| <label for="ibm-blob">Model Blob (for your reference):</label> | |
| <input type="text" id="ibm-blob" placeholder="e.g., ibm/granite"> | |
| </div> | |
| <div class="button-group"> | |
| <button onclick="saveIBMConfig()">Save Configuration</button> | |
| <button class="secondary" onclick="testIBM()">Test Connection</button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- TEST TAB --> | |
| <div id="test" class="tab-content"> | |
| <div class="section"> | |
| <h2>Test Cloud Services</h2> | |
| <div class="form-group"> | |
| <label for="test-provider">Select Provider:</label> | |
| <select id="test-provider"> | |
| <option value="ollama">Ollama (Local)</option> | |
| <option value="azure">Azure OpenAI</option> | |
| <option value="ibm">IBM Watsonx</option> | |
| </select> | |
| </div> | |
| <div class="form-group"> | |
| <label for="test-prompt">Test Prompt:</label> | |
| <textarea id="test-prompt" rows="3" placeholder="What is your name?"></textarea> | |
| </div> | |
| <button onclick="runTest()">Send Test Prompt</button> | |
| <div id="test-result" style="margin-top: 20px;"></div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="footer"> | |
| <p>COSMOS Cloud Router • <a href="/docs" style="color: #667eea;">API Documentation</a></p> | |
| </div> | |
| </div> | |
| <script> | |
| // Load initial status | |
| loadStatus(); | |
| function showTab(tabName) { | |
| // Hide all tabs | |
| document.querySelectorAll('.tab-content').forEach(tab => { | |
| tab.classList.remove('active'); | |
| }); | |
| document.querySelectorAll('.tab-button').forEach(btn => { | |
| btn.classList.remove('active'); | |
| }); | |
| // Show selected tab | |
| document.getElementById(tabName).classList.add('active'); | |
| event.target.classList.add('active'); | |
| } | |
| function loadStatus() { | |
| fetch('/api/status') | |
| .then(r => r.json()) | |
| .then(data => { | |
| let html = `<p><strong>Default Provider:</strong> ${data.default_provider}</p>`; | |
| html += '<h3 style="margin-top: 15px;">Providers:</h3>'; | |
| for (const [name, info] of Object.entries(data.providers)) { | |
| const badge = info.enabled ? | |
| '<span class="status-badge status-enabled">Enabled</span>' : | |
| '<span class="status-badge status-disabled">Disabled</span>'; | |
| html += ` | |
| <div class="provider-card"> | |
| <h3>${name.toUpperCase()} ${badge}</h3> | |
| <p><strong>Endpoint:</strong> ${info.endpoint}</p> | |
| <p><strong>Model:</strong> ${info.model}</p> | |
| <p><strong>Has Credentials:</strong> ${info.has_credentials ? '✓' : '✗'}</p> | |
| </div> | |
| `; | |
| } | |
| document.getElementById('status-info').innerHTML = html; | |
| }); | |
| } | |
| function setDefaultProvider() { | |
| const provider = document.getElementById('default-provider').value; | |
| fetch('/api/config/default', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ provider }) | |
| }) | |
| .then(r => r.json()) | |
| .then(data => { | |
| showAlert(`Default provider set to: ${provider}`, 'success'); | |
| loadStatus(); | |
| }) | |
| .catch(e => showAlert(`Error: ${e}`, 'error')); | |
| } | |
| function toggleAzure() { | |
| const enabled = document.getElementById('azure-enabled').checked; | |
| fetch(`/api/config/provider/azure/${enabled ? 'enable' : 'disable'}`, { method: 'POST' }) | |
| .then(r => r.json()) | |
| .then(data => { | |
| showAlert(`Azure ${enabled ? 'enabled' : 'disabled'}`, 'success'); | |
| loadStatus(); | |
| }) | |
| .catch(e => showAlert(`Error: ${e}`, 'error')); | |
| } | |
| function toggleIBM() { | |
| const enabled = document.getElementById('ibm-enabled').checked; | |
| fetch(`/api/config/provider/ibm/${enabled ? 'enable' : 'disable'}`, { method: 'POST' }) | |
| .then(r => r.json()) | |
| .then(data => { | |
| showAlert(`IBM ${enabled ? 'enabled' : 'disabled'}`, 'success'); | |
| loadStatus(); | |
| }) | |
| .catch(e => showAlert(`Error: ${e}`, 'error')); | |
| } | |
| function saveAzureConfig() { | |
| const config = { | |
| endpoint: document.getElementById('azure-endpoint').value, | |
| model_name: document.getElementById('azure-deployment').value, | |
| model_blob: document.getElementById('azure-model').value | |
| }; | |
| fetch('/api/config/provider/azure', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify(config) | |
| }) | |
| .then(r => r.json()) | |
| .then(data => { | |
| const key = document.getElementById('azure-key').value; | |
| if (key) { | |
| return fetch('/api/credentials/azure', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ api_key: key }) | |
| }); | |
| } | |
| }) | |
| .then(r => r.json()) | |
| .then(data => { | |
| showAlert('Azure configuration saved!', 'success'); | |
| loadStatus(); | |
| }) | |
| .catch(e => showAlert(`Error: ${e}`, 'error')); | |
| } | |
| function saveIBMConfig() { | |
| const config = { | |
| endpoint: document.getElementById('ibm-endpoint').value, | |
| model_name: document.getElementById('ibm-model').value, | |
| model_blob: document.getElementById('ibm-blob').value | |
| }; | |
| fetch('/api/config/provider/ibm', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify(config) | |
| }) | |
| .then(r => r.json()) | |
| .then(data => { | |
| const key = document.getElementById('ibm-key').value; | |
| if (key) { | |
| return fetch('/api/credentials/ibm', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ api_key: key }) | |
| }); | |
| } | |
| }) | |
| .then(r => r.json()) | |
| .then(data => { | |
| showAlert('IBM configuration saved!', 'success'); | |
| loadStatus(); | |
| }) | |
| .catch(e => showAlert(`Error: ${e}`, 'error')); | |
| } | |
| function testAzure() { | |
| testProvider('azure'); | |
| } | |
| function testIBM() { | |
| testProvider('ibm'); | |
| } | |
| function testProvider(provider) { | |
| fetch(`/api/credentials/test/${provider}`, { method: 'POST' }) | |
| .then(r => r.json()) | |
| .then(data => { | |
| if (data.status === 'success') { | |
| showAlert(`✓ ${provider.toUpperCase()} connection successful!`, 'success'); | |
| } else { | |
| showAlert(`✗ ${data.error}`, 'error'); | |
| } | |
| }) | |
| .catch(e => showAlert(`Error: ${e}`, 'error')); | |
| } | |
| function runTest() { | |
| const provider = document.getElementById('test-provider').value; | |
| const prompt = document.getElementById('test-prompt').value; | |
| if (!prompt) { | |
| showAlert('Please enter a test prompt', 'error'); | |
| return; | |
| } | |
| document.getElementById('test-result').innerHTML = '<p>Testing...</p>'; | |
| fetch('/api/generate', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ prompt, provider }) | |
| }) | |
| .then(r => r.json()) | |
| .then(data => { | |
| if (data.response) { | |
| document.getElementById('test-result').innerHTML = ` | |
| <div class="alert alert-success"> | |
| <strong>Response from ${data.provider}:</strong> | |
| <p style="margin-top: 10px;">${data.response}</p> | |
| </div> | |
| `; | |
| } else { | |
| showAlert(`Error: ${data.error}`, 'error'); | |
| } | |
| }) | |
| .catch(e => showAlert(`Error: ${e}`, 'error')); | |
| } | |
| function showAlert(message, type) { | |
| const alertDiv = document.createElement('div'); | |
| alertDiv.className = `alert alert-${type}`; | |
| alertDiv.textContent = message; | |
| document.getElementById('alerts').appendChild(alertDiv); | |
| setTimeout(() => alertDiv.remove(), 5000); | |
| } | |
| </script> | |
| </body> | |
| </html> | |
Xet Storage Details
- Size:
- 20.8 kB
- Xet hash:
- ecc95480b7bf4d58774d5e8f9fd11c89571f26cda76d34b43c023d640e48906f
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.