SimpleChat:CompletionMode: Update readme/usage, trim textarea newline
Readme update wrt completion mode behavior. Usage help updated wrt completion mode behavior. When changing from input to textarea elment wrt user input, the last newline at the end of the user input wrt textarea, was forgotten to be filtered, this is fixed now. However if user wants to have a explicit newline they can using shift+enter to insert a newline, that wont be removed. The extra newline removal logic uses substring and keyup to keep things simple and avoid some previously noted bugs wrt other events in the key path as well as IME composition etal.
This commit is contained in:
parent
0dba8f8857
commit
7a0a42367f
2 changed files with 15 additions and 1 deletions
|
@ -47,6 +47,16 @@ Open this simple web front end from your local browser
|
|||
|
||||
Once inside
|
||||
* Select between chat and completion mode. By default it is set to chat mode.
|
||||
* in completion mode
|
||||
* the logic by default doesnt insert "THE_ROLE: " prefix wrt each role's message.
|
||||
If the model requires any prefix wrt user role messages, then the end user has to
|
||||
explicitly add the needed prefix, when they enter their chat message.
|
||||
This keeps the logic simple, while still giving flexibility to the end user to
|
||||
manage any templating/tagging requirement wrt their messages to the model.
|
||||
* the logic doesnt insert newline at the begining and end wrt the prompt message generated.
|
||||
However if the chat being sent to completion end point has more than one role's message,
|
||||
then insert newline when moving from one role's message to the next role's message, so
|
||||
that it can be clearly identified.
|
||||
* If you want to provide a system prompt, then ideally enter it first, before entering any user query.
|
||||
* if chat.add_system_begin is used
|
||||
* you cant change the system prompt, after it is has been submitted once along with user query.
|
||||
|
|
|
@ -16,8 +16,10 @@ class ApiEP {
|
|||
let gUsageMsg = `
|
||||
<ul>
|
||||
<li> Set system prompt above, to try control ai response charactersitic, if model supports same.</li>
|
||||
<li> + Completion mode normally wont have a system prompt.</li>
|
||||
<li> Enter your query to ai assistant below.</li>
|
||||
<li> Use shift+enter for inserting enter.</li>
|
||||
<li> + Completion mode doesnt insert user: prefix implicitly.</li>
|
||||
<li> + Use shift+enter for inserting enter/newline.</li>
|
||||
<li> Refresh the page to start over fresh.</li>
|
||||
</ul>
|
||||
`;
|
||||
|
@ -303,6 +305,8 @@ class MultiChatUI {
|
|||
// 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)) {
|
||||
let value = this.elInUser.value;
|
||||
this.elInUser.value = value.substring(0,value.length-1);
|
||||
this.elBtnUser.click();
|
||||
ev.preventDefault();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue