askrobots / dbbasic Public

Model-config web apps: describe the app in configuration instead of writing code. Built on Polars and DuckDB.

0 downloads

dbbasic/static/mockup_ai_services.html
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Add DBBasic crate engine logo and update README 0d628db 1 year, 2 months ago History
mockup_ai_services.html · 16.6 KB · 506 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>DBBasic - AI Service Builder</title>
7 <style>
8 * {
9 margin: 0;
10 padding: 0;
11 box-sizing: border-box;
12 }
13
14 body {
15 font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
16 background: #f5f5f5;
17 height: 100vh;
18 display: flex;
19 flex-direction: column;
20 }
21
22 .header {
23 background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
24 color: white;
25 padding: 1rem 2rem;
26 display: flex;
27 justify-content: space-between;
28 align-items: center;
29 box-shadow: 0 2px 10px rgba(0,0,0,0.1);
30 }
31
32 .logo {
33 font-family: 'Times New Roman', Times, serif;
34 font-size: 24px;
35 font-weight: bold;
36 }
37
38 .header-subtitle {
39 font-size: 14px;
40 opacity: 0.9;
41 }
42
43 .container {
44 flex: 1;
45 display: flex;
46 overflow: hidden;
47 }
48
49 .sidebar {
50 width: 300px;
51 background: white;
52 border-right: 1px solid #e0e0e0;
53 overflow-y: auto;
54 }
55
56 .main-content {
57 flex: 1;
58 display: flex;
59 flex-direction: column;
60 overflow: hidden;
61 }
62
63 .tabs {
64 background: white;
65 border-bottom: 1px solid #e0e0e0;
66 display: flex;
67 padding: 0 1rem;
68 }
69
70 .tab {
71 padding: 1rem 1.5rem;
72 cursor: pointer;
73 border-bottom: 3px solid transparent;
74 transition: all 0.2s;
75 color: #666;
76 }
77
78 .tab.active {
79 color: #667eea;
80 border-bottom-color: #667eea;
81 }
82
83 .tab-content {
84 flex: 1;
85 padding: 2rem;
86 overflow-y: auto;
87 }
88
89 .service-card {
90 background: white;
91 border-radius: 8px;
92 padding: 1.5rem;
93 margin-bottom: 1rem;
94 box-shadow: 0 2px 4px rgba(0,0,0,0.05);
95 transition: all 0.2s;
96 cursor: pointer;
97 }
98
99 .service-card:hover {
100 box-shadow: 0 4px 12px rgba(0,0,0,0.1);
101 transform: translateY(-2px);
102 }
103
104 .service-name {
105 font-size: 18px;
106 font-weight: 600;
107 color: #2c3e50;
108 margin-bottom: 0.5rem;
109 }
110
111 .service-description {
112 color: #666;
113 margin-bottom: 1rem;
114 font-size: 14px;
115 }
116
117 .service-endpoint {
118 background: #f0f0f0;
119 padding: 0.5rem 1rem;
120 border-radius: 4px;
121 font-family: monospace;
122 font-size: 13px;
123 margin-bottom: 1rem;
124 }
125
126 .service-status {
127 display: inline-block;
128 padding: 0.25rem 0.75rem;
129 border-radius: 15px;
130 font-size: 12px;
131 font-weight: 600;
132 }
133
134 .status-active {
135 background: #d4edda;
136 color: #155724;
137 }
138
139 .status-generating {
140 background: #fff3cd;
141 color: #856404;
142 }
143
144 .create-form {
145 background: white;
146 border-radius: 8px;
147 padding: 2rem;
148 box-shadow: 0 2px 8px rgba(0,0,0,0.1);
149 }
150
151 .form-group {
152 margin-bottom: 1.5rem;
153 }
154
155 .form-label {
156 display: block;
157 margin-bottom: 0.5rem;
158 font-weight: 600;
159 color: #2c3e50;
160 }
161
162 .form-input, .form-textarea {
163 width: 100%;
164 padding: 0.75rem;
165 border: 2px solid #e0e0e0;
166 border-radius: 6px;
167 font-size: 14px;
168 transition: border-color 0.2s;
169 }
170
171 .form-input:focus, .form-textarea:focus {
172 outline: none;
173 border-color: #667eea;
174 }
175
176 .form-textarea {
177 min-height: 120px;
178 resize: vertical;
179 }
180
181 .form-hint {
182 margin-top: 0.25rem;
183 font-size: 12px;
184 color: #999;
185 }
186
187 .ai-suggestion {
188 background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
189 border-radius: 6px;
190 padding: 1rem;
191 margin-top: 0.5rem;
192 font-size: 13px;
193 color: #495057;
194 }
195
196 .btn {
197 padding: 0.75rem 2rem;
198 border: none;
199 border-radius: 6px;
200 font-weight: 600;
201 cursor: pointer;
202 transition: all 0.2s;
203 }
204
205 .btn-primary {
206 background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
207 color: white;
208 }
209
210 .btn-primary:hover {
211 transform: translateY(-2px);
212 box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
213 }
214
215 .btn-secondary {
216 background: #f0f0f0;
217 color: #666;
218 margin-right: 1rem;
219 }
220
221 .code-preview {
222 background: #1e1e1e;
223 color: #d4d4d4;
224 padding: 1.5rem;
225 border-radius: 8px;
226 font-family: 'Monaco', 'Menlo', monospace;
227 font-size: 13px;
228 line-height: 1.6;
229 overflow-x: auto;
230 margin-top: 1rem;
231 }
232
233 .code-comment {
234 color: #6a9955;
235 }
236
237 .code-keyword {
238 color: #c586c0;
239 }
240
241 .code-string {
242 color: #ce9178;
243 }
244
245 .code-function {
246 color: #dcdcaa;
247 }
248
249 .metrics-grid {
250 display: grid;
251 grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
252 gap: 1rem;
253 margin-top: 2rem;
254 }
255
256 .metric-card {
257 background: white;
258 border-radius: 8px;
259 padding: 1.5rem;
260 box-shadow: 0 2px 4px rgba(0,0,0,0.05);
261 }
262
263 .metric-value {
264 font-size: 32px;
265 font-weight: bold;
266 color: #667eea;
267 }
268
269 .metric-label {
270 color: #666;
271 font-size: 14px;
272 margin-top: 0.5rem;
273 }
274
275 .live-indicator {
276 display: inline-block;
277 width: 8px;
278 height: 8px;
279 background: #4CAF50;
280 border-radius: 50%;
281 margin-left: 0.5rem;
282 animation: pulse 2s infinite;
283 }
284
285 @keyframes pulse {
286 0% { opacity: 1; }
287 50% { opacity: 0.5; }
288 100% { opacity: 1; }
289 }
290
291 .test-panel {
292 background: white;
293 border-radius: 8px;
294 padding: 1.5rem;
295 margin-top: 1rem;
296 }
297
298 .test-input {
299 background: #f8f9fa;
300 border: 1px solid #dee2e6;
301 border-radius: 4px;
302 padding: 1rem;
303 margin: 1rem 0;
304 font-family: monospace;
305 font-size: 13px;
306 }
307
308 .test-output {
309 background: #e8f5e9;
310 border: 1px solid #c8e6c9;
311 border-radius: 4px;
312 padding: 1rem;
313 font-family: monospace;
314 font-size: 13px;
315 }
316 </style>
317</head>
318<body>
319 <div class="header">
320 <div>
321 <div class="logo">DBBasic</div>
322 <div class="header-subtitle">AI Service Builder - Natural Language to Running Services</div>
323 </div>
324 <div>
325 <span style="margin-right: 2rem;">🚀 402M rows/sec</span>
326 <span class="live-indicator"></span>
327 <span style="margin-left: 0.5rem;">All services running</span>
328 </div>
329 </div>
330
331 <div class="container">
332 <div class="sidebar">
333 <div style="padding: 1rem; border-bottom: 1px solid #e0e0e0;">
334 <h3 style="margin-bottom: 1rem;">Active Services</h3>
335 <input type="text" placeholder="Search services..." class="form-input" style="font-size: 13px;">
336 </div>
337
338 <div style="padding: 1rem;">
339 <div class="service-card">
340 <div class="service-name">calculate_order_total</div>
341 <div class="service-description">Calculate tax based on customer location</div>
342 <div class="service-status status-active">Active</div>
343 </div>
344
345 <div class="service-card">
346 <div class="service-name">send_notification</div>
347 <div class="service-description">Send order confirmation emails</div>
348 <div class="service-status status-active">Active</div>
349 </div>
350
351 <div class="service-card">
352 <div class="service-name">detect_fraud</div>
353 <div class="service-description">Score orders for fraud risk</div>
354 <div class="service-status status-active">Active</div>
355 </div>
356
357 <div class="service-card">
358 <div class="service-name">segment_customer</div>
359 <div class="service-description">Categorize customers by value</div>
360 <div class="service-status status-generating">Generating...</div>
361 </div>
362 </div>
363 </div>
364
365 <div class="main-content">
366 <div class="tabs">
367 <div class="tab active">Create Service</div>
368 <div class="tab">Test Service</div>
369 <div class="tab">Generated Code</div>
370 <div class="tab">Metrics</div>
371 </div>
372
373 <div class="tab-content">
374 <div class="create-form">
375 <h2 style="margin-bottom: 2rem;">Create AI Service from Description</h2>
376
377 <div class="form-group">
378 <label class="form-label">Service Name</label>
379 <input type="text" class="form-input" placeholder="e.g., calculate_shipping_cost" value="calculate_shipping_cost">
380 <div class="form-hint">Use snake_case. This becomes your endpoint: /ai/calculate_shipping_cost</div>
381 </div>
382
383 <div class="form-group">
384 <label class="form-label">Natural Language Description</label>
385 <textarea class="form-textarea" placeholder="Describe what this service should do...">Calculate shipping cost based on weight, dimensions, destination zip code, and shipping speed. Use USPS rates for standard, UPS for express. Add $5 handling fee for fragile items. Free shipping over $100.</textarea>
386 <div class="ai-suggestion">
387 <strong>🤖 AI understands:</strong> This service will calculate shipping costs using carrier APIs, apply business rules for free shipping, and handle special item surcharges.
388 </div>
389 </div>
390
391 <div class="form-group">
392 <label class="form-label">Expected Inputs</label>
393 <input type="text" class="form-input" placeholder="weight, dimensions, zip_code, shipping_speed, is_fragile" value="weight, dimensions, zip_code, shipping_speed, is_fragile">
394 </div>
395
396 <div class="form-group">
397 <label class="form-label">Expected Outputs</label>
398 <input type="text" class="form-input" placeholder="shipping_cost, carrier, estimated_days" value="shipping_cost, carrier, estimated_days, free_shipping_applied">
399 </div>
400
401 <div style="margin-top: 2rem;">
402 <button class="btn btn-secondary">Test with Mock Data</button>
403 <button class="btn btn-primary" onclick="generateService()">Generate Service with AI</button>
404 </div>
405 </div>
406
407 <div class="code-preview">
408 <div><span class="code-comment"># AI-Generated Service (0.3 seconds to generate)</span></div>
409 <div><span class="code-keyword">async def</span> <span class="code-function">calculate_shipping_cost</span>(data: Dict) -> Dict:</div>
410 <div> <span class="code-string">"""Calculate shipping cost based on multiple factors"""</span></div>
411 <div> </div>
412 <div> <span class="code-comment"># Extract inputs</span></div>
413 <div> weight = data.get(<span class="code-string">'weight'</span>, 0)</div>
414 <div> dimensions = data.get(<span class="code-string">'dimensions'</span>, {})</div>
415 <div> zip_code = data.get(<span class="code-string">'zip_code'</span>)</div>
416 <div> speed = data.get(<span class="code-string">'shipping_speed'</span>, <span class="code-string">'standard'</span>)</div>
417 <div> is_fragile = data.get(<span class="code-string">'is_fragile'</span>, False)</div>
418 <div> order_total = data.get(<span class="code-string">'order_total'</span>, 0)</div>
419 <div> </div>
420 <div> <span class="code-comment"># AI determined shipping logic</span></div>
421 <div> <span class="code-keyword">if</span> order_total >= 100:</div>
422 <div> <span class="code-keyword">return</span> {</div>
423 <div> <span class="code-string">'shipping_cost'</span>: 0,</div>
424 <div> <span class="code-string">'free_shipping_applied'</span>: True,</div>
425 <div> <span class="code-string">'carrier'</span>: <span class="code-string">'USPS'</span>,</div>
426 <div> <span class="code-string">'estimated_days'</span>: 3</div>
427 <div> }</div>
428 <div> ...</div>
429 </div>
430
431 <div class="test-panel">
432 <h3>Test Your Service</h3>
433 <div class="test-input">
434{
435 "weight": 2.5,
436 "dimensions": {"length": 12, "width": 8, "height": 4},
437 "zip_code": "90210",
438 "shipping_speed": "express",
439 "is_fragile": true,
440 "order_total": 75
441}
442 </div>
443 <button class="btn btn-primary" style="margin: 1rem 0;">Run Test</button>
444 <div class="test-output">
445{
446 "success": true,
447 "data": {
448 "shipping_cost": 18.50,
449 "carrier": "UPS",
450 "estimated_days": 2,
451 "free_shipping_applied": false,
452 "breakdown": {
453 "base_cost": 13.50,
454 "fragile_handling": 5.00
455 }
456 }
457}
458 </div>
459 </div>
460
461 <div class="metrics-grid">
462 <div class="metric-card">
463 <div class="metric-value">47</div>
464 <div class="metric-label">Active Services</div>
465 </div>
466 <div class="metric-card">
467 <div class="metric-value">1.2M</div>
468 <div class="metric-label">Requests Today</div>
469 </div>
470 <div class="metric-card">
471 <div class="metric-value">8ms</div>
472 <div class="metric-label">Avg Response Time</div>
473 </div>
474 <div class="metric-card">
475 <div class="metric-value">99.99%</div>
476 <div class="metric-label">Uptime</div>
477 </div>
478 </div>
479 </div>
480 </div>
481 </div>
482
483 <script>
484 function generateService() {
485 // Simulate service generation
486 const statusElement = document.querySelector('.service-card:last-child .service-status');
487 statusElement.textContent = 'Generating...';
488 statusElement.className = 'service-status status-generating';
489
490 setTimeout(() => {
491 statusElement.textContent = 'Active';
492 statusElement.className = 'service-status status-active';
493 alert('Service generated and deployed! Endpoint: /ai/calculate_shipping_cost');
494 }, 2000);
495 }
496
497 // Tab switching
498 document.querySelectorAll('.tab').forEach(tab => {
499 tab.addEventListener('click', () => {
500 document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
501 tab.classList.add('active');
502 });
503 });
504 </script>
505</body>
506</html>