Spaces:
Running

File size: 15,982 Bytes
5e523a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AVA Backend & API</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js"></script>
    <style>
        .gradient-text {
            background: linear-gradient(90deg, #6d28d9 0%, #a855f7 50%, #7c3aed 100%);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }
        .code-block {
            background: #1a1a1a;
            border-radius: 8px;
            padding: 16px;
            font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
            font-size: 14px;
            color: #e6e6e6;
            overflow-x: auto;
        }
        .endpoint-card {
            transition: all 0.3s ease;
            border-left: 4px solid #6d28d9;
        }
        .endpoint-card:hover {
            transform: translateX(4px);
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        }
    </style>
</head>
<body class="bg-gray-50">
    <div class="min-h-screen flex flex-col">
        <!-- Header -->
        <header class="bg-white shadow-sm border-b border-gray-200">
            <div class="container mx-auto px-6 py-4 flex justify-between items-center">
                <div class="flex items-center space-x-3">
                    <i data-feather="zap" class="text-purple-600 w-6 h-6"></i>
                    <span class="text-xl font-bold gradient-text">AVA Backend & API</span>
                </div>
                <nav class="flex space-x-6 items-center">
                    <a href="index.html" class="text-gray-600 hover:text-purple-600 font-medium transition-colors">Home</a>
                    <a href="dashboard.html" class="text-gray-600 hover:text-purple-600 font-medium transition-colors">Dashboard</a>
                    <a href="index.html#features" class="text-gray-600 hover:text-purple-600 font-medium transition-colors">Features</a>
                </nav>
            </div>
        </header>

        <!-- Main Content -->
        <main class="flex-grow container mx-auto px-6 py-8">
            <!-- API Overview -->
            <div class="bg-white rounded-xl shadow-sm border border-gray-200 p-8 mb-8">
                <h1 class="text-3xl font-bold text-gray-800 mb-4">AVA Backend API</h1>
                <p class="text-gray-600 text-lg mb-6">
                RESTful API endpoints for programmatic access to AVA's automation capabilities. 
                All endpoints require authentication via API key.
                </p>
                
                <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
                    <div class="text-center p-4">
                        <i data-feather="cpu" class="w-8 h-8 text-purple-600 mx-auto mb-3"></i>
                    <h3 class="font-semibold text-gray-800">Real-time Processing</h3>
                        <p class="text-sm text-gray-600 mt-2">Process commands instantly with low latency responses</p>
                    </div>
                    <div class="text-center p-4">
                        <i data-feather="shield" class="w-8 h-8 text-purple-600 mx-auto mb-3"></i>
                    <h3 class="font-semibold text-gray-800">Secure & Scalable</h3>
                        <p class="text-sm text-gray-600 mt-2">Enterprise-grade security with automatic scaling for high workloads</p>
                    </div>
                    <div class="text-center p-4">
                        <i data-feather="database" class="w-8 h-8 text-purple-600 mx-auto mb-3"></i>
                    <h3 class="font-semibold text-gray-800">Webhook Support</h3>
                        <p class="text-sm text-gray-600 mt-2">Receive real-time notifications for workflow completions and errors</p>
                    </div>
                </div>
            </div>

            <!-- API Endpoints -->
            <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
                <!-- Commands Endpoint -->
                <div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
                    <h2 class="text-xl font-bold text-gray-800 mb-6">Core API Endpoints</h2>
                
                <div class="space-y-6">
                    <!-- Execute Command -->
                    <div class="endpoint-card bg-gray-50 p-4 rounded-lg">
                        <div class="flex items-center justify-between mb-3">
                        <span class="bg-green-100 text-green-800 px-2 py-1 rounded text-xs font-medium">POST</span>
                        <code class="text-sm text-purple-600 font-medium">/api/v1/commands/execute</code>
                    </div>
                    <div class="code-block">
                        <pre><code class="text-green-400">// Execute a natural language command
POST https://api.ava-ai.com/v1/commands/execute
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY

{
  "command": "Extract sales data from columns A to F and create a pivot table",
  "workflow_id": "optional_workflow_reference",
  "parameters": {
    "output_format": "excel",
    "email_results": true
}</code></pre>
                    </div>

                    <!-- Get Workflows -->
                    <div class="endpoint-card bg-gray-50 p-4 rounded-lg">
                        <div class="flex items-center justify-between mb-3">
                        <span class="bg-blue-100 text-blue-800 px-2 py-1 rounded text-xs font-medium">GET</span>
                        <code class="text-sm text-purple-600 font-medium">/api/v1/workflows</code>
                    </div>
                    <div class="code-block">
                        <pre><code class="text-green-400">// List all workflows
GET https://api.ava-ai.com/v1/workflows
Authorization: Bearer YOUR_API_KEY</code></pre>
                    </div>

                    <!-- Create Workflow -->
                    <div class="endpoint-card bg-gray-50 p-4 rounded-lg">
                        <div class="flex items-center justify-between mb-3">
                        <span class="bg-purple-100 text-purple-800 px-2 py-1 rounded text-xs font-medium">POST</span>
                        <code class="text-sm text-purple-600 font-medium">/api/v1/workflows</code>
                    </div>
                    <div class="code-block">
                        <pre><code class="text-green-400">// Create a new workflow
POST https://api.ava-ai.com/v1/workflows
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY

{
  "name": "Monthly Sales Report",
  "description": "Automated Q3 sales analysis",
  "steps": [
    {
      "action": "extract_data",
      "parameters": {"range": "A1:F100"}
    },
    {
      "action": "create_pivot",
      "parameters": {"rows": ["Region"], "values": ["Revenue"]}
  ]
}</code></pre>
                    </div>
                </div>

                <!-- API Documentation -->
                <div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
                    <h2 class="text-xl font-bold text-gray-800 mb-6">API Documentation</h2>
                    
                    <div class="space-y-6">
                        <div class="bg-purple-50 p-4 rounded-lg">
                            <h3 class="font-semibold text-purple-800 mb-3">Authentication</h3>
                        <p class="text-sm text-gray-600 mb-3">
                        All API requests require an API key in the Authorization header:
                        </p>
                        <div class="code-block">
                            <pre><code class="text-green-400">Authorization: Bearer ava_sk_1234567890abcdef</code></pre>
                        </div>
                    </div>

                    <div class="bg-blue-50 p-4 rounded-lg">
                            <h3 class="font-semibold text-blue-800 mb-3">Rate Limiting</h3>
                        <p class="text-sm text-gray-600">
                        • 1000 requests per hour per API key<br>
                        • 100 concurrent connections<br>
                        • 10MB maximum payload size
                        </p>
                    </div>

                    <div class="bg-green-50 p-4 rounded-lg">
                            <h3 class="font-semibold text-green-800 mb-3">Response Format</h3>
                        <div class="code-block">
                            <pre><code class="text-green-400">// Success Response
{
  "success": true,
  "data": {
    "workflow_id": "wf_123456",
    "status": "completed",
    "result_url": "https://api.ava-ai.com/results/wf_123456",
  "execution_time": 2.45
}

// Error Response
{
  "success": false,
  "error": {
    "code": "invalid_command",
    "message": "The provided command could not be processed"
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Webhook Configuration -->
            <div class="mt-8 bg-white rounded-xl shadow-sm border border-gray-200 p-8">
                <h2 class="text-2xl font-bold text-gray-800 mb-6">Webhook Integration</h2>
                
                <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
                <div class="bg-gray-50 p-6 rounded-lg">
                        <h3 class="font-semibold text-gray-800 mb-4">Configure Webhooks</h3>
                        <div class="code-block">
                            <pre><code class="text-green-400">// Webhook Configuration
POST https://api.ava-ai.com/v1/webhooks
Content-Type: application/json

{
  "url": "https://your-app.com/ava-webhook",
  "events": ["workflow.completed", "workflow.failed"]
}</code></pre>
                    </div>

                    <div class="bg-gray-50 p-6 rounded-lg">
                        <h3 class="font-semibold text-gray-800 mb-4">Webhook Payload</h3>
                        <div class="code-block">
                            <pre><code class="text-green-400">// Webhook Event Example
{
  "event": "workflow.completed",
  "workflow_id": "wf_123456",
  "timestamp": "2023-11-15T10:30:00Z",
  "data": {
    "workflow_name": "Monthly Sales Report",
    "execution_time": 3.21,
    "result_url": "https://api.ava-ai.com/results/wf_123456",
    "status": "success"
  }
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>

            <!-- SDK Section -->
            <div class="mt-8 bg-white rounded-xl shadow-sm border border-gray-200 p-8">
                <h2 class="text-2xl font-bold text-gray-800 mb-6">SDK & Libraries</h2>
                
                <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                    <div class="text-center p-6 bg-gray-50 rounded-lg">
                        <i data-feather="code" class="w-8 h-8 text-purple-600 mx-auto mb-3"></i>
                    <h3 class="font-semibold text-gray-800 mb-3">Python</h3>
                        <div class="code-block mt-3">
                            <pre><code class="text-green-400">pip install ava-ai-sdk

from ava import Client

client = Client(api_key="your_api_key")
result = client.execute_command(
    "Create a bar chart of monthly revenue"
)</code></pre>
                        </div>
                    </div>
                    <div class="text-center p-6 bg-gray-50 rounded-lg">
                        <i data-feather="code" class="w-8 h-8 text-purple-600 mx-auto mb-3"></i>
                    <h3 class="font-semibold text-gray-800 mb-3">JavaScript</h3>
                        <div class="code-block mt-3">
                            <pre><code class="text-green-400">npm install ava-ai-sdk

import { AVA } from 'ava-ai-sdk';

const ava = new AVA('your_api_key');
const workflow = await ava.execute('Analyze Q3 data');</code></pre>
                        </div>
                    </div>
                    <div class="text-center p-6 bg-gray-50 rounded-lg">
                        <i data-feather="code" class="w-8 h-8 text-purple-600 mx-auto mb-3"></i>
                    <h3 class="font-semibold text-gray-800 mb-3">REST API</h3>
                        <p class="text-sm text-gray-600 mt-2">Direct HTTP requests with any language</p>
                        <div class="code-block mt-3">
                            <pre><code class="text-green-400">curl -X POST \
  https://api.ava-ai.com/v1/commands/execute \
  -H 'Authorization: Bearer your_api_key' \
  -d '{"command": "Your natural language command"}'</code></pre>
                        </div>
                    </div>
                </div>
            </div>
        </main>

        <!-- Footer -->
        <footer class="bg-white border-t border-gray-200 py-8 mt-8">
            <div class="container mx-auto px-6">
                <div class="flex flex-col md:flex-row justify-between items-center">
                    <p class="text-gray-600 text-sm">© 2023 AVA AI. All rights reserved.</p>
                <div class="flex space-x-6 mt-4 md:mt-0">
                    <a href="#" class="text-gray-400 hover:text-purple-600 transition-colors">
                        <i data-feather="github"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-purple-600 transition-colors">
                        <i data-feather="file-text"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-purple-600 transition-colors">
                        <i data-feather="download"></i>
                    </a>
                </div>
            </div>
        </footer>
    </div>

    <script>
        // Initialize feather icons
        feather.replace();

        // Add copy functionality to code blocks
        document.addEventListener('DOMContentLoaded', function() {
            document.querySelectorAll('.code-block').forEach(block => {
                block.addEventListener('click', function() {
                    const code = block.querySelector('code').textContent;
                    navigator.clipboard.writeText(code).then(() => {
                        // Show copied notification
                        const notification = document.createElement('div');
                        notification.className = 'fixed top-4 right-4 p-4 rounded-lg shadow-lg z-50 bg-purple-600 text-white flex items-center space-x-3';
                        notification.innerHTML = `
                            <i data-feather="check" class="w-5 h-5"></i>
                            <span>Code copied to clipboard!</span>
                        ';
                        document.body.appendChild(notification);
                        feather.replace();
                        
                        anime({
                            targets: notification,
                            translateX: [100, 0],
                            opacity: [0, 1],
                            duration: 500,
                            easing: 'easeOutExpo'
                        });
                        
                        setTimeout(() => {
                            anime({
                                targets: notification,
                                translateX: 100,
                                opacity: 0,
                                duration: 500,
                                easing: 'easeInExpo',
                                complete: function() {
                                    notification.remove();
                                }
                            });
                        }, 2000);
                    });
                });
            });
        });
    </script>
</body>
</html>