reflex-chat
reflex-chat copied to clipboard
Autoscrolling
How to autoscroll the chat when bringing the chatgpt answer and that when entering each chat it always automatically scrolls down to the end?
I created an issue to make this easier: https://github.com/reflex-dev/reflex/issues/2834
I'll post the updated code onto the repo here soon, but my solution is to add id tags to each message, and then add this line in the process function:
# Set the processing flag.
chat.processing = True
# TODO: We need an `rx.scroll_to` function to simplify this.
yield rx.call_script(f"document.getElementById('message-{len(chat.messages) - 1}').scrollIntoView();")
Thanks !!
I am struggling to make this work. Please advise how to update the code in this repo?