Spaces:
Build error
Build error
Update index.html
Browse files- index.html +144 -212
index.html
CHANGED
@@ -1,212 +1,144 @@
|
|
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>Shanks-1.1</title>
|
7 |
-
<style>
|
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 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
</
|
106 |
-
|
107 |
-
|
108 |
-
</
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
fetch('/get_response', {
|
147 |
-
method: 'POST',
|
148 |
-
headers: {
|
149 |
-
'Content-Type': 'application/x-www-form-urlencoded'
|
150 |
-
},
|
151 |
-
body: `user_input=${userInput}`
|
152 |
-
})
|
153 |
-
.then(response => response.json())
|
154 |
-
.then(data => {
|
155 |
-
appendMessage(data.response, 'bot');
|
156 |
-
});
|
157 |
-
}
|
158 |
-
|
159 |
-
// Allow pressing "Enter" to send the message
|
160 |
-
document.getElementById('user-input').addEventListener('keypress', function(e) {
|
161 |
-
if (e.key === 'Enter') {
|
162 |
-
sendMessage();
|
163 |
-
}
|
164 |
-
});
|
165 |
-
</script>
|
166 |
-
|
167 |
-
<script>
|
168 |
-
function appendMessage(message, sender) {
|
169 |
-
const chatBox = document.getElementById('chat-box');
|
170 |
-
const messageDiv = document.createElement('div');
|
171 |
-
messageDiv.classList.add('message', sender);
|
172 |
-
messageDiv.textContent = message;
|
173 |
-
chatBox.appendChild(messageDiv);
|
174 |
-
chatBox.scrollTop = chatBox.scrollHeight;
|
175 |
-
|
176 |
-
// Remove typing demo once a message is sent
|
177 |
-
const typingDemo = document.querySelector('.typing-demo');
|
178 |
-
if (typingDemo) {
|
179 |
-
typingDemo.style.display = 'none';
|
180 |
-
}
|
181 |
-
}
|
182 |
-
|
183 |
-
function sendMessage() {
|
184 |
-
const userInput = document.getElementById('user-input').value;
|
185 |
-
if (!userInput.trim()) return;
|
186 |
-
|
187 |
-
appendMessage(userInput, 'user');
|
188 |
-
document.getElementById('user-input').value = '';
|
189 |
-
|
190 |
-
fetch('/get_response', {
|
191 |
-
method: 'POST',
|
192 |
-
headers: {
|
193 |
-
'Content-Type': 'application/x-www-form-urlencoded'
|
194 |
-
},
|
195 |
-
body: `user_input=${userInput}`
|
196 |
-
})
|
197 |
-
.then(response => response.json())
|
198 |
-
.then(data => {
|
199 |
-
appendMessage(data.response, 'bot');
|
200 |
-
});
|
201 |
-
}
|
202 |
-
|
203 |
-
// Allow pressing "Enter" to send the message
|
204 |
-
document.getElementById('user-input').addEventListener('keypress', function(e) {
|
205 |
-
if (e.key === 'Enter') {
|
206 |
-
sendMessage();
|
207 |
-
}
|
208 |
-
});
|
209 |
-
</script>
|
210 |
-
|
211 |
-
</body>
|
212 |
-
</html>
|
|
|
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>Shanks-1.1</title>
|
7 |
+
<style>
|
8 |
+
body {
|
9 |
+
font-family: Arial, sans-serif;
|
10 |
+
display: flex;
|
11 |
+
justify-content: center;
|
12 |
+
align-items: center;
|
13 |
+
height: 100vh;
|
14 |
+
background-color: #f0f0f0;
|
15 |
+
margin: 0;
|
16 |
+
}
|
17 |
+
|
18 |
+
.chat-container {
|
19 |
+
background-color: #fff;
|
20 |
+
width: 100%;
|
21 |
+
max-width: 400px;
|
22 |
+
height: 600px;
|
23 |
+
border-radius: 10px;
|
24 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
25 |
+
display: flex;
|
26 |
+
flex-direction: column;
|
27 |
+
}
|
28 |
+
|
29 |
+
.chat-box {
|
30 |
+
flex: 1;
|
31 |
+
padding: 20px;
|
32 |
+
overflow-y: auto;
|
33 |
+
border-bottom: 1px solid #ddd;
|
34 |
+
}
|
35 |
+
|
36 |
+
.chat-input {
|
37 |
+
display: flex;
|
38 |
+
border-top: 1px solid #ddd;
|
39 |
+
padding: 10px;
|
40 |
+
}
|
41 |
+
|
42 |
+
.input-field {
|
43 |
+
flex: 1;
|
44 |
+
padding: 10px;
|
45 |
+
border-radius: 15px;
|
46 |
+
border: 1px solid #ddd;
|
47 |
+
margin-right: 10px;
|
48 |
+
}
|
49 |
+
|
50 |
+
.send-button {
|
51 |
+
padding: 10px 20px;
|
52 |
+
background-color: #4CAF50;
|
53 |
+
color: white;
|
54 |
+
border: none;
|
55 |
+
border-radius: 15px;
|
56 |
+
cursor: pointer;
|
57 |
+
}
|
58 |
+
|
59 |
+
.message {
|
60 |
+
margin-bottom: 10px;
|
61 |
+
}
|
62 |
+
|
63 |
+
.message.user {
|
64 |
+
text-align: right;
|
65 |
+
font-weight: bold;
|
66 |
+
}
|
67 |
+
|
68 |
+
.message.bot {
|
69 |
+
text-align: left;
|
70 |
+
color: #555;
|
71 |
+
}
|
72 |
+
|
73 |
+
@keyframes typing {
|
74 |
+
from {
|
75 |
+
width: 0;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
@keyframes blink-caret {
|
80 |
+
from, to {
|
81 |
+
border-color: transparent;
|
82 |
+
}
|
83 |
+
50% {
|
84 |
+
border-color: black;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
.typing-demo {
|
89 |
+
width: 50ch;
|
90 |
+
white-space: nowrap;
|
91 |
+
overflow: hidden;
|
92 |
+
border-right: 3px solid black;
|
93 |
+
font-family: Courier, Monaco, monospace;
|
94 |
+
animation: typing 4s steps(44) 1s infinite normal both, blink-caret 0.75s step-end infinite;
|
95 |
+
}
|
96 |
+
</style>
|
97 |
+
</head>
|
98 |
+
<body>
|
99 |
+
|
100 |
+
<div class="chat-container">
|
101 |
+
<div class="chat-box" id="chat-box">
|
102 |
+
<div class="typing-demo">
|
103 |
+
Welcome to Shanks-1.1 from Motaunginc, what can I do for you today?
|
104 |
+
</div>
|
105 |
+
</div>
|
106 |
+
<div class="chat-input">
|
107 |
+
<input type="text" id="user-input" class="input-field" placeholder="Type your message...">
|
108 |
+
<button class="send-button" onclick="sendMessage()">Send</button>
|
109 |
+
</div>
|
110 |
+
</div>
|
111 |
+
|
112 |
+
<script>
|
113 |
+
function sendMessage() {
|
114 |
+
const userInput = document.getElementById('user-input').value;
|
115 |
+
fetch('/generate', {
|
116 |
+
method: 'POST',
|
117 |
+
headers: {
|
118 |
+
'Content-Type': 'application/x-www-form-urlencoded'
|
119 |
+
},
|
120 |
+
body: `user_input=${userInput}`
|
121 |
+
})
|
122 |
+
.then(response => response.json())
|
123 |
+
.then(data => {
|
124 |
+
const message = document.createElement('div');
|
125 |
+
message.classList.add('message', 'bot');
|
126 |
+
message.textContent = data.response || "Error generating response";
|
127 |
+
document.querySelector('.chat-box').appendChild(message);
|
128 |
+
document.querySelector('.chat-box').scrollTop = document.querySelector('.chat-box').scrollHeight;
|
129 |
+
});
|
130 |
+
|
131 |
+
const typingDemo = document.querySelector('.typing-demo');
|
132 |
+
if (typingDemo) {
|
133 |
+
typingDemo.style.display = 'none';
|
134 |
+
}
|
135 |
+
}
|
136 |
+
|
137 |
+
document.getElementById('user-input').addEventListener('keypress', function(e) {
|
138 |
+
if (e.key === 'Enter') {
|
139 |
+
sendMessage();
|
140 |
+
}
|
141 |
+
});
|
142 |
+
</script>
|
143 |
+
</body>
|
144 |
+
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|