Spaces:
Running
Running
Utkarsh Verma
commited on
Commit
ยท
8891be8
1
Parent(s):
6075594
Some changes in the UI
Browse files- templates/index.html +126 -1
templates/index.html
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8" />
|
@@ -171,4 +171,129 @@
|
|
171 |
</script>
|
172 |
|
173 |
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
</html>
|
|
|
1 |
+
<!-- <!DOCTYPE html>
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8" />
|
|
|
171 |
</script>
|
172 |
|
173 |
</body>
|
174 |
+
</html> -->
|
175 |
+
|
176 |
+
|
177 |
+
<!DOCTYPE html>
|
178 |
+
<html lang="en">
|
179 |
+
<head>
|
180 |
+
<meta charset="UTF-8">
|
181 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
182 |
+
<title>Apollo Tyres AI Assistant</title>
|
183 |
+
<style>
|
184 |
+
body {
|
185 |
+
font-family: 'Segoe UI', sans-serif;
|
186 |
+
background-color: #f2f2f2;
|
187 |
+
margin: 0;
|
188 |
+
padding: 0;
|
189 |
+
}
|
190 |
+
header {
|
191 |
+
display: flex;
|
192 |
+
justify-content: center;
|
193 |
+
align-items: center;
|
194 |
+
padding: 20px;
|
195 |
+
background-color: white;
|
196 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
197 |
+
}
|
198 |
+
header img {
|
199 |
+
height: 40px;
|
200 |
+
margin-right: 10px;
|
201 |
+
}
|
202 |
+
header h1 {
|
203 |
+
font-size: 1.8rem;
|
204 |
+
color: #4B0082;
|
205 |
+
margin: 0;
|
206 |
+
}
|
207 |
+
#chat-box {
|
208 |
+
width: 90%;
|
209 |
+
max-width: 1000px;
|
210 |
+
height: 600px;
|
211 |
+
margin: 20px auto;
|
212 |
+
padding: 15px;
|
213 |
+
background: white;
|
214 |
+
border-radius: 10px;
|
215 |
+
box-shadow: 0 0 10px rgba(0,0,0,0.2);
|
216 |
+
overflow-y: auto;
|
217 |
+
}
|
218 |
+
#user-input {
|
219 |
+
width: 70%;
|
220 |
+
padding: 10px;
|
221 |
+
font-size: 1rem;
|
222 |
+
}
|
223 |
+
button {
|
224 |
+
padding: 10px 20px;
|
225 |
+
font-size: 1rem;
|
226 |
+
background-color: #4B0082;
|
227 |
+
color: white;
|
228 |
+
border: none;
|
229 |
+
cursor: pointer;
|
230 |
+
margin-left: 10px;
|
231 |
+
}
|
232 |
+
#controls {
|
233 |
+
display: flex;
|
234 |
+
justify-content: center;
|
235 |
+
align-items: center;
|
236 |
+
margin-bottom: 20px;
|
237 |
+
}
|
238 |
+
</style>
|
239 |
+
</head>
|
240 |
+
<body>
|
241 |
+
<header>
|
242 |
+
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/5/5a/Apollo_Tyres_Logo.svg/512px-Apollo_Tyres_Logo.svg.png" alt="Apollo Tyres Logo">
|
243 |
+
<h1>Apollo Tyres AI Assistant ๐ง </h1>
|
244 |
+
</header>
|
245 |
+
|
246 |
+
<div id="chat-box">
|
247 |
+
<p><b>Apollo AI:</b> ๐ Hello! Iโm your Apollo Tyres virtual assistant. How can I help you today?</p>
|
248 |
+
</div>
|
249 |
+
|
250 |
+
<div id="controls">
|
251 |
+
<input type="text" id="user-input" placeholder="Type your message...">
|
252 |
+
<button onclick="sendMessage()">Send</button>
|
253 |
+
<button onclick="clearChat()">Clear</button>
|
254 |
+
<button onclick="exportChat()">Export</button>
|
255 |
+
</div>
|
256 |
+
|
257 |
+
<script>
|
258 |
+
const chatBox = document.getElementById("chat-box");
|
259 |
+
|
260 |
+
async function sendMessage() {
|
261 |
+
let userInput = document.getElementById("user-input").value;
|
262 |
+
if (!userInput.trim()) return;
|
263 |
+
|
264 |
+
chatBox.innerHTML += `<p><b>You:</b> ${userInput}</p>`;
|
265 |
+
|
266 |
+
const response = await fetch("/chat", {
|
267 |
+
method: "POST",
|
268 |
+
headers: { "Content-Type": "application/json" },
|
269 |
+
body: JSON.stringify({ message: userInput }),
|
270 |
+
});
|
271 |
+
|
272 |
+
const data = await response.json();
|
273 |
+
chatBox.innerHTML += `<p><b>Apollo AI:</b> ${data.reply || "Error in response"}</p>`;
|
274 |
+
document.getElementById("user-input").value = "";
|
275 |
+
|
276 |
+
// Auto-scroll
|
277 |
+
chatBox.scrollTop = chatBox.scrollHeight;
|
278 |
+
}
|
279 |
+
|
280 |
+
function clearChat() {
|
281 |
+
chatBox.innerHTML = `<p><b>Apollo AI:</b> ๐ Hello! Iโm your Apollo Tyres virtual assistant. How can I help you today?</p>`;
|
282 |
+
}
|
283 |
+
|
284 |
+
function exportChat() {
|
285 |
+
const text = chatBox.innerText;
|
286 |
+
const blob = new Blob([text], { type: "text/plain" });
|
287 |
+
const a = document.createElement("a");
|
288 |
+
a.href = URL.createObjectURL(blob);
|
289 |
+
a.download = "apollo_chat_history.txt";
|
290 |
+
a.click();
|
291 |
+
}
|
292 |
+
|
293 |
+
// Allow Enter key to send message
|
294 |
+
document.getElementById("user-input").addEventListener("keydown", function (e) {
|
295 |
+
if (e.key === "Enter") sendMessage();
|
296 |
+
});
|
297 |
+
</script>
|
298 |
+
</body>
|
299 |
</html>
|