Spaces:
Running

undefined / backend.html
Marwuko's picture
add the backend
5e523a1 verified
Raw History Blame Contribute Delete
16 kB
<!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>