Spaces:
Paused
Paused
dr-data
Fix preview component: eliminate blinking, ensure HTML updates, add smooth transitions
dcd5e1d | <html> | |
| <head> | |
| <title>OpenRouter API Test</title> | |
| </head> | |
| <body> | |
| <h1>OpenRouter API Test</h1> | |
| <button onclick="testAPI()">Test API</button> | |
| <div id="result"></div> | |
| <script> | |
| async function testAPI() { | |
| const resultDiv = document.getElementById('result'); | |
| resultDiv.innerHTML = 'Testing...'; | |
| try { | |
| console.log('Testing OpenRouter API...'); | |
| const response = await fetch('/api/openrouter/models'); | |
| console.log('Response status:', response.status); | |
| const data = await response.json(); | |
| console.log('Response data:', data); | |
| if (data.success) { | |
| resultDiv.innerHTML = ` | |
| <h2>Success!</h2> | |
| <p>Loaded ${data.data.length} models</p> | |
| <pre>${JSON.stringify(data.data.slice(0, 3), null, 2)}</pre> | |
| `; | |
| } else { | |
| resultDiv.innerHTML = ` | |
| <h2>Error!</h2> | |
| <p>${data.error}</p> | |
| `; | |
| } | |
| } catch (error) { | |
| console.error('Error:', error); | |
| resultDiv.innerHTML = ` | |
| <h2>Network Error!</h2> | |
| <p>${error.message}</p> | |
| `; | |
| } | |
| } | |
| </script> | |
| </body> | |
| </html> | |