Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -128,25 +128,9 @@ def render_message(history):
|
|
| 128 |
return messages_html
|
| 129 |
|
| 130 |
js = """
|
| 131 |
-
function
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
if (!targetNode) {
|
| 135 |
-
console.log("Chatbox container not found, retrying in 1 second...");
|
| 136 |
-
setTimeout(Scrolldown, 1000);
|
| 137 |
-
return;
|
| 138 |
-
}
|
| 139 |
-
|
| 140 |
-
console.log("Chatbox container found, setting up observer");
|
| 141 |
-
|
| 142 |
-
const config = { childList: true, subtree: true };
|
| 143 |
-
|
| 144 |
-
const callback = (mutationList, observer) => {
|
| 145 |
-
targetNode.scrollTop = targetNode.scrollHeight;
|
| 146 |
-
};
|
| 147 |
-
|
| 148 |
-
const observer = new MutationObserver(callback);
|
| 149 |
-
observer.observe(targetNode, config);
|
| 150 |
}
|
| 151 |
|
| 152 |
"""
|
|
|
|
| 128 |
return messages_html
|
| 129 |
|
| 130 |
js = """
|
| 131 |
+
function scrollToBottom() {
|
| 132 |
+
const chatboxContainer = document.getElementById('chatbox-container');
|
| 133 |
+
chatboxContainer.scrollTop = chatboxContainer.scrollHeight; // Scroll to the bottom
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
}
|
| 135 |
|
| 136 |
"""
|