Spaces:
Runtime error
Runtime error
widget minimizing
Browse files- static/chatbot.js +9 -7
static/chatbot.js
CHANGED
@@ -1,11 +1,13 @@
|
|
1 |
$(document).ready(function() {
|
2 |
// Initialize variables
|
3 |
-
var $
|
|
|
|
|
|
|
4 |
var $input = $('.chat-input input');
|
5 |
var $submit = $('.chat_submit');
|
6 |
-
var $chatContainer = $('.chat-container');
|
7 |
var session_id = '';
|
8 |
-
$
|
9 |
$(this).addClass('chat-message');
|
10 |
});
|
11 |
|
@@ -29,10 +31,10 @@ $(document).ready(function() {
|
|
29 |
} else {
|
30 |
$message.addClass('bot')
|
31 |
}
|
32 |
-
if ($
|
33 |
-
$
|
34 |
-
if ($
|
35 |
-
$
|
36 |
}
|
37 |
} else {
|
38 |
$('.chat-container').append($message);
|
|
|
1 |
$(document).ready(function() {
|
2 |
// Initialize variables
|
3 |
+
var $chatContainer = $('.chat-container');
|
4 |
+
var $chatHeader = $('.chat-header');
|
5 |
+
var $chatBody = $('.chat-body');
|
6 |
+
var $chatInput = $('.chat-input');
|
7 |
var $input = $('.chat-input input');
|
8 |
var $submit = $('.chat_submit');
|
|
|
9 |
var session_id = '';
|
10 |
+
$chatBody.children().each(function() {
|
11 |
$(this).addClass('chat-message');
|
12 |
});
|
13 |
|
|
|
31 |
} else {
|
32 |
$message.addClass('bot')
|
33 |
}
|
34 |
+
if ($chatBody) {
|
35 |
+
$chatBody.append($message);
|
36 |
+
if ($chatBody[0]) {
|
37 |
+
$chatBody.animate({scrollTop: $chatBody[0].scrollHeight}, 300);
|
38 |
}
|
39 |
} else {
|
40 |
$('.chat-container').append($message);
|