Adieee5 commited on
Commit
5400ea9
·
verified ·
1 Parent(s): 29b6f9e
Files changed (1) hide show
  1. templates/chat.html +50 -15
templates/chat.html CHANGED
@@ -75,7 +75,9 @@
75
  <div class="card-footer" style="position: relative;">
76
  <form id="messageArea" class="input-group" style="position: relative;">
77
  <!-- Predictive Text Suggestions (ADD THIS HERE) -->
78
- <div class="predictive-text" style="position: absolute; background: white; border: 1px solid #ccc; display: none; z-index: 1000; width: 100%;"></div>
 
 
79
 
80
  <input type="text" id="text" name="msg" placeholder="Type your message..." autocomplete="off"
81
  class="form-control type_msg" required />
@@ -87,7 +89,27 @@
87
  </form>
88
  <button id="clearChat" class="btn btn-danger mt-2">Clear Chat</button>
89
 
90
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
  </div>
93
  </div>
@@ -160,7 +182,7 @@
160
 
161
  var userHtml = `
162
  <div class="d-flex justify-content-end mb-4">
163
- <div class="msg_cotainer_send">${rawText}
164
  <span class="msg_time_send">${str_time}</span>
165
  </div>
166
  <div class="img_cont_msg">
@@ -186,7 +208,7 @@
186
  // Append user message to chat
187
  let userHtml = `
188
  <div class="d-flex justify-content-end mb-4">
189
- <div class="msg_cotainer_send">${rawText}<span class="msg_time_send">${time}</span></div>
190
  <div class="img_cont_msg"><img src="https://i.ibb.co/d5b84Xw/Untitled-design.png" class="rounded-circle user_img_msg"></div>
191
  </div>`;
192
  $("#messageFormeight").append(userHtml);
@@ -211,7 +233,7 @@
211
  <div class="img_cont_msg">
212
  <img src="/static/juitlogo.png" class="rounded-circle user_img_msg">
213
  </div>
214
- <div class="msg_cotainer">${response}<span class="msg_time">${time}</span></div>
215
  </div>`;
216
 
217
  $("#messageFormeight").append($.parseHTML(botHtml));
@@ -241,10 +263,10 @@
241
  url: "/get",
242
  }).done(function(data) {
243
  var lines = data.split("**");
244
- var botHtml = '<div class="d-flex justify-content-start mb-4"><div class="img_cont_msg"><img src="/static/juitlogo.png" class="rounded-circle user_img_msg"></div><div class="msg_cotainer">';
245
 
246
  for (var i = 0; i < lines.length; i++) {
247
- botHtml += '<div class="msg_cotainer">' + lines[i] + '</div>';
248
  }
249
  botHtml += '<span class="msg_time">' + str_time + '</span></div></div>';
250
  $("#messageFormeight").append($.parseHTML(botHtml));
@@ -262,30 +284,43 @@
262
  <script>
263
  document.addEventListener("DOMContentLoaded", () => {
264
  const themeToggle = document.getElementById("themeToggle");
265
- if (!themeToggle) return; // Prevent errors if button is missing
266
-
267
  const body = document.body;
268
 
269
  // Check local storage for a saved theme, default to dark
270
  const savedTheme = localStorage.getItem("theme") || "dark";
271
- body.classList.toggle("light-mode", savedTheme === "light");
 
 
 
 
 
 
272
 
273
  updateButton(); // Update button text on load
274
 
275
  // Toggle theme on button click
276
  themeToggle.addEventListener("click", () => {
277
- body.classList.toggle("light-mode");
278
- const newTheme = body.classList.contains("light-mode") ? "light" : "dark";
279
- localStorage.setItem("theme", newTheme);
 
 
 
 
 
 
 
 
280
  updateButton();
281
  });
282
 
283
  function updateButton() {
284
- themeToggle.textContent = body.classList.contains("light-mode") ? "Switch to Dark Mode" : "Switch to Light Mode";
 
 
285
  }
286
  });
287
 
288
-
289
  function showPredictiveText(predictions) {
290
  if (predictions.length > 0 && $("#text").val().trim() !== "") {
291
 
 
75
  <div class="card-footer" style="position: relative;">
76
  <form id="messageArea" class="input-group" style="position: relative;">
77
  <!-- Predictive Text Suggestions (ADD THIS HERE) -->
78
+ <div class="predictive-text" style="position: absolute; display: none; z-index: 1000; width: 100%;"></div>
79
+
80
+
81
 
82
  <input type="text" id="text" name="msg" placeholder="Type your message..." autocomplete="off"
83
  class="form-control type_msg" required />
 
89
  </form>
90
  <button id="clearChat" class="btn btn-danger mt-2">Clear Chat</button>
91
 
92
+ <div class="card-footer text-center">
93
+ <p class="mb-1">Created by</p>
94
+ <div class="d-flex justify-content-center align-items-center">
95
+ <span class="mr-2">Ramandeep Singh Makkar</span>
96
+ <a href="https://www.linkedin.com/in/ramandeep-singh-makkar/" target="_blank" class="mr-2">
97
+ <i class="fab fa-linkedin"></i>
98
+ </a>
99
+ <a href="mailto:[email protected]" class="mr-3">
100
+ <i class="fas fa-envelope"></i>
101
+ </a>
102
+
103
+ <span class="mr-2">Aditya Singh</span>
104
+ <a href="https://www.linkedin.com/in/aditsg26/" target="_blank" class="mr-2">
105
+ <i class="fab fa-linkedin"></i>
106
+ </a>
107
+ <a href="mailto:[email protected]">
108
+ <i class="fas fa-envelope"></i>
109
+ </a>
110
+ </div>
111
+ </div>
112
+
113
 
114
  </div>
115
  </div>
 
182
 
183
  var userHtml = `
184
  <div class="d-flex justify-content-end mb-4">
185
+ <div class="msg_container_send">${rawText}
186
  <span class="msg_time_send">${str_time}</span>
187
  </div>
188
  <div class="img_cont_msg">
 
208
  // Append user message to chat
209
  let userHtml = `
210
  <div class="d-flex justify-content-end mb-4">
211
+ <div class="msg_container_send">${rawText}<span class="msg_time_send">${time}</span></div>
212
  <div class="img_cont_msg"><img src="https://i.ibb.co/d5b84Xw/Untitled-design.png" class="rounded-circle user_img_msg"></div>
213
  </div>`;
214
  $("#messageFormeight").append(userHtml);
 
233
  <div class="img_cont_msg">
234
  <img src="/static/juitlogo.png" class="rounded-circle user_img_msg">
235
  </div>
236
+ <div class="msg_container">${response}<span class="msg_time">${time}</span></div>
237
  </div>`;
238
 
239
  $("#messageFormeight").append($.parseHTML(botHtml));
 
263
  url: "/get",
264
  }).done(function(data) {
265
  var lines = data.split("**");
266
+ var botHtml = '<div class="d-flex justify-content-start mb-4"><div class="img_cont_msg"><img src="/static/juitlogo.png" class="rounded-circle user_img_msg"></div><div class="msg_container">';
267
 
268
  for (var i = 0; i < lines.length; i++) {
269
+ botHtml += '<div class="msg_container">' + lines[i] + '</div>';
270
  }
271
  botHtml += '<span class="msg_time">' + str_time + '</span></div></div>';
272
  $("#messageFormeight").append($.parseHTML(botHtml));
 
284
  <script>
285
  document.addEventListener("DOMContentLoaded", () => {
286
  const themeToggle = document.getElementById("themeToggle");
 
 
287
  const body = document.body;
288
 
289
  // Check local storage for a saved theme, default to dark
290
  const savedTheme = localStorage.getItem("theme") || "dark";
291
+ if (savedTheme === "light") {
292
+ body.classList.add("light-mode");
293
+ body.classList.remove("dark-mode");
294
+ } else {
295
+ body.classList.add("dark-mode");
296
+ body.classList.remove("light-mode");
297
+ }
298
 
299
  updateButton(); // Update button text on load
300
 
301
  // Toggle theme on button click
302
  themeToggle.addEventListener("click", () => {
303
+ if (body.classList.contains("light-mode")) {
304
+ // Switch to dark mode
305
+ body.classList.remove("light-mode");
306
+ body.classList.add("dark-mode");
307
+ localStorage.setItem("theme", "dark");
308
+ } else {
309
+ // Switch to light mode
310
+ body.classList.remove("dark-mode");
311
+ body.classList.add("light-mode");
312
+ localStorage.setItem("theme", "light");
313
+ }
314
  updateButton();
315
  });
316
 
317
  function updateButton() {
318
+ themeToggle.textContent = body.classList.contains("light-mode")
319
+ ? "Switch to Dark Mode"
320
+ : "Switch to Light Mode";
321
  }
322
  });
323
 
 
324
  function showPredictiveText(predictions) {
325
  if (predictions.length > 0 && $("#text").val().trim() !== "") {
326