Spaces:
Running
Running
File size: 1,198 Bytes
82769ca b5b1fe8 82769ca b5b1fe8 82769ca b5b1fe8 82769ca b5b1fe8 |
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 |
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Blackbox API</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="card">
<h1>Blackbox API</h1>
<form id="prompt-form">
<label for="prompt">Enter a prompt:</label><br>
<input type="text" id="prompt" name="prompt" value="How are you?"><br>
<input type="submit" value="Submit">
</form>
<div id="response"></div>
</div>
<script>
const form = document.getElementById("prompt-form");
const promptInput = document.getElementById("prompt");
const responseDiv = document.getElementById("response");
form.addEventListener("submit", async (event) => {
event.preventDefault();
const prompt = promptInput.value;
const url = `https://api.kastg.xyz/api/ai/blackbox?prompt=${encodeURIComponent(prompt)}&web_search=false`;
try {
const response = await fetch(url);
const data = await response.json();
responseDiv.innerHTML = `<pre>${JSON.stringify(data, null, 2)}</pre>`;
} catch (error) {
responseDiv.innerHTML = `<pre>Error: ${error.message}</pre>`;
}
});
</script>
</body>
</html> |