Spaces:
Running
Running
Commit
·
afde003
1
Parent(s):
8c33c2b
Idk
Browse files- index.html +78 -18
index.html
CHANGED
@@ -1,19 +1,79 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Simple Chat App</title>
|
7 |
+
<style>
|
8 |
+
body {
|
9 |
+
font-family: 'Arial', sans-serif;
|
10 |
+
background-color: #f4f4f4;
|
11 |
+
margin: 0;
|
12 |
+
padding: 20px;
|
13 |
+
text-align: center;
|
14 |
+
}
|
15 |
+
|
16 |
+
#chat-container {
|
17 |
+
max-width: 400px;
|
18 |
+
margin: auto;
|
19 |
+
background-color: #fff;
|
20 |
+
padding: 20px;
|
21 |
+
border-radius: 8px;
|
22 |
+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
23 |
+
}
|
24 |
+
|
25 |
+
input {
|
26 |
+
width: 80%;
|
27 |
+
padding: 8px;
|
28 |
+
margin: 10px 0;
|
29 |
+
box-sizing: border-box;
|
30 |
+
}
|
31 |
+
|
32 |
+
button {
|
33 |
+
width: 80%;
|
34 |
+
padding: 10px;
|
35 |
+
background-color: #3498db;
|
36 |
+
color: #fff;
|
37 |
+
border: none;
|
38 |
+
border-radius: 4px;
|
39 |
+
cursor: pointer;
|
40 |
+
}
|
41 |
+
|
42 |
+
#chat-output {
|
43 |
+
text-align: left;
|
44 |
+
margin-top: 20px;
|
45 |
+
}
|
46 |
+
</style>
|
47 |
+
</head>
|
48 |
+
<body>
|
49 |
+
<div id="chat-container">
|
50 |
+
<h2>Simple Chat App</h2>
|
51 |
+
<input type="text" id="user-input" placeholder="Type your message...">
|
52 |
+
<button onclick="sendMessage()">Send</button>
|
53 |
+
<div id="chat-output"></div>
|
54 |
+
</div>
|
55 |
+
|
56 |
+
<script>
|
57 |
+
function sendMessage() {
|
58 |
+
const userInput = document.getElementById('user-input').value;
|
59 |
+
const chatOutput = document.getElementById('chat-output');
|
60 |
+
|
61 |
+
// Make a simple fetch request to the chat API
|
62 |
+
fetch('https://pro-ai.glitch.me/api-chat', {
|
63 |
+
method: 'POST',
|
64 |
+
headers: {
|
65 |
+
'Content-Type': 'application/json',
|
66 |
+
},
|
67 |
+
body: JSON.stringify({ input: userInput }),
|
68 |
+
})
|
69 |
+
.then(response => response.json())
|
70 |
+
.then(data => {
|
71 |
+
// Display the response in the chat output
|
72 |
+
chatOutput.innerHTML += `<p><strong>User:</strong> ${userInput}</p>`;
|
73 |
+
chatOutput.innerHTML += `<p><strong>AI:</strong> ${data.response}</p>`;
|
74 |
+
})
|
75 |
+
.catch(error => console.error('Error:', error));
|
76 |
+
}
|
77 |
+
</script>
|
78 |
+
</body>
|
79 |
+
</html>
|