SimpleChat: textarea for multiline user chat, inturn shift+enter 4 enter
This commit is contained in:
parent
c88088c7a1
commit
dfadac7813
2 changed files with 8 additions and 5 deletions
|
@ -30,14 +30,15 @@
|
|||
</div>
|
||||
<hr>
|
||||
<div id="chat">
|
||||
<p> Enter the system prompt above, before entering/submitting any user query</p>
|
||||
<p> Enter your text to the ai assistant below</p>
|
||||
<p> Refresh the page to start over fresh</p>
|
||||
<p> Enter the system prompt above, before entering/submitting any user query.</p>
|
||||
<p> Enter your text to the ai assistant below.</p>
|
||||
<p> Use shift+enter for inserting enter.</p>
|
||||
<p> Refresh the page to start over fresh.</p>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div class="sameline">
|
||||
<input type="text" id="user" class="flex-grow" />
|
||||
<textarea id="user" class="flex-grow" rows="3"></textarea>
|
||||
<button id="submit">submit</button>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -239,7 +239,9 @@ function startme() {
|
|||
});
|
||||
|
||||
inputUser?.addEventListener("keyup", (ev)=> {
|
||||
if (ev.key === "Enter") {
|
||||
// allow user to insert enter into their message using shift+enter.
|
||||
// while just pressing enter key will lead to submitting.
|
||||
if ((ev.key === "Enter") && (!ev.shiftKey)) {
|
||||
btnSubmit?.click();
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue