oobabooga / text-generation-webui

A Gradio web UI for Large Language Models.
GNU Affero General Public License v3.0
39.57k stars 5.2k forks source link

Render the output without refocusing the cursor on the screen #6273

Open srevenant opened 1 month ago

srevenant commented 1 month ago

Description

The UI constantly re-focuses the cursor during rendering, so it is impossible to copy results while they are being rendered. Compare this to ChatGPT where you can copy text during rendering. For long or slow output, this is really relevant.

I don't know anything about the framework in use w/Python, or I'd try to dive in and fix it.

oobabooga commented 1 month ago

I agree that this is not ideal. It happens because the entire chat HTML is updated for each new token and passed as input to a gr.HTML element, namely:

https://github.com/oobabooga/text-generation-webui/blob/498fec2c7c7df376007f264261acfcfcb76168ea/modules/ui_chat.py#L26

If you can think of a simple way to improve this a PR would be welcome.

srevenant commented 1 month ago

hmm. have you thought about a different frontend framework? React w/API is powerful, that's where I usually end up.

jjlee commented 1 month ago

@srevenant Might be something the gradio people are interested in supporting upstream if you raise a relevant feature request there?