SimpleChat: Allow for multiline system prompt

Convert SystemPrompt into a textarea with 2 rows. Reduce
user-input-textarea to 2 rows from 3, so that overall
vertical space usage remains same.

Shorten usage messages a bit, cleanup to sync with settings ui.
This commit is contained in:
HanishKVC 2024-05-30 10:47:18 +05:30
parent 3d925cbdc9
commit 1d7739b7f5
2 changed files with 8 additions and 9 deletions

View file

@ -32,7 +32,7 @@
<hr> <hr>
<div class="sameline"> <div class="sameline">
<label for="system-in">System</label> <label for="system-in">System</label>
<input type="text" name="system" id="system-in" placeholder="e.g. you are a helpful ai assistant, who provides concise answers" class="flex-grow"/> <textarea name="system" id="system-in" rows="2" placeholder="e.g. you are a helpful ai assistant, who provides concise answers" class="flex-grow"></textarea>
</div> </div>
<hr> <hr>
@ -42,7 +42,7 @@
<hr> <hr>
<div class="sameline"> <div class="sameline">
<textarea id="user-in" class="flex-grow" rows="3" placeholder="enter your query to the ai model here" ></textarea> <textarea id="user-in" class="flex-grow" rows="2" placeholder="enter your query to the ai model here" ></textarea>
<button id="user-btn">submit</button> <button id="user-btn">submit</button>
</div> </div>

View file

@ -39,18 +39,15 @@ class ApiEP {
let gUsageMsg = ` let gUsageMsg = `
<p class="role-system">Usage</p> <p class="role-system">Usage</p>
<ul class="ul1"> <ul class="ul1">
<li> Set system prompt above, to try control ai response charactersitic, if model supports same.</li> <li> System prompt above, to try control ai response characteristics.</li>
<ul class="ul2"> <ul class="ul2">
<li> Completion mode normally wont have a system prompt.</li> <li> Completion mode - no system prompt normally.</li>
</ul> </ul>
<li> Use shift+enter for inserting enter/newline.</li>
<li> Enter your query to ai assistant below.</li> <li> Enter your query to ai assistant below.</li>
<ul class="ul2">
<li> Completion mode doesnt insert user/role: prefix implicitly.</li>
<li> Use shift+enter for inserting enter/newline.</li>
</ul>
<li> Default ContextWindow = [System, Last Query+Resp, Cur Query].</li> <li> Default ContextWindow = [System, Last Query+Resp, Cur Query].</li>
<ul class="ul2"> <ul class="ul2">
<li> experiment iRecentUserMsgCnt, max_tokens, model ctxt window to expand</li> <li> ChatHistInCtxt, MaxTokens, ModelCtxt window to expand</li>
</ul> </ul>
</ul> </ul>
`; `;
@ -542,6 +539,8 @@ class MultiChatUI {
// allow user to insert enter into the system prompt using shift+enter. // allow user to insert enter into the system prompt using shift+enter.
// while just pressing enter key will lead to setting the system prompt. // while just pressing enter key will lead to setting the system prompt.
if ((ev.key === "Enter") && (!ev.shiftKey)) { if ((ev.key === "Enter") && (!ev.shiftKey)) {
let value = this.elInSystem.value;
this.elInSystem.value = value.substring(0,value.length-1);
let chat = this.simpleChats[this.curChatId]; let chat = this.simpleChats[this.curChatId];
chat.add_system_anytime(this.elInSystem.value, this.curChatId); chat.add_system_anytime(this.elInSystem.value, this.curChatId);
chat.show(this.elDivChat); chat.show(this.elDivChat);