Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -128,11 +128,24 @@ def render_message(history):
|
|
128 |
return messages_html
|
129 |
|
130 |
js = """
|
131 |
-
function
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
|
|
|
|
|
|
|
|
|
|
|
136 |
"""
|
137 |
|
138 |
|
|
|
128 |
return messages_html
|
129 |
|
130 |
js = """
|
131 |
+
function Scrolldown() {
|
132 |
+
|
133 |
+
const messagesContainer = document.getElementById('messages');
|
134 |
+
|
135 |
+
const observer = new MutationObserver((mutationsList, observer) => {
|
136 |
+
for (const mutation of mutationsList) {
|
137 |
+
if (mutation.type === 'childList') {
|
138 |
+
const chatboxContainer = document.getElementById('chatbox-container');
|
139 |
+
chatboxContainer.scrollTop = chatboxContainer.scrollHeight;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
});
|
143 |
|
144 |
+
const config = { childList: true };
|
145 |
+
|
146 |
+
observer.observe(messagesContainer, config);
|
147 |
+
console.log('Observing')
|
148 |
+
}
|
149 |
"""
|
150 |
|
151 |
|