Skip to content

Commit 12dab21

Browse files
committed
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.
1 parent 36b8361 commit 12dab21

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

examples/server/public_simplechat/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<hr>
3333
<div class="sameline">
3434
<label for="system-in">System</label>
35-
<input type="text" name="system" id="system-in" placeholder="e.g. you are a helpful ai assistant, who provides concise answers" class="flex-grow"/>
35+
<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>
3636
</div>
3737

3838
<hr>
@@ -42,7 +42,7 @@
4242

4343
<hr>
4444
<div class="sameline">
45-
<textarea id="user-in" class="flex-grow" rows="3" placeholder="enter your query to the ai model here" ></textarea>
45+
<textarea id="user-in" class="flex-grow" rows="2" placeholder="enter your query to the ai model here" ></textarea>
4646
<button id="user-btn">submit</button>
4747
</div>
4848

examples/server/public_simplechat/simplechat.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,15 @@ class ApiEP {
3939
let gUsageMsg = `
4040
<p class="role-system">Usage</p>
4141
<ul class="ul1">
42-
<li> Set system prompt above, to try control ai response charactersitic, if model supports same.</li>
42+
<li> System prompt above, to try control ai response characteristics.</li>
4343
<ul class="ul2">
44-
<li> Completion mode normally wont have a system prompt.</li>
44+
<li> Completion mode - no system prompt normally.</li>
4545
</ul>
46+
<li> Use shift+enter for inserting enter/newline.</li>
4647
<li> Enter your query to ai assistant below.</li>
47-
<ul class="ul2">
48-
<li> Completion mode doesnt insert user/role: prefix implicitly.</li>
49-
<li> Use shift+enter for inserting enter/newline.</li>
50-
</ul>
5148
<li> Default ContextWindow = [System, Last Query+Resp, Cur Query].</li>
5249
<ul class="ul2">
53-
<li> experiment iRecentUserMsgCnt, max_tokens, model ctxt window to expand</li>
50+
<li> ChatHistInCtxt, MaxTokens, ModelCtxt window to expand</li>
5451
</ul>
5552
</ul>
5653
`;
@@ -542,6 +539,8 @@ class MultiChatUI {
542539
// allow user to insert enter into the system prompt using shift+enter.
543540
// while just pressing enter key will lead to setting the system prompt.
544541
if ((ev.key === "Enter") && (!ev.shiftKey)) {
542+
let value = this.elInSystem.value;
543+
this.elInSystem.value = value.substring(0,value.length-1);
545544
let chat = this.simpleChats[this.curChatId];
546545
chat.add_system_anytime(this.elInSystem.value, this.curChatId);
547546
chat.show(this.elDivChat);

0 commit comments

Comments
 (0)