Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>FEI-Next - API Explorer</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://unpkg.com/feather-icons"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.net.min.js"></script> | |
| <style> | |
| .api-endpoint { | |
| transition: all 0.3s ease; | |
| cursor: pointer; | |
| } | |
| .api-endpoint:hover { | |
| transform: translateY(-2px); | |
| box-shadow: 0 8px 16px -8px rgba(74, 144, 226, 0.3); | |
| } | |
| .response-area { | |
| font-family: 'Courier New', monospace; | |
| background: #1a202c; | |
| border: 1px solid #2d3748; | |
| } | |
| .method-get { border-left: 4px solid #10b981; } | |
| .method-post { border-left: 4px solid #3b82f6; } | |
| .method-put { border-left: 4px solid #f59e0b; } | |
| .method-delete { border-left: 4px solid #ef4444; } | |
| </style> | |
| </head> | |
| <body class="bg-gray-900 text-gray-100 font-sans overflow-x-hidden"> | |
| <div id="vanta-bg" class="fixed inset-0 -z-10 opacity-20"></div> | |
| <header class="gradient-mask px-6 py-8"> | |
| <div class="max-w-6xl mx-auto flex flex-col md:flex-row justify-between items-center"> | |
| <div class="flex items-center mb-6 md:mb-0"> | |
| <div class="relative"> | |
| <div class="absolute -inset-4 bg-blue-500 rounded-full opacity-20 blur-md"></div> | |
| <div class="relative bg-gradient-to-br from-blue-600 to-indigo-800 w-12 h-12 rounded-2xl flex items-center justify-center"> | |
| <i data-feather="code" class="w-6 h-6"></i> | |
| </div> | |
| <h1 class="ml-4 text-2xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-blue-400 to-indigo-300"> | |
| API Explorer | |
| </h1> | |
| </div> | |
| <nav class="flex space-x-6"> | |
| <a href="index.html" class="text-gray-400 hover:text-blue-300 transition-colors flex items-center"> | |
| <i data-feather="home" class="w-4 h-4 mr-2"></i> | |
| Home | |
| </a> | |
| <a href="explore.html" class="text-gray-400 hover:text-blue-300 transition-colors flex items-center"> | |
| <i data-feather="compass" class="w-4 h-4 mr-2"></i> | |
| Explore | |
| </a> | |
| </nav> | |
| </div> | |
| </header> | |
| <main class="max-w-6xl mx-auto px-6 pb-20"> | |
| <div class="grid grid-cols-1 lg:grid-cols-3 gap-8"> | |
| <!-- API Methods --> | |
| <div class="lg:col-span-2 space-y-6"> | |
| <!-- GET Method --> | |
| <div class="api-endpoint bg-gray-800/30 backdrop-blur-md rounded-2xl p-6 border border-gray-700/50"> | |
| <div class="flex items-center mb-4"> | |
| <span class="px-3 py-1 rounded-full text-xs font-medium bg-green-900/50 text-green-300 border border-green-700/50 method-get p-4"> | |
| <div class="flex items-center"> | |
| <span class="px-2 py-1 rounded text-xs font-bold text-white bg-green-600 mr-3"> | |
| GET | |
| </span> | |
| <code class="text-blue-300">/api/cognitive-data</code> | |
| </div> | |
| <p class="text-gray-300 mb-4">Retrieve cognitive patterns and reasoning traces</p> | |
| <div class="flex space-x-3"> | |
| <button onclick="testGetAPI()" class="px-4 py-2 bg-green-600 hover:bg-green-500 rounded-lg text-white text-sm transition-colors" id="get-button"> | |
| <span class="flex items-center"> | |
| <span>Test Endpoint</span> | |
| <i data-feather="play" class="w-3 h-3 ml-2"></i> | |
| </button> | |
| <button onclick="showDocumentation('get')" class="px-4 py-2 bg-gray-600 hover:bg-gray-500 rounded-lg text-gray-300 text-sm transition-colors"> | |
| Documentation | |
| </button> | |
| </div> | |
| <div class="response-area mt-4 p-4 rounded-lg text-sm hidden" id="get-response"> | |
| <div class="flex justify-between items-center mb-2"> | |
| <span class="text-green-400">✓ Success</span> | |
| <span class="text-xs text-gray-400">Response will appear here</span> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- POST Method --> | |
| <div class="api-endpoint bg-gray-800/30 backdrop-blur-md rounded-2xl p-6 border border-gray-700/50"> | |
| <div class="flex items-center mb-4"> | |
| <span class="px-2 py-1 rounded text-xs font-bold text-white bg-blue-600 mr-3"> | |
| POST | |
| </span> | |
| <code class="text-blue-300">/api/cognitive-analysis</code> | |
| </div> | |
| <p class="text-gray-300 mb-4">Submit new cognitive data for analysis</p> | |
| <div class="flex space-x-3"> | |
| <button onclick="testPostAPI()" class="px-4 py-2 bg-blue-600 hover:bg-blue-500 rounded-lg text-white text-sm transition-colors"> | |
| <span class="flex items-center"> | |
| <span>Test Endpoint</span> | |
| <i data-feather="play" class="w-3 h-3 ml-2"></i> | |
| </button> | |
| <button onclick="showDocumentation('post')" class="px-4 py-2 bg-gray-600 hover:bg-gray-500 rounded-lg text-gray-300 text-sm transition-colors"> | |
| Documentation | |
| </button> | |
| </div> | |
| <div class="response-area mt-4 p-4 rounded-lg text-sm hidden" id="post-response"> | |
| <div class="flex justify-between items-center mb-2"> | |
| <span class="text-blue-400">↗ Submit</span> | |
| </div> | |
| </div> | |
| <!-- Control Panel --> | |
| <div class="lg:col-span-1 bg-gray-800/30 backdrop-blur-md rounded-2xl p-6 border border-gray-700/50"> | |
| <h3 class="text-lg font-bold mb-4">API Controls</h3> | |
| <div class="space-y-4"> | |
| <div> | |
| <label class="block text-sm text-gray-400 mb-2">Environment</label> | |
| <select class="w-full bg-gray-700/50 border border-gray-600/50 rounded-lg px-3 py-2 text-sm"> | |
| <option>Development</option> | |
| <option>Staging</option> | |
| <option>Production</option> | |
| </select> | |
| </div> | |
| <div> | |
| <label class="block text-sm text-gray-400 mb-2">Response Format</label> | |
| <select class="w-full bg-gray-700/50 border border-gray-600/50 rounded-lg px-3 py-2 text-sm"> | |
| <option>JSON</option> | |
| <option>XML</option> | |
| <option>YAML</option> | |
| </select> | |
| </div> | |
| <button onclick="clearAllResponses()" class="w-full px-4 py-2 bg-gray-600 hover:bg-gray-500 rounded-lg text-gray-300 text-sm transition-colors"> | |
| Clear All Responses | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| <footer class="border-t border-gray-800 py-8 mt-12"> | |
| <div class="max-w-6xl mx-auto px-6"> | |
| <div class="flex flex-col md:flex-row justify-between items-center"> | |
| <div class="flex items-center mb-4 md:mb-0"> | |
| <i data-feather="activity" class="w-5 h-5 text-blue-400 mr-2"></i> | |
| <span class="text-sm text-gray-400">FEI-Next API Explorer v1.0</span> | |
| </div> | |
| <div class="flex space-x-6"> | |
| <a href="index.html" class="text-gray-400 hover:text-blue-300 transition-colors"> | |
| <i data-feather="home"></i> | |
| </a> | |
| <a href="explore.html" class="text-gray-400 hover:text-blue-300 transition-colors"> | |
| <i data-feather="compass"></i> | |
| </a> | |
| </div> | |
| </div> | |
| </div> | |
| </footer> | |
| <script> | |
| // Initialize Vanta.js background | |
| if (typeof VANTA !== 'undefined') { | |
| VANTA.NET({ | |
| el: "#vanta-bg", | |
| mouseControls: true, | |
| touchControls: true, | |
| gyroControls: false, | |
| color: 0x3b82f6, | |
| backgroundColor: 0x111827, | |
| points: 12, | |
| maxDistance: 20, | |
| spacing: 18 | |
| }); | |
| } | |
| // Initialize feather icons | |
| feather.replace(); | |
| // API testing functions | |
| window.testGetAPI = async () => { | |
| const button = document.getElementById('get-button'); | |
| const responseArea = document.getElementById('get-response'); | |
| // Show loading state | |
| responseArea.classList.remove('hidden'); | |
| responseArea.innerHTML = ` | |
| <div class="flex justify-between items-center mb-2"> | |
| <span class="text-blue-400">⏳ Loading...</span> | |
| `; | |
| try { | |
| const response = await fetch('https://jsonplaceholder.typicode.com/posts/1'); | |
| const data = await response.json(); | |
| responseArea.innerHTML = ` | |
| <div class="flex justify-between items-center mb-2"> | |
| <span class="text-green-400">✓ Success</span> | |
| <span class="text-xs text-gray-400">Status: ${response.status}</span> | |
| </div> | |
| <pre class="text-green-300 overflow-auto">${JSON.stringify(data, null, 2)}</pre> | |
| `; | |
| } catch (error) { | |
| responseArea.innerHTML = ` | |
| <div class="flex justify-between items-center mb-2"> | |
| <span class="text-red-400">✗ Error</span> | |
| </div> | |
| <pre class="text-red-300">Request failed: ${error.message}</pre> | |
| `; | |
| } | |
| }; | |
| window.testPostAPI = async () => { | |
| const responseArea = document.getElementById('post-response'); | |
| // Show loading state | |
| responseArea.classList.remove('hidden'); | |
| responseArea.innerHTML = ` | |
| <div class="flex justify-between items-center mb-2"> | |
| <span class="text-blue-400">⏳ Processing...</span> | |
| `; | |
| try { | |
| const response = await fetch('https://jsonplaceholder.typicode.com/posts', { | |
| method: 'POST', | |
| headers: { | |
| 'Content-Type': 'application/json' | |
| }, | |
| body: JSON.stringify({ | |
| title: 'Cognitive Analysis Request', | |
| body: 'Analyze this thought pattern for reasoning traces', | |
| userId: 1 | |
| }) | |
| }); | |
| const data = await response.json(); | |
| responseArea.innerHTML = ` | |
| <div class="flex justify-between items-center mb-2"> | |
| <span class="text-green-400">✓ Success</span> | |
| <span class="text-xs text-gray-400">Status: ${response.status}</span> | |
| </div> | |
| <pre class="text-green-300 overflow-auto">${JSON.stringify(data, null, 2)}</pre> | |
| `; | |
| } catch (error) { | |
| responseArea.innerHTML = ` | |
| <div class="flex justify-between items-center mb-2"> | |
| <span class="text-green-400">✓ Created</span> | |
| </div> | |
| <pre class="text-green-300">Request failed: ${error.message}</pre> | |
| `; | |
| } | |
| }; | |
| window.showDocumentation = (method) => { | |
| const overlay = document.createElement('div'); | |
| overlay.className = 'fixed inset-0 bg-gray-900/90 backdrop-blur-md z-50 flex items-center justify-center p-8'; | |
| overlay.innerHTML = ` | |
| <div class="relative max-w-4xl w-full bg-gray-800 rounded-2xl p-8 border border-gray-700 max-h-[90vh] overflow-auto"> | |
| <button class="absolute top-4 right-4 text-gray-400 hover:text-white"> | |
| <i data-feather="x"></i> | |
| </button> | |
| <h3 class="text-xl font-bold mb-4">${method.toUpperCase()} API Documentation</h3> | |
| <div class="space-y-4"> | |
| <div class="p-4 bg-gray-700/50 rounded-lg"> | |
| <h4 class="font-medium mb-2">Endpoint</h4> | |
| <code class="bg-gray-600 p-2 rounded text-sm block"> | |
| /api/cognitive-${method === 'get' ? 'data' : 'analysis'}</code> | |
| <div class="p-4 bg-gray-700/50 rounded-lg"> | |
| <h4 class="font-medium mb-2">Description</h4> | |
| <p class="text-gray-300"> | |
| ${method === 'get' ? | |
| 'Retrieve cognitive patterns and reasoning traces from the system.' : | |
| 'Submit new cognitive data for analysis and pattern recognition.'} | |
| </p> | |
| </div> | |
| </div> | |
| `; | |
| document.body.appendChild(overlay); | |
| feather.replace(); | |
| // Add close handler | |
| overlay.querySelector('button').addEventListener('click', () => { | |
| overlay.remove(); | |
| }); | |
| }; | |
| window.clearAllResponses = () => { | |
| document.querySelectorAll('.response-area').forEach(area => { | |
| area.classList.add('hidden'); | |
| area.innerHTML = ''; | |
| }); | |
| }; | |
| </script> | |
| </body> | |
| </html> |