Dooratre commited on
Commit
aeb57d7
1 Parent(s): ce27139

Update templates/ai-chat-bot.html

Browse files
Files changed (1) hide show
  1. templates/ai-chat-bot.html +178 -334
templates/ai-chat-bot.html CHANGED
@@ -13,7 +13,7 @@
13
 
14
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
15
 
16
- <title>AI Chat Bot - TechWave</title>
17
 
18
 
19
  <script>
@@ -99,13 +99,9 @@
99
  </div>
100
  <div class="search__results">
101
  <!-- Results will come here (via ajax after the integration you made after purchase as it doesn't work in HTML) -->
102
- <div class="results__title">Results</div>
103
  <div class="results__list">
104
  <ul>
105
- <li><a href="#">Artificial Intelligence</a></li>
106
- <li><a href="#">Learn about the impact of AI on the financial industry</a></li>
107
- <li><a href="#">Delve into the realm of AI-driven manufacturing</a></li>
108
- <li><a href="#">Understand the ethical implications surrounding AI</a></li>
109
  </ul>
110
  </div>
111
  </div>
@@ -115,97 +111,18 @@
115
  <!-- HEADER -->
116
  <header class="techwave_fn_header">
117
 
118
- <!-- Header left: token information -->
119
- <div class="header__left">
120
- <div class="fn__token_info">
121
- <span class="token_summary">
122
- <span class="count">120</span>
123
- <span class="text">Tokens<br>Remain</span>
124
- </span>
125
- <a href="pricing.html" class="token_upgrade techwave_fn_button"><span>Upgrade</span></a>
126
- <div class="token__popup">
127
- Resets in <span>19 hours.</span><br>
128
- Daily limit is <span>200 tokens</span>
129
- </div>
130
- </div>
131
- </div>
132
- <!-- /Header left: token information -->
133
 
134
 
135
  <!-- Header right: navigation bar -->
136
  <div class="header__right">
137
  <div class="fn__nav_bar">
138
 
139
- <!-- Search (bar item) -->
140
- <div class="bar__item bar__item_search">
141
- <a href="#" class="item_opener">
142
- <img src="desine/svg/search.svg" alt="" class="fn__svg">
143
- </a>
144
- <div class="item_popup">
145
- <input type="text" placeholder="Search">
146
- </div>
147
- </div>
148
- <!-- !Search (bar item) -->
149
-
150
- <!-- Notification (bar item) -->
151
- <div class="bar__item bar__item_notification has_notification">
152
- <a href="#" class="item_opener">
153
- <img src="desine/svg/bell.svg" alt="" class="fn__svg">
154
- </a>
155
- <div class="item_popup">
156
- <div class="ntfc_header">
157
- <h2 class="ntfc_title">Notifications</h2>
158
- <a href="notifications.html">View All</a>
159
- </div>
160
- <div class="ntfc_list">
161
- <ul>
162
- <li>
163
- <p><a href="notification-single.html">Version 1.1.0 has been launched</a></p>
164
- <span>34 Min Ago</span>
165
- </li>
166
- <li>
167
- <p><a href="notification-single.html">Video Generation has been released</a></p>
168
- <span>12 Apr</span>
169
- </li>
170
- <li>
171
- <p><a href="notification-single.html">Terms has been updated</a></p>
172
- <span>12 Apr</span>
173
- </li>
174
- </ul>
175
- </div>
176
- </div>
177
- </div>
178
- <!-- !Notification (bar item) -->
179
 
180
- <!-- Full Screen (bar item) -->
181
- <div class="bar__item bar__item_fullscreen">
182
- <a href="#" class="item_opener">
183
- <img src="desine/svg/fullscreen.svg" alt="" class="fn__svg f_screen">
184
- <img src="desine/svg/smallscreen.svg" alt="" class="fn__svg s_screen">
185
- </a>
186
- </div>
187
- <!-- !Full Screen (bar item) -->
188
 
189
- <!-- Language (bar item) -->
190
- <div class="bar__item bar__item_language">
191
- <a href="#" class="item_opener">
192
- <img src="desine/svg/language.svg" alt="" class="fn__svg">
193
- </a>
194
- <div class="item_popup">
195
- <ul>
196
- <li>
197
- <span class="active">English</span>
198
- </li>
199
- <li>
200
- <a href="#">Spanish</a>
201
- </li>
202
- <li>
203
- <a href="#">French</a>
204
- </li>
205
- </ul>
206
- </div>
207
- </div>
208
- <!-- !Language (bar item) -->
209
 
210
  <!-- Site Skin (bar item) -->
211
  <div class="bar__item bar__item_skin">
@@ -228,29 +145,12 @@
228
  </div>
229
  <div class="user_info">
230
  <h2 class="user_name">{{ account_name }}<span>Free</span></h2>
231
- <p><a href="mailto:[email protected]" class="user_email">{{token2}}</a></p>
232
  </div>
233
  </div>
234
  <div class="user_nav">
235
  <ul>
236
- <li>
237
- <a href="user-profile.html">
238
- <span class="icon"><img src="desine/svg/person.svg" alt="" class="fn__svg"></span>
239
- <span class="text">Profile</span>
240
- </a>
241
- </li>
242
- <li>
243
- <a href="user-settings.html">
244
- <span class="icon"><img src="desine/svg/setting.svg" alt="" class="fn__svg"></span>
245
- <span class="text">Settings</span>
246
- </a>
247
- </li>
248
- <li>
249
- <a href="/">
250
- <span class="icon"><img src="desine/svg/billing.svg" alt="" class="fn__svg"></span>
251
- <span class="text">Billing</span>
252
- </a>
253
- </li>
254
  <li>
255
  <a href="/login">
256
  <span class="icon"><img src="desine/svg/logout.svg" alt="" class="fn__svg"></span>
@@ -279,129 +179,12 @@
279
 
280
  <div class="mobile_extra_closer"></div>
281
 
282
- <!-- logo (left panel) -->
283
- <div class="leftpanel_logo">
284
- <a href="index.html" class="fn_logo">
285
- <span class="full_logo">
286
- <img src="desine/img/logo-desktop-full.png" alt="" class="desktop_logo">
287
- <img src="desine/img/logo-retina-full.png" alt="" class="retina_logo">
288
- </span>
289
- <span class="short_logo">
290
- <img src="desine/img/logo-desktop-mini.png" alt="" class="desktop_logo">
291
- <img src="desine/img/logo-retina-mini.png" alt="" class="retina_logo">
292
- </span>
293
- </a>
294
- <a href="#" class="fn__closer fn__icon_button desktop_closer">
295
- <img src="desine/svg/arrow.svg" alt="" class="fn__svg">
296
- </a>
297
- <a href="#" class="fn__closer fn__icon_button mobile_closer">
298
- <img src="desine/svg/arrow.svg" alt="" class="fn__svg">
299
- </a>
300
- </div>
301
- <!-- !logo (left panel) -->
302
-
303
- <!-- content (left panel) -->
304
- <div class="leftpanel_content">
305
-
306
- <!-- #1 navigation group -->
307
- <div class="nav_group">
308
- <h2 class="group__title">Start Here</h2>
309
- <ul class="group__list">
310
- <li>
311
- <a href="index.html" class="fn__tooltip menu__item" data-position="right" title="Home">
312
- <span class="icon"><img src="desine/svg/home.svg" alt="" class="fn__svg"></span>
313
- <span class="text">Home</span>
314
- </a>
315
- </li>
316
- <li>
317
- <a href="community-feed.html" class="fn__tooltip menu__item" data-position="right" title="Community Feed">
318
- <span class="icon"><img src="desine/svg/community.svg" alt="" class="fn__svg"></span>
319
- <span class="text">Community Feed</span>
320
- </a>
321
- </li>
322
- <li>
323
- <a href="personal-feed.html" class="fn__tooltip menu__item" data-position="right" title="Personal Feed">
324
- <span class="icon"><img src="desine/svg/person.svg" alt="" class="fn__svg"></span>
325
- <span class="text">Personal Feed<span class="count">48</span></span>
326
- </a>
327
- </li>
328
- <li>
329
- <a href="models.html" class="fn__tooltip menu__item" data-position="right" title="Finetuned Models">
330
- <span class="icon"><img src="desine/svg/cube.svg" alt="" class="fn__svg"></span>
331
- <span class="text">Finetuned Models</span>
332
- </a>
333
- </li>
334
- </ul>
335
- </div>
336
- <!-- !#1 navigation group -->
337
-
338
- <!-- #2 navigation group -->
339
- <div class="nav_group">
340
- <h2 class="group__title">User Tools</h2>
341
- <ul class="group__list">
342
- <li>
343
- <a href="image-generation.html" class="fn__tooltip menu__item" data-position="right" title="Image Generation">
344
- <span class="icon"><img src="desine/svg/image.svg" alt="" class="fn__svg"></span>
345
- <span class="text">Image Generation</span>
346
- </a>
347
- </li>
348
- <li>
349
- <a href="ai-chat-bot.html" class="fn__tooltip active menu__item" data-position="right" title="AI Chat Bot">
350
- <span class="icon"><img src="desine/svg/chat.svg" alt="" class="fn__svg"></span>
351
- <span class="text">AI Chat Bot</span>
352
- </a>
353
- </li>
354
- </ul>
355
- </div>
356
- <!-- !#2 navigation group -->
357
 
358
- <!-- #3 navigation group -->
359
- <div class="nav_group">
360
- <h2 class="group__title">Support</h2>
361
- <ul class="group__list">
362
- <li>
363
- <a href="pricing.html" class="fn__tooltip menu__item" data-position="right" title="Pricing">
364
- <span class="icon"><img src="desine/svg/dollar.svg" alt="" class="fn__svg"></span>
365
- <span class="text">Pricing</span>
366
- </a>
367
- </li>
368
- <li class="menu-item-has-children">
369
- <a href="video-generation.html" class="fn__tooltip menu__item" title="FAQ &amp; Help" data-position="right">
370
- <span class="icon"><img src="desine/svg/question.svg" alt="" class="fn__svg"></span>
371
- <span class="text">FAQ &amp; Help</span>
372
- <span class="trigger"><img src="desine/svg/arrow.svg" alt="" class="fn__svg"></span>
373
- </a>
374
- <ul class="sub-menu">
375
- <li>
376
- <a href="documentation.html"><span class="text">Documentation</span></a>
377
- </li>
378
- <li>
379
- <a href="faq.html"><span class="text">FAQ</span></a>
380
- </li>
381
- <li>
382
- <a href="changelog.html"><span class="text">Changelog<span class="fn__sup">(1.1.0)</span></span></a>
383
- </li>
384
- <li>
385
- <a href="contact.html"><span class="text">Contact Us</span></a>
386
- </li>
387
- <li>
388
- <a href="index-2.html"><span class="text">Home #2</span></a>
389
- </li>
390
- </ul>
391
- </li>
392
- <li>
393
- <a href="/login" class="fn__tooltip menu__item" data-position="right" title="Log Out">
394
- <span class="icon"><img src="desine/svg/logout.svg" alt="" class="fn__svg"></span>
395
- <span class="text">Log Out</span>
396
- </a>
397
- </li>
398
- </ul>
399
- </div>
400
- <!-- !#3 navigation group -->
401
-
402
 
403
- </div>
404
- <!-- !content (left panel) -->
405
 
406
  </div>
407
  <!-- !LEFT PANEL -->
@@ -425,7 +208,7 @@
425
  <div class="fn__title_holder">
426
  <div class="container">
427
  <!-- Active chat title -->
428
- <h1 class="title">Chat Bot Definition</h1>
429
  <!-- !Active chat title -->
430
  </div>
431
  </div>
@@ -436,7 +219,7 @@
436
  <div class="chat__item active" id="chat1">
437
 
438
  <div class="chat__box bot__chat">
439
- <div class="author"><span>Bot</span></div>
440
  <div class="chat">
441
  <div class="fn__animated_text"><p>{{greet}}</p></div>
442
 
@@ -448,103 +231,178 @@
448
  <div class="chat__comment">
449
  <div class="container">
450
  <div class="fn__chat_comment">
451
-
452
  <textarea rows="1" class="fn__hidden_textarea" tabindex="-1"></textarea>
453
  <textarea rows="1" placeholder="Send a message..." id="user_input"></textarea>
454
  <button onclick="sendMessage()"><img src="desine/svg/enter.svg" alt="" class="fn__svg"></button>
455
  </div>
456
  </div>
457
  </div>
458
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
  <script>
460
- function sendMessage() {
461
- var user_input = document.getElementById("user_input").value;
462
-
463
- if (user_input.trim() !== "") {
464
- // Display user's message immediately
465
- addChatMessage(user_input, "User");
466
- document.getElementById("user_input").value = "";
467
-
468
- var xhr = new XMLHttpRequest();
469
- xhr.open("POST", "/get_response", true);
470
- xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
471
- xhr.onreadystatechange = function() {
472
- if (xhr.readyState === 4 && xhr.status === 200) {
473
- var response_text = xhr.responseText;
474
- // Display bot's response
475
- addChatMessage2(response_text, "Bot");
476
- }
477
- };
478
- xhr.send("user_input=" + user_input);
479
- }
480
- }
481
-
482
- function addChatMessage(message, author) {
483
- var chatItem = document.createElement("div");
484
- chatItem.className = "chat__box your__chat";
485
-
486
- var authorElement = document.createElement("div");
487
- authorElement.className = "author";
488
- authorElement.innerHTML = "<span>{{account_name}}</span>";
489
-
490
- var chatElement = document.createElement("div");
491
- chatElement.className = "chat";
492
-
493
- chatElement.innerHTML = "<p>" + message + "</p>";
494
-
495
- chatItem.appendChild(authorElement);
496
- chatItem.appendChild(chatElement);
497
-
498
- document.getElementById("chat1").appendChild(chatItem);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
499
  }
500
 
501
- function addChatMessage2(message, author) {
502
- var chatItem = document.createElement("div");
503
- chatItem.className = "chat__box bot__chat";
504
-
505
- var authorElement = document.createElement("div");
506
- authorElement.className = "author";
507
- authorElement.innerHTML = "<span>" + author + "</span>";
508
-
509
- var chatElement = document.createElement("div");
510
- chatElement.className = "chat";
511
-
512
- chatItem.appendChild(authorElement);
513
- chatItem.appendChild(chatElement);
514
-
515
- document.getElementById("chat1").appendChild(chatItem);
516
-
517
- var messageElement = document.createElement("p");
518
- chatElement.appendChild(messageElement);
519
-
520
- var index = 0;
521
- var typingInterval = setInterval(function() {
522
- if (index < message.length) {
523
- if (message.charAt(index) === "<" && message.charAt(index + 1) === "b" && message.charAt(index + 2) === "r" && message.charAt(index + 3) === ">") {
524
- messageElement.innerHTML += "<br>";
525
- index += 3;
526
- } else if (message.charAt(index) === "<" && message.charAt(index + 1) === "i" && message.charAt(index + 2) === "m" && message.charAt(index + 3) === "g" && message.charAt(index + 4) === " ") {
527
- var srcStart = message.indexOf("src='", index) + 5;
528
- var srcEnd = message.indexOf("'", srcStart);
529
- var imageUrl = message.substring(srcStart, srcEnd);
530
- var imageElement = document.createElement("img");
531
- imageElement.src = imageUrl;
532
- imageElement.className = "chat__image"; // Add CSS class for styling
533
- messageElement.appendChild(imageElement);
534
- index = srcEnd + 1;
535
-
536
- } else {
537
- messageElement.innerHTML += message.charAt(index);
538
- }
539
- index++;
540
- } else {
541
- clearInterval(typingInterval);
542
- }
543
- }, 30); // Adjust the delay (in milliseconds) between each character being added
544
  }
545
-
546
- </script>
547
- <style>
548
  .chat__image {
549
  max-width: 200px; /* Adjust the maximum width as desired */
550
  max-height: 200px; /* Adjust the maximum height as desired */
@@ -571,7 +429,7 @@ function addChatMessage2(message, author) {
571
 
572
  <div class="chat__sidebar">
573
  <div class="sidebar_header">
574
- <a href="{{ url_for('home') }}" class="fn__new_chat_link">
575
  <span class="icon"></span>
576
  <span class="text">New Chat</span>
577
  </a>
@@ -591,21 +449,7 @@ function addChatMessage2(message, author) {
591
  <!-- !PAGE (all pages go inside this div) -->
592
 
593
 
594
- <!-- FOOTER (inside the content) -->
595
- <footer class="techwave_fn_footer">
596
- <div class="techwave_fn_footer_content">
597
- <div class="copyright">
598
- <p><script>document.write(new Date().getFullYear())</script>© SRBThemes</p>
599
- </div>
600
- <div class="menu_items">
601
- <ul>
602
- <li><a href="terms.html">Terms of Service</a></li>
603
- <li><a href="privacy.html">Privacy Policy</a></li>
604
- </ul>
605
- </div>
606
- </div>
607
- </footer>
608
- <!-- !FOOTER (inside the content) -->
609
 
610
  </div>
611
  <!-- !CONTENT -->
 
13
 
14
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
15
 
16
+ <title>AI Chat Bot</title>
17
 
18
 
19
  <script>
 
99
  </div>
100
  <div class="search__results">
101
  <!-- Results will come here (via ajax after the integration you made after purchase as it doesn't work in HTML) -->
 
102
  <div class="results__list">
103
  <ul>
104
+
 
 
 
105
  </ul>
106
  </div>
107
  </div>
 
111
  <!-- HEADER -->
112
  <header class="techwave_fn_header">
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
 
116
  <!-- Header right: navigation bar -->
117
  <div class="header__right">
118
  <div class="fn__nav_bar">
119
 
120
+
121
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
+
 
 
 
 
 
 
 
124
 
125
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
 
127
  <!-- Site Skin (bar item) -->
128
  <div class="bar__item bar__item_skin">
 
145
  </div>
146
  <div class="user_info">
147
  <h2 class="user_name">{{ account_name }}<span>Free</span></h2>
 
148
  </div>
149
  </div>
150
  <div class="user_nav">
151
  <ul>
152
+
153
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  <li>
155
  <a href="/login">
156
  <span class="icon"><img src="desine/svg/logout.svg" alt="" class="fn__svg"></span>
 
179
 
180
  <div class="mobile_extra_closer"></div>
181
 
182
+
183
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
 
185
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
 
187
+
 
188
 
189
  </div>
190
  <!-- !LEFT PANEL -->
 
208
  <div class="fn__title_holder">
209
  <div class="container">
210
  <!-- Active chat title -->
211
+ <h1 class="title">ِAI ALEX-9</h1>
212
  <!-- !Active chat title -->
213
  </div>
214
  </div>
 
219
  <div class="chat__item active" id="chat1">
220
 
221
  <div class="chat__box bot__chat">
222
+ <div class="author"><span>ALEX-9</span></div>
223
  <div class="chat">
224
  <div class="fn__animated_text"><p>{{greet}}</p></div>
225
 
 
231
  <div class="chat__comment">
232
  <div class="container">
233
  <div class="fn__chat_comment">
 
234
  <textarea rows="1" class="fn__hidden_textarea" tabindex="-1"></textarea>
235
  <textarea rows="1" placeholder="Send a message..." id="user_input"></textarea>
236
  <button onclick="sendMessage()"><img src="desine/svg/enter.svg" alt="" class="fn__svg"></button>
237
  </div>
238
  </div>
239
  </div>
240
+ <div id="chat1"></div> <!-- Container for chat history -->
241
+
242
+ <style>
243
+ .copy__button, .download__button {
244
+ color: #7c5fe3;
245
+ background-color: rgb(0, 0, 0);
246
+ border: none;
247
+ border-radius: 5px;
248
+ padding: 5px 10px;
249
+ margin: 5px;
250
+ cursor: pointer;
251
+ font-size: 14px;
252
+ }
253
+
254
+ .copy__button:hover, .download__button:hover {
255
+ background-color: #5a4a9d;
256
+ }
257
+
258
+ </style>
259
+
260
  <script>
261
+ var conversationHistory = [];
262
+ var userFirstName = "{{ first }}";
263
+
264
+ function sendMessage() {
265
+ var user_input = document.getElementById("user_input").value;
266
+
267
+ if (user_input.trim() !== "") {
268
+ // Display user's message immediately
269
+ addChatMessage(user_input, userFirstName);
270
+ document.getElementById("user_input").value = "";
271
+
272
+ // Store user input in conversation history
273
+ conversationHistory.push({author: userFirstName, message: user_input});
274
+
275
+ var xhr = new XMLHttpRequest();
276
+ xhr.open("POST", "/get_response", true);
277
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
278
+ xhr.onreadystatechange = function() {
279
+ if (xhr.readyState === 4 && xhr.status === 200) {
280
+ var response_text = xhr.responseText;
281
+ // Display bot's response
282
+ addChatMessage2(response_text, "Bot");
283
+
284
+ // Store bot response in conversation history
285
+ conversationHistory.push({author: "Bot", message: response_text});
286
+ }
287
+ };
288
+ xhr.send("user_input=" + encodeURIComponent(user_input) + "&conversation_history=" + encodeURIComponent(JSON.stringify(conversationHistory)));
289
+ }
290
+ }
291
+
292
+ function addChatMessage(message, author) {
293
+ var chatItem = document.createElement("div");
294
+ chatItem.className = "chat__box your__chat";
295
+
296
+ var authorElement = document.createElement("div");
297
+ authorElement.className = "author";
298
+ authorElement.innerHTML = "<span>{{first}}</span>";
299
+
300
+ var chatElement = document.createElement("div");
301
+ chatElement.className = "chat";
302
+
303
+ chatElement.innerHTML = "<p>" + message + "</p>";
304
+
305
+ chatItem.appendChild(authorElement);
306
+ chatItem.appendChild(chatElement);
307
+
308
+ document.getElementById("chat1").appendChild(chatItem);
309
+ }
310
+
311
+ function addChatMessage2(message, author) {
312
+ var chatItem = document.createElement("div");
313
+ chatItem.className = "chat__box bot__chat";
314
+
315
+ var authorElement = document.createElement("div");
316
+ authorElement.className = "author";
317
+ authorElement.innerHTML = "<span>ALEX-9</span>";
318
+
319
+ var chatElement = document.createElement("div");
320
+ chatElement.className = "chat";
321
+
322
+ chatItem.appendChild(authorElement);
323
+ chatItem.appendChild(chatElement);
324
+
325
+ document.getElementById("chat1").appendChild(chatItem);
326
+
327
+ var messageElement = document.createElement("p");
328
+ chatElement.appendChild(messageElement);
329
+
330
+ var copyButton = document.createElement("button");
331
+ copyButton.innerHTML = "Copy";
332
+ copyButton.className = "copy__button";
333
+ copyButton.onclick = function() {
334
+ var tempElement = document.createElement('textarea');
335
+ tempElement.value = message.replace(/<br\s*\/?>/gi, '\n');
336
+ document.body.appendChild(tempElement);
337
+ tempElement.select();
338
+ document.execCommand('copy');
339
+ document.body.removeChild(tempElement);
340
+ alert("Copied to clipboard!");
341
+ };
342
+ chatElement.appendChild(copyButton);
343
+
344
+ var index = 0;
345
+ var typingInterval = setInterval(function() {
346
+ if (index < message.length) {
347
+ if (message.charAt(index) === "<" && message.charAt(index + 1) === "b" && message.charAt(index + 2) === "r" && message.charAt(index + 3) === ">") {
348
+ messageElement.innerHTML += "<br>";
349
+ index += 3;
350
+ } else if (message.charAt(index) === "<" && message.charAt(index + 1) === "i" && message.charAt(index + 2) === "m" && message.charAt(index + 3) === "g" && message.charAt(index + 4) === " ") {
351
+ var srcStart = message.indexOf("src='", index) + 5;
352
+ var srcEnd = message.indexOf("'", srcStart);
353
+ var imageUrl = message.substring(srcStart, srcEnd);
354
+ var imageElement = document.createElement("img");
355
+ imageElement.src = imageUrl;
356
+ imageElement.className = "chat__image"; // Add CSS class for styling
357
+ messageElement.appendChild(imageElement);
358
+
359
+ var downloadButton = document.createElement("button");
360
+ downloadButton.innerHTML = "Download";
361
+ downloadButton.className = "download__button";
362
+ downloadButton.onclick = function() {
363
+ fetch(imageUrl)
364
+ .then(response => response.blob())
365
+ .then(blob => {
366
+ var url = window.URL.createObjectURL(blob);
367
+ var a = document.createElement("a");
368
+ a.style.display = "none";
369
+ a.href = url;
370
+ a.download = imageUrl.substring(imageUrl.lastIndexOf('/') + 1);
371
+ document.body.appendChild(a);
372
+ a.click();
373
+ window.URL.revokeObjectURL(url);
374
+ })
375
+ .catch(() => alert('Could not download the image.'));
376
+ };
377
+ chatElement.appendChild(downloadButton);
378
+
379
+ index = srcEnd + 1;
380
+ } else {
381
+ messageElement.innerHTML += message.charAt(index);
382
+ }
383
+ index++;
384
+ } else {
385
+ clearInterval(typingInterval);
386
+ }
387
+ }, 30); // Adjust the delay (in milliseconds) between each character being added
388
+ }
389
+ </script>
390
+
391
+ <style>
392
+ pre {
393
+ background-color: #f5f5f5;
394
+ padding: 10px;
395
+ border-radius: 5px;
396
+ overflow-x: auto;
397
+ white-space: pre-wrap; /* Adjust this based on your preference */
398
+ margin: 10px 0;
399
  }
400
 
401
+ code {
402
+ color: #d63384;
403
+ font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
404
+ font-size: 14px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
405
  }
 
 
 
406
  .chat__image {
407
  max-width: 200px; /* Adjust the maximum width as desired */
408
  max-height: 200px; /* Adjust the maximum height as desired */
 
429
 
430
  <div class="chat__sidebar">
431
  <div class="sidebar_header">
432
+ <a href="{{ url_for('chat', account_name=account_name, greet=greet, first=first, last=last, token2=token2) }}" class="fn__new_chat_link">
433
  <span class="icon"></span>
434
  <span class="text">New Chat</span>
435
  </a>
 
449
  <!-- !PAGE (all pages go inside this div) -->
450
 
451
 
452
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
 
454
  </div>
455
  <!-- !CONTENT -->