Model-config web apps: describe the app in configuration instead of writing code. Built on Polars and DuckDB.
ai_services.html · 9.2 KB · 119 lines
| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="UTF-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | <title>AI Service Builder - DBBasic</title> |
| 7 | <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"> |
| 8 | <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css"> |
| 9 | |
| 10 | <style> |
| 11 | .card { transition: transform 0.3s; } |
| 12 | .card:hover { transform: translateY(-5px); } |
| 13 | </style> |
| 14 | </head> |
| 15 | <body> |
| 16 | |
| 17 | <nav class="navbar navbar-expand-lg navbar-light bg-light"> |
| 18 | <div class="container-fluid"> |
| 19 | <a class="navbar-brand" href="#">DBBasic</a> |
| 20 | <div class="navbar-nav ms-auto"> |
| 21 | <a class="nav-link" href="http://localhost:8004">Monitor</a> <a class="nav-link" href="http://localhost:8005">Data</a> <a class="nav-link" href="http://localhost:8003">AI Services</a> <a class="nav-link" href="http://localhost:8006">Event Store</a> <a class="nav-link" href="http://localhost:8005/templates">Templates</a> |
| 22 | </div> |
| 23 | </div> |
| 24 | </nav><div class="container-fluid"><div class="container"> |
| 25 | <nav aria-label="breadcrumb"> |
| 26 | <ol class="breadcrumb"> |
| 27 | <li class="breadcrumb-item"><a href="/">DBBasic</a></li><li class="breadcrumb-item active">AI Services</li> |
| 28 | </ol> |
| 29 | </nav> |
| 30 | </div></div><div class="container-fluid"> |
| 31 | <div class="bg-primary text-white text-center py-5"> |
| 32 | <div class="container"> |
| 33 | <h1 class="display-4">🤖 AI Service Platform</h1> |
| 34 | <p class="lead">Create production-ready services from natural language</p> |
| 35 | </div> |
| 36 | </div> |
| 37 | <div class="container my-5"> |
| 38 | <div class="row row-cols-1 row-cols-md-4 g-4"> |
| 39 | <div class="col"> |
| 40 | <div class="card h-100"> |
| 41 | <div class="card-body"> |
| 42 | <div class="d-flex justify-content-between align-items-start mb-2"> |
| 43 | <h5 class="card-title"></h5> |
| 44 | |
| 45 | </div> |
| 46 | <p class="card-text"></p> |
| 47 | </div> |
| 48 | |
| 49 | </div></div> <div class="col"> |
| 50 | <div class="card h-100"> |
| 51 | <div class="card-body"> |
| 52 | <div class="d-flex justify-content-between align-items-start mb-2"> |
| 53 | <h5 class="card-title"></h5> |
| 54 | |
| 55 | </div> |
| 56 | <p class="card-text"></p> |
| 57 | </div> |
| 58 | |
| 59 | </div></div> <div class="col"> |
| 60 | <div class="card h-100"> |
| 61 | <div class="card-body"> |
| 62 | <div class="d-flex justify-content-between align-items-start mb-2"> |
| 63 | <h5 class="card-title"></h5> |
| 64 | |
| 65 | </div> |
| 66 | <p class="card-text"></p> |
| 67 | </div> |
| 68 | |
| 69 | </div></div> <div class="col"> |
| 70 | <div class="card h-100"> |
| 71 | <div class="card-body"> |
| 72 | <div class="d-flex justify-content-between align-items-start mb-2"> |
| 73 | <h5 class="card-title"></h5> |
| 74 | |
| 75 | </div> |
| 76 | <p class="card-text"></p> |
| 77 | </div> |
| 78 | |
| 79 | </div></div> |
| 80 | </div> |
| 81 | </div> |
| 82 | <div class="card h-100"> |
| 83 | <div class="card-body"> |
| 84 | <div class="d-flex justify-content-between align-items-start mb-2"> |
| 85 | <h5 class="card-title">✨ Create New Service</h5> |
| 86 | |
| 87 | </div> |
| 88 | <p class="card-text"></p> |
| 89 | </div> |
| 90 | |
| 91 | </div> |
| 92 | <div class="card h-100"> |
| 93 | <div class="card-body"> |
| 94 | <div class="d-flex justify-content-between align-items-start mb-2"> |
| 95 | <h5 class="card-title">🚀 Active Services</h5> |
| 96 | |
| 97 | </div> |
| 98 | <p class="card-text"></p> |
| 99 | </div> |
| 100 | |
| 101 | </div> |
| 102 | <div class="card h-100"> |
| 103 | <div class="card-body"> |
| 104 | <div class="d-flex justify-content-between align-items-start mb-2"> |
| 105 | <h5 class="card-title">🔗 Model Hooks</h5> |
| 106 | |
| 107 | </div> |
| 108 | <p class="card-text"></p> |
| 109 | </div> |
| 110 | |
| 111 | </div></div><div class="container-fluid"><div class="container">{'type': 'row', 'children': [{'type': 'col', 'size': 4, 'children': ['<h5>DBBasic</h5>', '<p class="text-muted">Config-driven application platform</p>']}, {'type': 'col', 'size': 4, 'children': ['<h6>Services</h6>', {'type': 'list', 'class': 'list-unstyled', 'items': ['<a href="http://localhost:8004" class="text-muted">Monitor</a>', '<a href="http://localhost:8005" class="text-muted">Data</a>', '<a href="http://localhost:8003" class="text-muted">AI Services</a>', '<a href="http://localhost:8006" class="text-muted">Event Store</a>', '<a href="http://localhost:8005" class="text-muted">Templates</a>']}]}, {'type': 'col', 'size': 4, 'children': ['<h6>Performance</h6>', '<p class="text-muted">🚀 402M rows/sec with DuckDB</p>', '<p class="text-muted">⚡ Post-Code Era</p>', '<p class="text-muted">🤖 AI-Enhanced</p>']}]}<hr class="border-secondary"><p class="text-center text-muted mb-0">© 2024 DBBasic - Everything is Data</p></div></div>{'type': 'script', 'content': '\n // AI Service Builder functionality\n const API_BASE = \'http://localhost:8003\';\n\n async function createService(event) {\n event.preventDefault();\n const form = document.getElementById(\'service-form\');\n const formData = new FormData(form);\n\n const response = await fetch(`${API_BASE}/api/services/create`, {\n method: \'POST\',\n headers: {\'Content-Type\': \'application/json\'},\n body: JSON.stringify({\n name: formData.get(\'name\'),\n description: formData.get(\'description\'),\n includeTests: formData.get(\'includeTests\') === \'on\',\n includeDocs: formData.get(\'includeDocs\') === \'on\'\n })\n });\n\n if (response.ok) {\n const service = await response.json();\n addServiceToTable(service);\n form.reset();\n updateStats();\n }\n }\n\n function addServiceToTable(service) {\n const table = document.getElementById(\'services-table\');\n const row = table.insertRow();\n row.innerHTML = `\n <td>${service.name}</td>\n <td><span class="badge bg-success">Active</span></td>\n <td>${new Date(service.created_at).toLocaleString()}</td>\n <td>\n <button class="btn btn-sm btn-primary" onclick="viewCode(\'${service.name}\')">\n <i class="bi bi-code"></i> View\n </button>\n <button class="btn btn-sm btn-success" onclick="testService(\'${service.name}\')">\n <i class="bi bi-play"></i> Test\n </button>\n </td>\n `;\n }\n\n async function updateStats() {\n const response = await fetch(`${API_BASE}/api/services`);\n const services = await response.json();\n\n document.getElementById(\'services-count\').innerText = services.length;\n // Update other stats...\n }\n\n // Initialize on load\n document.addEventListener(\'DOMContentLoaded\', () => {\n document.getElementById(\'service-form\').onsubmit = createService;\n updateStats();\n loadActiveServices();\n connectWebSocket();\n });\n\n function connectWebSocket() {\n const ws = new WebSocket(\'ws://localhost:8003/ws\');\n ws.onmessage = (event) => {\n const data = JSON.parse(event.data);\n if (data.type === \'hook\') {\n updateHooksList(data);\n }\n };\n }\n '} |
| 112 | <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script> |
| 113 | |
| 114 | <script> |
| 115 | function deployTemplate(id) { alert('Deploying: ' + id); } |
| 116 | function previewTemplate(id) { alert('Preview: ' + id); } |
| 117 | </script> |
| 118 | </body> |
| 119 | </html> |