Skip to content

Commit 1e8787f

Browse files
committed
SimpleChat: Allow for chat req bool options to be user controlled
1 parent 0c7b359 commit 1e8787f

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

examples/server/public_simplechat/readme.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,15 @@ It is attached to the document object. Some of these can also be updated using t
177177
modify the existing options value or remove them, for now you can update this global var
178178
using browser's development-tools/console.
179179

180-
For string and numeric fields in chatRequestOptions, including even those added by a user
181-
at runtime by directly modifying gMe.chatRequestOptions, setting ui entries will be auto
180+
For string, numeric and boolean fields in chatRequestOptions, including even those added by a
181+
user at runtime by directly modifying gMe.chatRequestOptions, setting ui entries will be auto
182182
created.
183183

184+
cache_prompt option supported by example/server is allowed to be controlled by user. So that
185+
any caching supported with system-prompt and chat history if usable can get used. If one has
186+
enabled chat history sliding window, then the chat history caching may or maynot kick in at
187+
the backend, based on aspects related to positional encoding, attention mechanism etal.
188+
184189
headers - maintains the list of http headers sent when request is made to the server. By default
185190
Content-Type is set to application/json. Additionally Authorization entry is provided, which can
186191
be set if needed using the settings ui.

examples/server/public_simplechat/simplechat.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -835,16 +835,20 @@ class Me {
835835
for(const k in this.chatRequestOptions) {
836836
let val = this.chatRequestOptions[k];
837837
let type = typeof(val);
838-
if (!((type == "string") || (type == "number"))) {
839-
continue;
838+
if (((type == "string") || (type == "number"))) {
839+
let inp = ui.el_creatediv_input(`Set${k}`, k, typeDict[type], this.chatRequestOptions[k], (val)=>{
840+
if (type == "number") {
841+
val = Number(val);
842+
}
843+
this.chatRequestOptions[k] = val;
844+
});
845+
fs.appendChild(inp.div);
846+
} else if (type == "boolean") {
847+
let bbtn = ui.el_creatediv_boolbutton(`Set{k}`, k, {true: "true", false: "false"}, val, (userVal)=>{
848+
this.chatRequestOptions[k] = userVal;
849+
});
850+
fs.appendChild(bbtn.div);
840851
}
841-
let inp = ui.el_creatediv_input(`Set${k}`, k, typeDict[type], this.chatRequestOptions[k], (val)=>{
842-
if (type == "number") {
843-
val = Number(val);
844-
}
845-
this.chatRequestOptions[k] = val;
846-
});
847-
fs.appendChild(inp.div);
848852
}
849853
}
850854

0 commit comments

Comments
 (0)