Spaces:
Runtime error
Runtime error
update UI
Browse files- templates/chatwidget.html +746 -705
templates/chatwidget.html
CHANGED
@@ -1,535 +1,532 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html lang="en">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
<title>Document</title>
|
8 |
-
</head>
|
9 |
-
|
10 |
-
<body>
|
11 |
-
<div id="body">
|
12 |
-
<style>
|
13 |
-
body {
|
14 |
-
/* Add the background image */
|
15 |
-
background-image: url('mu-logo-mood-03.jpg');
|
16 |
-
/* Adjust background properties */
|
17 |
-
background-repeat: no-repeat;
|
18 |
-
background-size: cover; /* or contain, depending on your preference */
|
19 |
-
/* Add other background properties if needed */
|
20 |
-
}
|
21 |
-
.cm-msg-text {
|
22 |
-
overflow-wrap: break-word;
|
23 |
-
/* Break long words */
|
24 |
-
word-wrap: break-word;
|
25 |
-
/* Break long words */
|
26 |
-
word-break: break-word;
|
27 |
-
/* Break words */
|
28 |
-
max-width: 100%;
|
29 |
-
/* Limit maximum width */
|
30 |
-
}
|
31 |
-
|
32 |
-
[data-block=list11-v4-1-1-b2] .sw-border-bottom-color-000000 {
|
33 |
-
border-bottom-color: #000000 !important;
|
34 |
-
}
|
35 |
-
|
36 |
-
|
37 |
-
[data-block=list11-v4-1-1-b2] .sw-border-bottom-width-none {
|
38 |
-
border-bottom-width: 0px !important;
|
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 |
-
margin: 0;
|
73 |
-
padding: 0;
|
74 |
-
font-family: "Lato", sans-serif;
|
75 |
-
background-color: #f6f7f9;
|
76 |
-
}
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
background-color: #0360a5;
|
92 |
-
align-items: center;
|
93 |
-
justify-content: space-around;
|
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 |
-
background-repeat: no-repeat;
|
125 |
-
box-shadow: 12px 15px 20px 0 rgba(46, 61, 73, 0.15);
|
126 |
-
border: 0;
|
127 |
-
border-radius: 50%;
|
128 |
-
cursor: pointer;
|
129 |
-
}
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
cursor: pointer;
|
143 |
-
}
|
144 |
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
}
|
153 |
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
justify-content: center;
|
163 |
-
height: 60px;
|
164 |
-
display: flex;
|
165 |
-
border-radius: 50%;
|
166 |
-
color: white;
|
167 |
-
padding: 8px;
|
168 |
-
cursor: pointer;
|
169 |
-
box-shadow: 0px 3px 16px 0px rgba(0, 0, 0, 0.4),
|
170 |
-
0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
|
171 |
-
}
|
172 |
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
}
|
193 |
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
border-radius: 5px;
|
205 |
-
/* box-shadow: 0px 5px 35px 9px #464a92; */
|
206 |
-
box-shadow: 0px 5px 35px 9px #ccc;
|
207 |
-
}
|
208 |
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
color: white;
|
221 |
-
text-align: center;
|
222 |
-
font-size: 20px;
|
223 |
-
padding-top: 17px;
|
224 |
-
padding-left: 36px;
|
225 |
-
}
|
226 |
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
|
|
|
|
|
|
|
|
234 |
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
right: 0;
|
243 |
-
height: 100%;
|
244 |
-
position: absolute;
|
245 |
-
z-index: -1;
|
246 |
-
}
|
247 |
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
border: 1px solid #ccc;
|
261 |
-
color: #888;
|
262 |
-
border-top: none;
|
263 |
-
border-bottom-right-radius: 5px;
|
264 |
-
border-bottom-left-radius: 5px;
|
265 |
-
overflow: hidden;
|
266 |
-
}
|
267 |
|
268 |
-
|
269 |
-
|
270 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
}
|
276 |
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
background: transparent;
|
297 |
-
box-shadow: none;
|
298 |
-
border: none;
|
299 |
-
border-radius: 50%;
|
300 |
-
color: #000;
|
301 |
-
width: 35px;
|
302 |
-
height: 35px;
|
303 |
-
}
|
304 |
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
|
|
|
|
316 |
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
|
322 |
-
|
323 |
-
|
324 |
-
|
|
|
325 |
|
326 |
-
|
327 |
-
|
328 |
-
height: 40vh;
|
329 |
}
|
330 |
-
}
|
331 |
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
width: 15%;
|
338 |
-
}
|
339 |
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
margin-left: 10px;
|
356 |
-
position: relative;
|
357 |
-
margin-bottom: 20px;
|
358 |
-
border-radius: 30px;
|
359 |
-
border-bottom-left-radius: 0px;
|
360 |
-
}
|
361 |
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
border-bottom-right-radius: 0px;
|
377 |
-
background: #000;
|
378 |
-
color: white;
|
379 |
-
}
|
380 |
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
|
|
|
|
|
|
386 |
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
|
|
391 |
|
392 |
-
|
393 |
-
|
394 |
-
|
|
|
395 |
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
border-radius: 5px;
|
400 |
-
background-color: #d6d6d6;
|
401 |
-
color: black;
|
402 |
-
z-index: 1999;
|
403 |
-
bottom: 3px;
|
404 |
-
position: absolute;
|
405 |
-
padding: 5px 10px;
|
406 |
-
margin: 0 108px;
|
407 |
-
}
|
408 |
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
|
414 |
-
|
415 |
-
|
416 |
-
|
|
|
417 |
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
h3,
|
430 |
-
h4,
|
431 |
-
h5,
|
432 |
-
small {
|
433 |
-
white-space: pre-line;
|
434 |
-
}
|
435 |
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
.h4,
|
446 |
-
.h5,
|
447 |
-
.h6 {
|
448 |
-
margin-bottom: 0.25rem;
|
449 |
-
font-family: inherit;
|
450 |
-
font-weight: 400;
|
451 |
-
line-height: 1.1;
|
452 |
-
color: inherit;
|
453 |
-
}
|
454 |
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
|
|
|
|
|
|
|
|
|
|
468 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
469 |
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
|
532 |
-
|
533 |
background-image: url("./MU_LOGO_BLACK.jpg");
|
534 |
background-repeat: no-repeat;
|
535 |
position: relative;
|
@@ -537,42 +534,55 @@
|
|
537 |
background-size: cover;
|
538 |
} */
|
539 |
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
570 |
<div class="marwadi">
|
571 |
Welcome To AI Bestie
|
572 |
<div class="bestie">
|
573 |
<label>User Name</label>
|
574 |
-
|
575 |
-
|
|
|
|
|
|
|
576 |
</div>
|
577 |
<div id="chat-circle" class="btn btn-raised" style="">
|
578 |
<div id="chat-overlay"></div>
|
@@ -582,7 +592,9 @@
|
|
582 |
<div class="chat-box" style="display: none">
|
583 |
<div class="chat-box-header">
|
584 |
AI Bestie
|
585 |
-
<span class="chat-box-toggle"
|
|
|
|
|
586 |
</div>
|
587 |
|
588 |
<div class="chat-box-body">
|
@@ -595,257 +607,286 @@
|
|
595 |
</div>
|
596 |
<div class="chat_input">
|
597 |
<form>
|
598 |
-
<input
|
|
|
|
|
|
|
|
|
599 |
<button type="submit" class="chat-submit" id="submit">
|
600 |
<i class="material-icons">send</i>
|
601 |
</button>
|
602 |
</form>
|
603 |
</div>
|
604 |
</div>
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
success: function (data) {
|
633 |
-
if (status == "end") {
|
634 |
-
return true;
|
635 |
-
} else {
|
636 |
-
generate_message(data.response, "user");
|
637 |
-
}
|
638 |
-
},
|
639 |
-
});
|
640 |
-
}
|
641 |
-
// chatWidget(
|
642 |
-
// window.logged_in_user.airtable_record_id,
|
643 |
-
// window.logged_in_user.Name,
|
644 |
-
// "end"
|
645 |
-
// );
|
646 |
-
// setTimeout(() => {
|
647 |
-
// chatWidget(
|
648 |
-
// window.logged_in_user.airtable_record_id,
|
649 |
-
// window.logged_in_user.Name,
|
650 |
-
// "start"
|
651 |
-
// );
|
652 |
-
// }, 300);
|
653 |
-
function generate_message(msg, type) {
|
654 |
-
var str = "";
|
655 |
-
str += "<div id='cm-msg" + "' class=\"chat-msg " + type + '">';
|
656 |
-
str += ' <div class="cm-msg-text">';
|
657 |
-
var lines = msg.includes("\n") ? msg.split("\n") : [msg];
|
658 |
-
|
659 |
-
lines.forEach((line) => {
|
660 |
-
// Check if the line contains a URL
|
661 |
-
var urlRegex = /(https?:\/\/[^\s]+)/g;
|
662 |
-
var messageWithLinks = line.replace(urlRegex, '<a href="$1" target="_blank">$1</a>');
|
663 |
-
|
664 |
-
// Append the line with links to the message string
|
665 |
-
str += messageWithLinks;
|
666 |
-
|
667 |
-
// Only add <br> if not last line
|
668 |
-
if (line !== lines[lines.length - 1]) {
|
669 |
-
str += "<br>";
|
670 |
-
}
|
671 |
-
});
|
672 |
-
str += " <\/div>";
|
673 |
-
str += " <\/div>";
|
674 |
-
$(".chat_logs").append(str);
|
675 |
-
|
676 |
-
// Adjust scroll position
|
677 |
-
var chatLogs = document.getElementById("chat_logs");
|
678 |
-
chatLogs.scrollTop = chatLogs.scrollHeight;
|
679 |
-
}
|
680 |
-
|
681 |
-
function error_message(msg, type) {
|
682 |
-
INDEX++;
|
683 |
-
var str = "";
|
684 |
-
str += "<div id='cm-msg" + "' class=\"chat-msg " + type + '">';
|
685 |
-
str += ' <div class="cm-msg-text">';
|
686 |
-
var lines = msg.includes("\n") ? msg.split("\n") : [msg];
|
687 |
-
|
688 |
-
lines.forEach((line) => {
|
689 |
-
str += line;
|
690 |
-
|
691 |
-
// Only add <br> if not last line
|
692 |
-
if (line !== lines[lines.length - 1]) {
|
693 |
-
str += "<br>";
|
694 |
-
}
|
695 |
-
});
|
696 |
-
str += " <\/div>";
|
697 |
-
str += " <\/div>";
|
698 |
-
$("#chat_logs").append(str);
|
699 |
-
if (type == "self") {
|
700 |
-
$("#chat_input").val("");
|
701 |
-
}
|
702 |
-
$("#chat_logs")
|
703 |
-
.stop()
|
704 |
-
.animate({ scrollTop: $("#chat_logs")[0].scrollHeight }, 1000);
|
705 |
-
}
|
706 |
-
$(function () {
|
707 |
-
var INDEX = 0;
|
708 |
-
var input = document.getElementById("chat_input");
|
709 |
-
var submitBtn = document.getElementById("submit");
|
710 |
-
var cancelRequest = document.getElementById("cancel");
|
711 |
-
|
712 |
-
var userId = document.getElementById("user_id");
|
713 |
-
$("#cancel").click(function (e) {
|
714 |
-
input.disabled = false;
|
715 |
-
e.preventDefault();
|
716 |
-
submitBtn.disabled = false;
|
717 |
-
input.style.opacity = 1;
|
718 |
-
cancelRequest.style.display = 'none';
|
719 |
-
});
|
720 |
-
|
721 |
-
$("#submit").click(function (e) {
|
722 |
-
cancelRequest.style.display = 'block';
|
723 |
-
input.disabled = true;
|
724 |
-
input.style.opacity = 0.5;
|
725 |
-
submitBtn.disabled = true;
|
726 |
-
e.preventDefault();
|
727 |
-
var msg = $("#chat_input").val();
|
728 |
-
if (msg.trim() == "") {
|
729 |
-
return false;
|
730 |
-
}
|
731 |
-
generate_message(msg, "self");
|
732 |
-
input.value = "";
|
733 |
-
|
734 |
$.ajax({
|
735 |
url: "/chatwidget",
|
736 |
type: "POST",
|
737 |
data: JSON.stringify({
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
}),
|
742 |
headers: {
|
743 |
"Content-Type": "application/json",
|
744 |
-
"Access-Control-Allow-Origin": "*",
|
745 |
-
"Access-Control-Allow-Headers": "Content-Type",
|
746 |
},
|
747 |
-
|
748 |
success: function (data) {
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
submitBtn.disabled = false;
|
755 |
-
input.style.opacity = 1;
|
756 |
-
cancelRequest.style.display = 'none';
|
757 |
-
},
|
758 |
-
error: function (data) {
|
759 |
-
error_message(
|
760 |
-
"We are sorry. we can't proceess Your Request Please Try again after some times.",
|
761 |
-
"user"
|
762 |
-
);
|
763 |
-
input.disabled = false;
|
764 |
-
submitBtn.disabled = false;
|
765 |
-
input.style.opacity = 1;
|
766 |
-
cancelRequest.style.display = 'none';
|
767 |
},
|
768 |
});
|
769 |
-
}
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
775 |
});
|
776 |
|
777 |
-
$("#
|
778 |
$("#chat-circle").toggle("scale");
|
779 |
$(".chat-box").toggle("scale");
|
780 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
781 |
input.disabled = true;
|
782 |
$.ajax({
|
783 |
url: "/start-session",
|
784 |
type: "POST",
|
785 |
data: JSON.stringify({
|
786 |
-
user_id: userId.value
|
787 |
// message: `${msg} | ${window.logged_in_user.airtable_record_id}`,
|
788 |
}),
|
789 |
headers: {
|
790 |
"Content-Type": "application/json",
|
791 |
},
|
792 |
success: function (data) {
|
793 |
-
|
794 |
$.ajax({
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
if (status == "end") {
|
830 |
-
|
831 |
return true;
|
832 |
} else {
|
833 |
console.log(data.response, "session_id");
|
834 |
}
|
835 |
},
|
836 |
});
|
837 |
-
console.log(userId, userId.value)
|
838 |
});
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
location.reload();
|
844 |
-
});
|
845 |
-
});
|
846 |
-
|
847 |
-
</script>
|
848 |
-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
849 |
-
</body>
|
850 |
-
|
851 |
-
</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>Document</title>
|
7 |
+
</head>
|
8 |
+
|
9 |
+
<body>
|
10 |
+
<div id="body">
|
11 |
+
<style>
|
12 |
+
body {
|
13 |
+
/* Add the background image */
|
14 |
+
background-image: url("mu-logo-mood-03.jpg");
|
15 |
+
/* Adjust background properties */
|
16 |
+
background-repeat: no-repeat;
|
17 |
+
background-size: cover; /* or contain, depending on your preference */
|
18 |
+
/* Add other background properties if needed */
|
19 |
+
}
|
20 |
+
.cm-msg-text {
|
21 |
+
overflow-wrap: break-word;
|
22 |
+
/* Break long words */
|
23 |
+
word-wrap: break-word;
|
24 |
+
/* Break long words */
|
25 |
+
word-break: break-word;
|
26 |
+
/* Break words */
|
27 |
+
max-width: 100%;
|
28 |
+
/* Limit maximum width */
|
29 |
+
}
|
30 |
|
31 |
+
[data-block="list11-v4-1-1-b2"] .sw-border-bottom-color-000000 {
|
32 |
+
border-bottom-color: #000000 !important;
|
33 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
+
[data-block="list11-v4-1-1-b2"] .sw-border-bottom-width-none {
|
36 |
+
border-bottom-width: 0px !important;
|
37 |
+
}
|
38 |
|
39 |
+
[data-block="list11-v4-1-1-b2"] .sw-border-bottom-style-none {
|
40 |
+
border-bottom-style: none !important;
|
41 |
+
}
|
42 |
|
43 |
+
[data-block="list11-v4-1-1-b2"] .sw-border-top-color-000000 {
|
44 |
+
border-top-color: #000000 !important;
|
45 |
+
}
|
46 |
|
47 |
+
[data-block="list11-v4-1-1-b2"] .sw-border-top-width-none {
|
48 |
+
border-top-width: 0px !important;
|
49 |
+
}
|
50 |
|
51 |
+
[data-block="list11-v4-1-1-b2"] .sw-border-top-style-none {
|
52 |
+
border-top-style: none !important;
|
53 |
+
}
|
54 |
|
55 |
+
[data-block="list11-v4-1-1-b2"] .sw-padding-bottom-m {
|
56 |
+
padding-bottom: 3rem !important;
|
57 |
+
}
|
58 |
|
59 |
+
[data-block="list11-v4-1-1-b2"] .sw-padding-top-m {
|
60 |
+
padding-top: 3rem !important;
|
61 |
+
}
|
62 |
|
63 |
+
[data-block="list11-v4-1-1-b2"] .sw-background-color-ffffff {
|
64 |
+
background-color: #ffffff !important;
|
65 |
+
}
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
+
#body {
|
68 |
+
z-index: 1999;
|
69 |
+
position: fixed;
|
70 |
+
margin: 0;
|
71 |
+
padding: 0;
|
72 |
+
font-family: "Lato", sans-serif;
|
73 |
+
background-color: #f6f7f9;
|
74 |
+
}
|
75 |
|
76 |
+
@mixin chabox-container {
|
77 |
+
display: flex;
|
78 |
+
position: absolute;
|
79 |
+
box-shadow: 5px 5px 25px 0 rgba(46, 61, 73, 0.2);
|
80 |
+
flex-direction: column;
|
81 |
+
}
|
|
|
|
|
|
|
|
|
82 |
|
83 |
+
@mixin chatbox-header {
|
84 |
+
box-sizing: border-box;
|
85 |
+
display: flex;
|
86 |
+
width: 100%;
|
87 |
+
padding: 16px;
|
88 |
+
color: #fff;
|
89 |
+
background-color: #0360a5;
|
90 |
+
align-items: center;
|
91 |
+
justify-content: space-around;
|
92 |
+
}
|
93 |
|
94 |
+
@mixin chatbox-main {
|
95 |
+
box-sizing: border-box;
|
96 |
+
width: 100%;
|
97 |
+
padding: calc(2 * 16px) 16px;
|
98 |
+
line-height: calc(16px + 16px / 2);
|
99 |
+
color: #888;
|
100 |
+
text-align: center;
|
101 |
+
}
|
|
|
102 |
|
103 |
+
@mixin chatbox-footer {
|
104 |
+
box-sizing: border-box;
|
105 |
+
display: flex;
|
106 |
+
width: 100%;
|
107 |
+
padding: 16px;
|
108 |
+
border-top: 1px solid #ddd;
|
109 |
+
align-items: center;
|
110 |
+
justify-content: space-around;
|
111 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
+
@mixin chatbox-floating-button {
|
114 |
+
position: fixed;
|
115 |
+
bottom: 0;
|
116 |
+
right: 0;
|
117 |
+
width: 52px;
|
118 |
+
height: 52px;
|
119 |
+
color: #fff;
|
120 |
+
background-color: #0360a5;
|
121 |
+
background-position: center center;
|
122 |
+
background-repeat: no-repeat;
|
123 |
+
box-shadow: 12px 15px 20px 0 rgba(46, 61, 73, 0.15);
|
124 |
+
border: 0;
|
125 |
+
border-radius: 50%;
|
126 |
+
cursor: pointer;
|
127 |
+
}
|
128 |
|
129 |
+
h1 {
|
130 |
+
margin: 0;
|
131 |
+
font-size: 16px;
|
132 |
+
line-height: 1;
|
133 |
+
}
|
|
|
|
|
134 |
|
135 |
+
button {
|
136 |
+
color: inherit;
|
137 |
+
background-color: transparent;
|
138 |
+
border: 0;
|
139 |
+
outline: 0 !important;
|
140 |
+
cursor: pointer;
|
141 |
+
}
|
|
|
142 |
|
143 |
+
#center-text {
|
144 |
+
display: flex;
|
145 |
+
flex: 1;
|
146 |
+
flex-direction: column;
|
147 |
+
justify-content: center;
|
148 |
+
align-items: center;
|
149 |
+
height: 100%;
|
150 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
|
152 |
+
#chat-circle {
|
153 |
+
position: fixed;
|
154 |
+
bottom: 50px;
|
155 |
+
z-index: 1999;
|
156 |
+
align-items: center;
|
157 |
+
right: 50px;
|
158 |
+
background: #000;
|
159 |
+
width: 60px;
|
160 |
+
justify-content: center;
|
161 |
+
height: 60px;
|
162 |
+
display: flex;
|
163 |
+
border-radius: 50%;
|
164 |
+
color: white;
|
165 |
+
padding: 8px;
|
166 |
+
cursor: pointer;
|
167 |
+
box-shadow: 0px 3px 16px 0px rgba(0, 0, 0, 0.4),
|
168 |
+
0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
|
169 |
+
}
|
170 |
|
171 |
+
.btn#my-btn {
|
172 |
+
background: white;
|
173 |
+
padding-top: 13px;
|
174 |
+
padding-bottom: 12px;
|
175 |
+
border-radius: 45px;
|
176 |
+
padding-right: 40px;
|
177 |
+
padding-left: 40px;
|
178 |
+
color: #5865c3;
|
179 |
+
}
|
|
|
180 |
|
181 |
+
#chat-overlay {
|
182 |
+
background: rgba(255, 255, 255, 0.1);
|
183 |
+
position: absolute;
|
184 |
+
top: 0;
|
185 |
+
left: 0;
|
186 |
+
width: 100%;
|
187 |
+
height: 100%;
|
188 |
+
border-radius: 50%;
|
189 |
+
display: none;
|
190 |
+
}
|
|
|
|
|
|
|
|
|
191 |
|
192 |
+
.chat-box {
|
193 |
+
display: none;
|
194 |
+
background: #efefef;
|
195 |
+
position: fixed;
|
196 |
+
right: 30px;
|
197 |
+
z-index: 1999;
|
198 |
+
bottom: 50px;
|
199 |
+
width: 350px;
|
200 |
+
max-width: 85vw;
|
201 |
+
max-height: 100vh;
|
202 |
+
border-radius: 5px;
|
203 |
+
/* box-shadow: 0px 5px 35px 9px #464a92; */
|
204 |
+
box-shadow: 0px 5px 35px 9px #ccc;
|
205 |
+
}
|
206 |
|
207 |
+
.chat-box-toggle {
|
208 |
+
float: right;
|
209 |
+
margin-right: 15px;
|
210 |
+
cursor: pointer;
|
211 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
|
213 |
+
.chat-box-header {
|
214 |
+
background: #000;
|
215 |
+
height: 70px;
|
216 |
+
border-top-left-radius: 5px;
|
217 |
+
border-top-right-radius: 5px;
|
218 |
+
color: white;
|
219 |
+
text-align: center;
|
220 |
+
font-size: 20px;
|
221 |
+
padding-top: 17px;
|
222 |
+
padding-left: 36px;
|
223 |
+
}
|
224 |
|
225 |
+
.chat-box-body {
|
226 |
+
position: relative;
|
227 |
+
height: 370px;
|
228 |
+
height: auto;
|
229 |
+
border: 1px solid #ccc;
|
230 |
+
overflow: hidden;
|
231 |
+
}
|
|
|
|
|
|
|
|
|
|
|
232 |
|
233 |
+
.chat-box-body:after {
|
234 |
+
content: "";
|
235 |
+
background: #fff;
|
236 |
+
opacity: 0.1;
|
237 |
+
top: 0;
|
238 |
+
left: 0;
|
239 |
+
bottom: 0;
|
240 |
+
right: 0;
|
241 |
+
height: 100%;
|
242 |
+
position: absolute;
|
243 |
+
z-index: -1;
|
244 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
245 |
|
246 |
+
#chat_input {
|
247 |
+
background: #f4f7f9;
|
248 |
+
width: 100%;
|
249 |
+
position: relative;
|
250 |
+
height: 47px;
|
251 |
+
padding-top: 10px;
|
252 |
+
padding-right: 50px;
|
253 |
+
padding-bottom: 10px;
|
254 |
+
padding-left: 15px;
|
255 |
+
border: none;
|
256 |
+
resize: none;
|
257 |
+
outline: none;
|
258 |
+
border: 1px solid #ccc;
|
259 |
+
color: #888;
|
260 |
+
border-top: none;
|
261 |
+
border-bottom-right-radius: 5px;
|
262 |
+
border-bottom-left-radius: 5px;
|
263 |
+
overflow: hidden;
|
264 |
+
}
|
265 |
|
266 |
+
.chat_input > form {
|
267 |
+
margin-bottom: 0;
|
268 |
+
}
|
|
|
269 |
|
270 |
+
#chat_input::-webkit-input-placeholder {
|
271 |
+
/* Chrome/Opera/Safari */
|
272 |
+
color: #ccc;
|
273 |
+
}
|
274 |
|
275 |
+
#chat_input::-moz-placeholder {
|
276 |
+
/* Firefox 19+ */
|
277 |
+
color: #ccc;
|
278 |
+
}
|
279 |
|
280 |
+
#chat_input:-ms-input-placeholder {
|
281 |
+
/* IE 10+ */
|
282 |
+
color: #ccc;
|
283 |
+
}
|
284 |
|
285 |
+
#chat_input:-moz-placeholder {
|
286 |
+
/* Firefox 18- */
|
287 |
+
color: #ccc;
|
288 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
|
290 |
+
.chat-submit {
|
291 |
+
position: absolute;
|
292 |
+
bottom: 3px;
|
293 |
+
right: 10px;
|
294 |
+
background: transparent;
|
295 |
+
box-shadow: none;
|
296 |
+
border: none;
|
297 |
+
border-radius: 50%;
|
298 |
+
color: #000;
|
299 |
+
width: 35px;
|
300 |
+
height: 35px;
|
301 |
+
}
|
302 |
|
303 |
+
.chat_logs {
|
304 |
+
padding: 15px;
|
305 |
+
height: 370px;
|
306 |
+
overflow-y: scroll;
|
307 |
+
margin-bottom: 48px;
|
308 |
+
}
|
309 |
|
310 |
+
.chat_logs::-webkit-scrollbar-track {
|
311 |
+
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
312 |
+
background-color: #f5f5f5;
|
313 |
+
}
|
314 |
|
315 |
+
.chat_logs::-webkit-scrollbar {
|
316 |
+
width: 5px;
|
317 |
+
background-color: #f5f5f5;
|
318 |
+
}
|
319 |
|
320 |
+
.chat_logs::-webkit-scrollbar-thumb {
|
321 |
+
background-color: #000;
|
|
|
322 |
}
|
|
|
323 |
|
324 |
+
@media only screen and (max-width: 500px) {
|
325 |
+
.chat_logs {
|
326 |
+
height: 40vh;
|
327 |
+
}
|
328 |
+
}
|
|
|
|
|
329 |
|
330 |
+
.chat-msg.user > .msg-avatar img {
|
331 |
+
width: 45px;
|
332 |
+
height: 45px;
|
333 |
+
border-radius: 50%;
|
334 |
+
float: left;
|
335 |
+
width: 15%;
|
336 |
+
}
|
337 |
|
338 |
+
.chat-msg.self > .msg-avatar img {
|
339 |
+
width: 45px;
|
340 |
+
height: 45px;
|
341 |
+
border-radius: 50%;
|
342 |
+
float: right;
|
343 |
+
width: 15%;
|
344 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
345 |
|
346 |
+
.cm-msg-text {
|
347 |
+
z-index: 1999;
|
348 |
+
background: white;
|
349 |
+
padding: 10px 15px 10px 15px;
|
350 |
+
color: #666;
|
351 |
+
max-width: 75%;
|
352 |
+
float: left;
|
353 |
+
margin-left: 10px;
|
354 |
+
position: relative;
|
355 |
+
margin-bottom: 20px;
|
356 |
+
border-radius: 30px;
|
357 |
+
border-bottom-left-radius: 0px;
|
358 |
+
}
|
359 |
|
360 |
+
.svg-bot {
|
361 |
+
height: 24px;
|
362 |
+
width: 24px;
|
363 |
+
}
|
364 |
|
365 |
+
.chat-msg {
|
366 |
+
clear: both;
|
367 |
+
z-index: 1999;
|
368 |
+
}
|
|
|
|
|
|
|
|
|
369 |
|
370 |
+
.chat-msg.self > .cm-msg-text {
|
371 |
+
float: right;
|
372 |
+
margin-right: 10px;
|
373 |
+
border-radius: 30px;
|
374 |
+
border-bottom-right-radius: 0px;
|
375 |
+
background: #000;
|
376 |
+
color: white;
|
377 |
+
}
|
378 |
|
379 |
+
.cm-msg-button > ul > li {
|
380 |
+
list-style: none;
|
381 |
+
float: left;
|
382 |
+
width: 50%;
|
383 |
+
}
|
384 |
|
385 |
+
.cm-msg-button {
|
386 |
+
clear: both;
|
387 |
+
margin-bottom: 70px;
|
388 |
+
}
|
389 |
|
390 |
+
.chat-btn {
|
391 |
+
z-index: 1999;
|
392 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
393 |
|
394 |
+
.cancel {
|
395 |
+
display: none;
|
396 |
+
border: none;
|
397 |
+
border-radius: 5px;
|
398 |
+
background-color: #d6d6d6;
|
399 |
+
color: black;
|
400 |
+
z-index: 1999;
|
401 |
+
bottom: 3px;
|
402 |
+
position: absolute;
|
403 |
+
padding: 5px 10px;
|
404 |
+
margin: 0 108px;
|
405 |
+
}
|
406 |
|
407 |
+
[data-block^="list11-v4-1-1"] .vertical-list-item {
|
408 |
+
height: 100%;
|
409 |
+
overflow: hidden;
|
410 |
+
}
|
411 |
|
412 |
+
[data-block^="list11-v4-1-1"] .additional-elements-wrapper {
|
413 |
+
width: 100%;
|
414 |
+
}
|
415 |
|
416 |
+
[data-block^="list11-v4-1-1"] .label-wrapper.vertical {
|
417 |
+
flex-direction: column;
|
418 |
+
}
|
419 |
|
420 |
+
[data-block^="list11-v4-1-1"] .label-wrapper {
|
421 |
+
display: flex;
|
422 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
|
424 |
+
p,
|
425 |
+
h1,
|
426 |
+
h2,
|
427 |
+
h3,
|
428 |
+
h4,
|
429 |
+
h5,
|
430 |
+
small {
|
431 |
+
white-space: pre-line;
|
432 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
433 |
|
434 |
+
h1,
|
435 |
+
h2,
|
436 |
+
h3,
|
437 |
+
h4,
|
438 |
+
h5,
|
439 |
+
h6,
|
440 |
+
.h1,
|
441 |
+
.h2,
|
442 |
+
.h3,
|
443 |
+
.h4,
|
444 |
+
.h5,
|
445 |
+
.h6 {
|
446 |
+
margin-bottom: 0.25rem;
|
447 |
+
font-family: inherit;
|
448 |
+
font-weight: 400;
|
449 |
+
line-height: 1.1;
|
450 |
+
color: inherit;
|
451 |
+
}
|
452 |
|
453 |
+
[data-block^="list11-v4-1-1"] .list-container dl,
|
454 |
+
[data-block^="list11-v4-1-1"] .list-container h1,
|
455 |
+
[data-block^="list11-v4-1-1"] .list-container h2,
|
456 |
+
[data-block^="list11-v4-1-1"] .list-container h3,
|
457 |
+
[data-block^="list11-v4-1-1"] .list-container h4,
|
458 |
+
[data-block^="list11-v4-1-1"] .list-container h5,
|
459 |
+
[data-block^="list11-v4-1-1"] .list-container h6,
|
460 |
+
[data-block^="list11-v4-1-1"] .list-container ol,
|
461 |
+
[data-block^="list11-v4-1-1"] .list-container p,
|
462 |
+
[data-block^="list11-v4-1-1"] .list-container ul {
|
463 |
+
margin: 0;
|
464 |
+
padding: 0;
|
465 |
+
}
|
466 |
|
467 |
+
[data-block="list11-v4-1-1-b2"] .sw-text-align-center {
|
468 |
+
text-align: center !important;
|
469 |
+
}
|
470 |
|
471 |
+
[data-block="list11-v4-1-1-b2"] .sw-margin-top-none {
|
472 |
+
margin-top: 0rem !important;
|
473 |
+
}
|
474 |
|
475 |
+
[data-block="list11-v4-1-1-b2"] .sw-margin-bottom-none {
|
476 |
+
margin-bottom: 0rem !important;
|
477 |
+
}
|
478 |
|
479 |
+
[data-block="list11-v4-1-1-b2"] .sw-font-size-2xl {
|
480 |
+
font-size: 1.5rem !important;
|
481 |
+
}
|
482 |
|
483 |
+
[data-block="list11-v4-1-1-b2"] .sw-padding-bottom-5xs {
|
484 |
+
padding-bottom: 0.75rem !important;
|
485 |
+
}
|
486 |
|
487 |
+
[data-block="list11-v4-1-1-b2"] .sw-padding-top-none {
|
488 |
+
padding-top: 0rem !important;
|
489 |
+
}
|
490 |
|
491 |
+
[data-block="list11-v4-1-1-b2"] .sw-letter-spacing-normal {
|
492 |
+
letter-spacing: 0rem !important;
|
493 |
+
}
|
494 |
|
495 |
+
[data-block="list11-v4-1-1-b2"] .sw-text-color-0A0A0A {
|
496 |
+
color: #0a0a0a !important;
|
497 |
+
}
|
498 |
|
499 |
+
[data-block="list11-v4-1-1-b2"] .sw-padding-right-none {
|
500 |
+
padding-right: 0rem !important;
|
501 |
+
}
|
502 |
|
503 |
+
[data-block="list11-v4-1-1-b2"] .sw-padding-left-none {
|
504 |
+
padding-left: 0rem !important;
|
505 |
+
}
|
506 |
|
507 |
+
[data-block="list11-v4-1-1-b2"] .sw-font-weight-semibold {
|
508 |
+
font-weight: 600 !important;
|
509 |
+
}
|
510 |
|
511 |
+
h1.sw-text-color-default,
|
512 |
+
h2.sw-text-color-default,
|
513 |
+
h3.sw-font-family-default {
|
514 |
+
color: #000000;
|
515 |
+
}
|
516 |
|
517 |
+
h1.sw-font-weight-default,
|
518 |
+
h2.sw-font-weight-default,
|
519 |
+
h3.sw-font-family-default {
|
520 |
+
font-weight: 600;
|
521 |
+
}
|
522 |
|
523 |
+
h1.sw-font-family-default,
|
524 |
+
h2.sw-font-family-default,
|
525 |
+
h3.sw-font-family-default {
|
526 |
+
font-family: "IBM Plex Sans";
|
527 |
+
}
|
528 |
|
529 |
+
/* .bg-img {
|
530 |
background-image: url("./MU_LOGO_BLACK.jpg");
|
531 |
background-repeat: no-repeat;
|
532 |
position: relative;
|
|
|
534 |
background-size: cover;
|
535 |
} */
|
536 |
|
537 |
+
.marwadi {
|
538 |
+
width: 100vw;
|
539 |
+
height: 100vh;
|
540 |
+
text-align: center;
|
541 |
+
margin: auto;
|
542 |
+
font-size: xx-large;
|
543 |
+
font-weight: bolder;
|
544 |
+
display: flex;
|
545 |
+
flex-direction: column;
|
546 |
+
justify-content: center;
|
547 |
+
align-items: center;
|
548 |
+
}
|
549 |
+
|
550 |
+
.bestie {
|
551 |
+
margin: 1rem;
|
552 |
+
display: flex;
|
553 |
+
justify-content: center;
|
554 |
+
align-items: center;
|
555 |
+
text-align: center;
|
556 |
+
width: 100vw;
|
557 |
+
}
|
558 |
+
#user_id {
|
559 |
+
width: 20%;
|
560 |
+
height: 2rem;
|
561 |
+
border-radius: 5px;
|
562 |
+
border: 1px solid #000;
|
563 |
+
padding: 0.5rem;
|
564 |
+
font-size: medium;
|
565 |
+
}
|
566 |
+
|
567 |
+
.input-submit-button {
|
568 |
+
padding: 5px 10px;
|
569 |
+
background: gray;
|
570 |
+
color: white;
|
571 |
+
margin: 16px;
|
572 |
+
font-size: medium;
|
573 |
+
border-radius: 25px;
|
574 |
+
}
|
575 |
+
</style>
|
576 |
+
|
577 |
<div class="marwadi">
|
578 |
Welcome To AI Bestie
|
579 |
<div class="bestie">
|
580 |
<label>User Name</label>
|
581 |
+
<input type="text" id="user_id" oninput="enableSubmitButton()" />
|
582 |
+
<button class="input-submit-button" disabled id="submit-button">
|
583 |
+
Submit
|
584 |
+
</button>
|
585 |
+
</div>
|
586 |
</div>
|
587 |
<div id="chat-circle" class="btn btn-raised" style="">
|
588 |
<div id="chat-overlay"></div>
|
|
|
592 |
<div class="chat-box" style="display: none">
|
593 |
<div class="chat-box-header">
|
594 |
AI Bestie
|
595 |
+
<span class="chat-box-toggle"
|
596 |
+
><i class="material-icons">close</i></span
|
597 |
+
>
|
598 |
</div>
|
599 |
|
600 |
<div class="chat-box-body">
|
|
|
607 |
</div>
|
608 |
<div class="chat_input">
|
609 |
<form>
|
610 |
+
<input
|
611 |
+
type="text"
|
612 |
+
id="chat_input"
|
613 |
+
placeholder="Send a message..."
|
614 |
+
/>
|
615 |
<button type="submit" class="chat-submit" id="submit">
|
616 |
<i class="material-icons">send</i>
|
617 |
</button>
|
618 |
</form>
|
619 |
</div>
|
620 |
</div>
|
621 |
+
</div>
|
622 |
+
<!-- Scripts -->
|
623 |
+
<link
|
624 |
+
rel="stylesheet"
|
625 |
+
href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css"
|
626 |
+
/>
|
627 |
+
<link
|
628 |
+
rel="stylesheet"
|
629 |
+
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/4.0.2/bootstrap-material-design.css"
|
630 |
+
/>
|
631 |
+
<link
|
632 |
+
rel="stylesheet"
|
633 |
+
href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
634 |
+
/>
|
635 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
636 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
|
637 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css"></script>
|
638 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/4.0.2/bootstrap-material-design.css"></script>
|
639 |
+
<script id="rendered-js">
|
640 |
+
function enableSubmitButton() {
|
641 |
+
var user_id_input = document.getElementById("user_id");
|
642 |
+
var submit_button = document.getElementById("submit-button");
|
643 |
+
console.log(user_id_input.value)
|
644 |
+
submit_button.disabled = user_id_input.value === "";
|
645 |
+
submit_button.style.background = user_id_input.value === "" ? "gray" : "#000";
|
646 |
+
}
|
647 |
+
function chatWidget(id, name, status) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
648 |
$.ajax({
|
649 |
url: "/chatwidget",
|
650 |
type: "POST",
|
651 |
data: JSON.stringify({
|
652 |
+
user_id: id,
|
653 |
+
status: status,
|
654 |
+
user_name: name,
|
655 |
}),
|
656 |
headers: {
|
657 |
"Content-Type": "application/json",
|
|
|
|
|
658 |
},
|
|
|
659 |
success: function (data) {
|
660 |
+
if (status == "end") {
|
661 |
+
return true;
|
662 |
+
} else {
|
663 |
+
generate_message(data.response, "user");
|
664 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
665 |
},
|
666 |
});
|
667 |
+
}
|
668 |
+
// chatWidget(
|
669 |
+
// window.logged_in_user.airtable_record_id,
|
670 |
+
// window.logged_in_user.Name,
|
671 |
+
// "end"
|
672 |
+
// );
|
673 |
+
// setTimeout(() => {
|
674 |
+
// chatWidget(
|
675 |
+
// window.logged_in_user.airtable_record_id,
|
676 |
+
// window.logged_in_user.Name,
|
677 |
+
// "start"
|
678 |
+
// );
|
679 |
+
// }, 300);
|
680 |
+
function generate_message(msg, type) {
|
681 |
+
var str = "";
|
682 |
+
str += "<div id='cm-msg" + "' class=\"chat-msg " + type + '">';
|
683 |
+
str += ' <div class="cm-msg-text">';
|
684 |
+
var lines = msg.includes("\n") ? msg.split("\n") : [msg];
|
685 |
+
|
686 |
+
lines.forEach((line) => {
|
687 |
+
// Check if the line contains a URL
|
688 |
+
var urlRegex = /(https?:\/\/[^\s]+)/g;
|
689 |
+
var messageWithLinks = line.replace(
|
690 |
+
urlRegex,
|
691 |
+
'<a href="$1" target="_blank">$1</a>'
|
692 |
+
);
|
693 |
+
|
694 |
+
// Append the line with links to the message string
|
695 |
+
str += messageWithLinks;
|
696 |
+
|
697 |
+
// Only add <br> if not last line
|
698 |
+
if (line !== lines[lines.length - 1]) {
|
699 |
+
str += "<br>";
|
700 |
+
}
|
701 |
+
});
|
702 |
+
str += " <\/div>";
|
703 |
+
str += " <\/div>";
|
704 |
+
$(".chat_logs").append(str);
|
705 |
+
|
706 |
+
// Adjust scroll position
|
707 |
+
var chatLogs = document.getElementById("chat_logs");
|
708 |
+
chatLogs.scrollTop = chatLogs.scrollHeight;
|
709 |
+
}
|
710 |
+
|
711 |
+
function error_message(msg, type) {
|
712 |
+
INDEX++;
|
713 |
+
var str = "";
|
714 |
+
str += "<div id='cm-msg" + "' class=\"chat-msg " + type + '">';
|
715 |
+
str += ' <div class="cm-msg-text">';
|
716 |
+
var lines = msg.includes("\n") ? msg.split("\n") : [msg];
|
717 |
+
|
718 |
+
lines.forEach((line) => {
|
719 |
+
str += line;
|
720 |
+
|
721 |
+
// Only add <br> if not last line
|
722 |
+
if (line !== lines[lines.length - 1]) {
|
723 |
+
str += "<br>";
|
724 |
+
}
|
725 |
+
});
|
726 |
+
str += " <\/div>";
|
727 |
+
str += " <\/div>";
|
728 |
+
$("#chat_logs").append(str);
|
729 |
+
if (type == "self") {
|
730 |
+
$("#chat_input").val("");
|
731 |
+
}
|
732 |
+
$("#chat_logs")
|
733 |
+
.stop()
|
734 |
+
.animate({ scrollTop: $("#chat_logs")[0].scrollHeight }, 1000);
|
735 |
+
}
|
736 |
+
$(function () {
|
737 |
+
var INDEX = 0;
|
738 |
+
var input = document.getElementById("chat_input");
|
739 |
+
var submitBtn = document.getElementById("submit");
|
740 |
+
var cancelRequest = document.getElementById("cancel");
|
741 |
+
|
742 |
+
var userId = document.getElementById("user_id");
|
743 |
+
$("#cancel").click(function (e) {
|
744 |
+
input.disabled = false;
|
745 |
+
e.preventDefault();
|
746 |
+
submitBtn.disabled = false;
|
747 |
+
input.style.opacity = 1;
|
748 |
+
cancelRequest.style.display = "none";
|
749 |
+
});
|
750 |
+
|
751 |
+
$("#submit").click(function (e) {
|
752 |
+
cancelRequest.style.display = "block";
|
753 |
+
input.disabled = true;
|
754 |
+
input.style.opacity = 0.5;
|
755 |
+
submitBtn.disabled = true;
|
756 |
+
e.preventDefault();
|
757 |
+
var msg = $("#chat_input").val();
|
758 |
+
if (msg.trim() == "") {
|
759 |
+
return false;
|
760 |
+
}
|
761 |
+
generate_message(msg, "self");
|
762 |
+
input.value = "";
|
763 |
+
$.ajax({
|
764 |
+
url: "/chatwidget",
|
765 |
+
type: "POST",
|
766 |
+
data: JSON.stringify({
|
767 |
+
query: msg,
|
768 |
+
user_id: userId.value,
|
769 |
+
// message: `${msg} | ${window.logged_in_user.airtable_record_id}`,
|
770 |
+
}),
|
771 |
+
headers: {
|
772 |
+
"Content-Type": "application/json",
|
773 |
+
"Access-Control-Allow-Origin": "*",
|
774 |
+
"Access-Control-Allow-Headers": "Content-Type",
|
775 |
+
},
|
776 |
+
|
777 |
+
success: function (data) {
|
778 |
+
console.log(data);
|
779 |
+
/* data.map(item => generate_message(item.text, "user")) */
|
780 |
+
generate_message(data, "user");
|
781 |
+
/* generate_message(data.response, "user"); */
|
782 |
+
input.disabled = false;
|
783 |
+
submitBtn.disabled = false;
|
784 |
+
input.style.opacity = 1;
|
785 |
+
cancelRequest.style.display = "none";
|
786 |
+
},
|
787 |
+
error: function (data) {
|
788 |
+
error_message(
|
789 |
+
"We are sorry. we can't proceess Your Request Please Try again after some times.",
|
790 |
+
"user"
|
791 |
+
);
|
792 |
+
input.disabled = false;
|
793 |
+
submitBtn.disabled = false;
|
794 |
+
input.style.opacity = 1;
|
795 |
+
cancelRequest.style.display = "none";
|
796 |
+
},
|
797 |
+
});
|
798 |
+
});
|
799 |
+
$(document).delegate(".chat-btn", "click", function () {
|
800 |
+
var value = $(this).attr("chat-value");
|
801 |
+
var name = $(this).html();
|
802 |
+
$("#chat_input").attr("disabled", false);
|
803 |
+
generate_message(name);
|
804 |
+
});
|
805 |
+
|
806 |
+
$(".chat-box-toggle").click(function () {
|
807 |
+
$("#chat-circle").toggle("scale");
|
808 |
+
$(".chat-box").toggle("scale");
|
809 |
+
$("#sub-button").prop("disabled", false);
|
810 |
+
userId.disabled = "false"
|
811 |
+
location.reload();
|
812 |
+
});
|
813 |
});
|
814 |
|
815 |
+
$("#submit-button").click(function () {
|
816 |
$("#chat-circle").toggle("scale");
|
817 |
$(".chat-box").toggle("scale");
|
818 |
+
|
819 |
+
|
820 |
+
var input = document.getElementById("chat_input");
|
821 |
+
var submitBtn = document.getElementById("submit");
|
822 |
+
var cancelRequest = document.getElementById("cancel");
|
823 |
+
|
824 |
+
var userId = document.getElementById("user_id");
|
825 |
+
|
826 |
+
var submit_button = document.getElementById("submit-button");
|
827 |
+
submit_button.style.display = 'none'
|
828 |
+
user_id.style.border = 'none'
|
829 |
+
user_id.style.background = 'none'
|
830 |
+
userId.disabled = "true"
|
831 |
+
$("#sub-button").prop("disabled", true);
|
832 |
+
cancelRequest.style.display = "block";
|
833 |
input.disabled = true;
|
834 |
$.ajax({
|
835 |
url: "/start-session",
|
836 |
type: "POST",
|
837 |
data: JSON.stringify({
|
838 |
+
user_id: userId.value,
|
839 |
// message: `${msg} | ${window.logged_in_user.airtable_record_id}`,
|
840 |
}),
|
841 |
headers: {
|
842 |
"Content-Type": "application/json",
|
843 |
},
|
844 |
success: function (data) {
|
|
|
845 |
$.ajax({
|
846 |
+
url: "/chatwidget",
|
847 |
+
type: "POST",
|
848 |
+
data: JSON.stringify({
|
849 |
+
query: "START",
|
850 |
+
user_id: userId.value,
|
851 |
+
// message: `${msg} | ${window.logged_in_user.airtable_record_id}`,
|
852 |
+
}),
|
853 |
+
headers: {
|
854 |
+
"Content-Type": "application/json",
|
855 |
+
"Access-Control-Allow-Origin": "*",
|
856 |
+
"Access-Control-Allow-Headers": "Content-Type",
|
857 |
+
},
|
858 |
+
|
859 |
+
success: function (data) {
|
860 |
+
console.log(data);
|
861 |
+
/* data.map(item => generate_message(item.text, "user")) */
|
862 |
+
generate_message(data, "user");
|
863 |
+
/* generate_message(data.response, "user"); */
|
864 |
+
input.disabled = false;
|
865 |
+
submitBtn.disabled = false;
|
866 |
+
input.style.opacity = 1;
|
867 |
+
cancelRequest.style.display = "none";
|
868 |
+
},
|
869 |
+
error: function (data) {
|
870 |
+
error_message(
|
871 |
+
"We are sorry. we can't proceess Your Request Please Try again after some times.",
|
872 |
+
"user"
|
873 |
+
);
|
874 |
+
input.disabled = false;
|
875 |
+
submitBtn.disabled = false;
|
876 |
+
input.style.opacity = 1;
|
877 |
+
cancelRequest.style.display = "none";
|
878 |
+
},
|
879 |
+
});
|
880 |
if (status == "end") {
|
|
|
881 |
return true;
|
882 |
} else {
|
883 |
console.log(data.response, "session_id");
|
884 |
}
|
885 |
},
|
886 |
});
|
887 |
+
console.log(userId, userId.value);
|
888 |
});
|
889 |
+
</script>
|
890 |
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
891 |
+
</body>
|
892 |
+
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|