sf-b30 / index.html
acecalisto3's picture
Update index.html
b5b1fe8 verified
<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>