Spaces:
Running
Running
acecalisto3
commited on
Commit
•
b5b1fe8
1
Parent(s):
8747c7a
Update index.html
Browse files- index.html +31 -9
index.html
CHANGED
@@ -1,19 +1,41 @@
|
|
1 |
-
<!doctype html>
|
2 |
<html>
|
3 |
<head>
|
4 |
<meta charset="utf-8" />
|
5 |
<meta name="viewport" content="width=device-width" />
|
6 |
-
<title>
|
7 |
<link rel="stylesheet" href="style.css" />
|
8 |
</head>
|
9 |
<body>
|
10 |
<div class="card">
|
11 |
-
<h1>
|
12 |
-
<
|
13 |
-
|
14 |
-
|
15 |
-
<
|
16 |
-
</
|
|
|
17 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
</body>
|
19 |
-
</html>
|
|
|
|
|
1 |
<html>
|
2 |
<head>
|
3 |
<meta charset="utf-8" />
|
4 |
<meta name="viewport" content="width=device-width" />
|
5 |
+
<title>Blackbox API</title>
|
6 |
<link rel="stylesheet" href="style.css" />
|
7 |
</head>
|
8 |
<body>
|
9 |
<div class="card">
|
10 |
+
<h1>Blackbox API</h1>
|
11 |
+
<form id="prompt-form">
|
12 |
+
<label for="prompt">Enter a prompt:</label><br>
|
13 |
+
<input type="text" id="prompt" name="prompt" value="How are you?"><br>
|
14 |
+
<input type="submit" value="Submit">
|
15 |
+
</form>
|
16 |
+
<div id="response"></div>
|
17 |
</div>
|
18 |
+
|
19 |
+
<script>
|
20 |
+
const form = document.getElementById("prompt-form");
|
21 |
+
const promptInput = document.getElementById("prompt");
|
22 |
+
const responseDiv = document.getElementById("response");
|
23 |
+
|
24 |
+
form.addEventListener("submit", async (event) => {
|
25 |
+
event.preventDefault();
|
26 |
+
|
27 |
+
const prompt = promptInput.value;
|
28 |
+
const url = `https://api.kastg.xyz/api/ai/blackbox?prompt=${encodeURIComponent(prompt)}&web_search=false`;
|
29 |
+
|
30 |
+
try {
|
31 |
+
const response = await fetch(url);
|
32 |
+
const data = await response.json();
|
33 |
+
|
34 |
+
responseDiv.innerHTML = `<pre>${JSON.stringify(data, null, 2)}</pre>`;
|
35 |
+
} catch (error) {
|
36 |
+
responseDiv.innerHTML = `<pre>Error: ${error.message}</pre>`;
|
37 |
+
}
|
38 |
+
});
|
39 |
+
</script>
|
40 |
</body>
|
41 |
+
</html>
|