| // see https://github.com/gradio-app/gradio/issues/8253 | |
| // UNKNOWN LICENSE | |
| function Scrolldown() { | |
| let targetNode = document.querySelector('[aria-label="chatbot conversation"]') | |
| // Options for the observer (which mutations to observe) | |
| const config = { attributes: true, childList: true, subtree: true }; | |
| // Callback function to execute when mutations are observed | |
| const callback = (mutationList, observer) => { | |
| targetNode.scrollTop = targetNode.scrollHeight; | |
| }; | |
| // Create an observer instance linked to the callback function | |
| const observer = new MutationObserver(callback); | |
| // Start observing the target node for configured mutations | |
| observer.observe(targetNode, config); | |
| } |