diff --git a/examples/server/public_simplechat/simplechat.js b/examples/server/public_simplechat/simplechat.js index a2061e61b..8643ccbde 100644 --- a/examples/server/public_simplechat/simplechat.js +++ b/examples/server/public_simplechat/simplechat.js @@ -755,42 +755,43 @@ class Me { let inp = ui.el_creatediv_input("SetBaseURL", "BaseURL", "text", this.baseURL, (val)=>{ this.baseURL = val; }); - elDiv.appendChild(inp); + elDiv.appendChild(inp.div); inp = ui.el_creatediv_input("SetAuthorization", "Authorization", "text", this.headers["Authorization"], (val)=>{ this.headers["Authorization"] = val; }); - elDiv.appendChild(inp); + inp.el.placeholder = "Bearer OPENAI_API_KEY"; + elDiv.appendChild(inp.div); let bb = ui.el_creatediv_boolbutton("SetStream", "Stream", {true: "[+] yes stream", false: "[-] do oneshot"}, this.bStream, (val)=>{ this.bStream = val; }); - elDiv.appendChild(bb); + elDiv.appendChild(bb.div); bb = ui.el_creatediv_boolbutton("SetCompletionFreshChatAlways", "CompletionFreshChatAlways", {true: "[+] yes fresh", false: "[-] no, with history"}, this.bCompletionFreshChatAlways, (val)=>{ this.bCompletionFreshChatAlways = val; }); - elDiv.appendChild(bb); + elDiv.appendChild(bb.div); bb = ui.el_creatediv_boolbutton("SetCompletionInsertStandardRolePrefix", "CompletionInsertStandardRolePrefix", {true: "[+] yes insert", false: "[-] dont insert"}, this.bCompletionInsertStandardRolePrefix, (val)=>{ this.bCompletionInsertStandardRolePrefix = val; }); - elDiv.appendChild(bb); + elDiv.appendChild(bb.div); bb = ui.el_creatediv_boolbutton("SetTrimGarbage", "TrimGarbage", {true: "[+] yes trim", false: "[-] dont trim"}, this.bTrimGarbage, (val)=>{ this.bTrimGarbage = val; }); - elDiv.appendChild(bb); + elDiv.appendChild(bb.div); let sel = ui.el_creatediv_select("SetChatHistoryInCtxt", "ChatHistoryInCtxt", this.sRecentUserMsgCnt, this.iRecentUserMsgCnt, (val)=>{ this.iRecentUserMsgCnt = this.sRecentUserMsgCnt[val]; }); - elDiv.appendChild(sel); + elDiv.appendChild(sel.div); sel = ui.el_creatediv_select("SetApiEP", "ApiEndPoint", ApiEP.Type, this.apiEP, (val)=>{ this.apiEP = ApiEP.Type[val]; }); - elDiv.appendChild(sel); + elDiv.appendChild(sel.div); } diff --git a/examples/server/public_simplechat/ui.mjs b/examples/server/public_simplechat/ui.mjs index 89673bc21..bd2975827 100644 --- a/examples/server/public_simplechat/ui.mjs +++ b/examples/server/public_simplechat/ui.mjs @@ -100,9 +100,9 @@ export function el_creatediv_boolbutton(id, label, texts, defaultValue, cb) { lbl.setAttribute("for", id); lbl.innerText = label; div.appendChild(lbl); - let sel = el_create_boolbutton(id, texts, defaultValue, cb); - div.appendChild(sel); - return div; + let btn = el_create_boolbutton(id, texts, defaultValue, cb); + div.appendChild(btn); + return { div: div, el: btn }; } @@ -159,7 +159,7 @@ export function el_creatediv_select(id, label, options, defaultOption, cb) { div.appendChild(lbl); let sel = el_create_select(id, options,defaultOption, cb); div.appendChild(sel); - return div; + return { div: div, el: sel }; } @@ -185,7 +185,7 @@ export function el_create_input(id, type, defaultValue, cb) { } /** - * Create a div wrapped button which represents bool value using specified text wrt true and false. + * Create a div wrapped input. * * @param {string} id * @param {string} label @@ -201,5 +201,5 @@ export function el_creatediv_input(id, label, type, defaultValue, cb) { div.appendChild(lbl); let el = el_create_input(id, type, defaultValue, cb); div.appendChild(el); - return div; + return { div: div, el: el }; }