Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Web UI: Allow typing in textarea during generation #11565

Open
4 tasks done
mashdragon opened this issue Feb 1, 2025 · 2 comments · May be fixed by #11626
Open
4 tasks done

Feature Request: Web UI: Allow typing in textarea during generation #11565

mashdragon opened this issue Feb 1, 2025 · 2 comments · May be fixed by #11626
Labels
enhancement New feature or request

Comments

@mashdragon
Copy link
Contributor

Prerequisites

  • I am running the latest code. Mention the version if possible as well.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new and useful enhancement to share.

Feature Description

Currently, the Llama.cpp web UI does not let you type at all in the chat textarea during generation, which the previous version of the web UI lets you do. This feature request is to allow users to type in the textbox again in the new UI.

When the model is generating, if you press enter, it should:

  1. Stop the model from generating
  2. Insert your new message at the end of the current conversation
  3. Start generation again

Motivation

When you are running large models that don't output quickly, it is nice to draft your response before the model is finished generating. Sometimes I think about my response while it's still going, and I don't want it to end early.

Anyway, this also was the prior behaviour, so it should be restored.

Possible Implementation

This at least stops the textarea from being disabled:

diff --git a/examples/server/webui/index.html b/examples/server/webui/index.html
index d3893ea4..17609820 100644
--- a/examples/server/webui/index.html
+++ b/examples/server/webui/index.html
@@ -153,9 +153,8 @@
             class="textarea textarea-bordered w-full"
             placeholder="Type a message (Shift+Enter to add a new line)"
             v-model="inputMsg"
-            @keydown.enter.exact.prevent="sendMessage"
+            @keydown.enter.exact.prevent="isGenerating && stopGeneration(); sendMessage()"
             @keydown.enter.shift.exact.prevent="inputMsg += '\n'"
-            :disabled="isGenerating"
             id="msg-input"
             dir="auto"
           ></textarea>

But if you press Enter during generation, it puts your message out of order and does not resume generation:

Image

(Nothing more is generated and it's the user's turn again according to the UI.)

So, I would like some help from someone familiar with the web UI.

@mashdragon mashdragon added the enhancement New feature or request label Feb 1, 2025
@mashdragon
Copy link
Contributor Author

@ngxson I don't mean to bother, but do you have any suggestions? It appears you contributed a lot to the webui.

@woof-dog
Copy link

woof-dog commented Feb 3, 2025

No need to do all that in the enter handler. See my pull request, you have to wait for generateMessage to finish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants