SimpleChatTC:Cleanup:ChatProps: bCompletionInsertStandardRolePrefix

This commit is contained in:
hanishkvc 2025-10-22 00:11:14 +05:30
parent 734f74c908
commit 82be13aa33
2 changed files with 7 additions and 7 deletions

View File

@ -205,6 +205,9 @@ It is attached to the document object. Some of these can also be updated using t
bCompletionFreshChatAlways - whether Completion mode collates complete/sliding-window history when bCompletionFreshChatAlways - whether Completion mode collates complete/sliding-window history when
communicating with the server or only sends the latest user query/message. communicating with the server or only sends the latest user query/message.
bCompletionInsertStandardRolePrefix - whether Completion mode inserts role related prefix wrt the
messages that get inserted into prompt field wrt /Completion endpoint.
tools - contains controls related to tool calling tools - contains controls related to tool calling
enabled - control whether tool calling is enabled or not enabled - control whether tool calling is enabled or not
@ -224,9 +227,6 @@ It is attached to the document object. Some of these can also be updated using t
apiEP - select between /completions and /chat/completions endpoint provided by the server/ai-model. apiEP - select between /completions and /chat/completions endpoint provided by the server/ai-model.
bCompletionInsertStandardRolePrefix - whether Completion mode inserts role related prefix wrt the
messages that get inserted into prompt field wrt /Completion endpoint.
bTrimGarbage - whether garbage repeatation at the end of the generated ai response, should be bTrimGarbage - whether garbage repeatation at the end of the generated ai response, should be
trimmed or left as is. If enabled, it will be trimmed so that it wont be sent back as part of trimmed or left as is. If enabled, it will be trimmed so that it wont be sent back as part of
subsequent chat history. At the same time the actual trimmed text is shown to the user, once subsequent chat history. At the same time the actual trimmed text is shown to the user, once

View File

@ -509,7 +509,7 @@ class SimpleChat {
if (apiEP == ApiEP.Type.Chat) { if (apiEP == ApiEP.Type.Chat) {
return this.request_messages_jsonstr(); return this.request_messages_jsonstr();
} else { } else {
return this.request_prompt_jsonstr(gMe.bCompletionInsertStandardRolePrefix); return this.request_prompt_jsonstr(gMe.chatProps.bCompletionInsertStandardRolePrefix);
} }
} }
@ -1023,8 +1023,8 @@ class Me {
stream: true, stream: true,
iRecentUserMsgCnt: 10, iRecentUserMsgCnt: 10,
bCompletionFreshChatAlways: true, bCompletionFreshChatAlways: true,
bCompletionInsertStandardRolePrefix: false,
}; };
this.bCompletionInsertStandardRolePrefix = false;
this.bTrimGarbage = true; this.bTrimGarbage = true;
/** @type {Object<string, number>} */ /** @type {Object<string, number>} */
this.sRecentUserMsgCnt = { this.sRecentUserMsgCnt = {
@ -1094,7 +1094,7 @@ class Me {
* @param {boolean} bAll * @param {boolean} bAll
*/ */
show_info(elDiv, bAll=false) { show_info(elDiv, bAll=false) {
let props = ["baseURL", "modelInfo","headers", "tools", "apiRequestOptions", "apiEP", "chatProps", "bTrimGarbage", "bCompletionInsertStandardRolePrefix"]; let props = ["baseURL", "modelInfo","headers", "tools", "apiRequestOptions", "apiEP", "chatProps", "bTrimGarbage"];
if (!bAll) { if (!bAll) {
props = [ "baseURL", "modelInfo", "headers", "tools", "apiRequestOptions", "apiEP", "chatProps" ]; props = [ "baseURL", "modelInfo", "headers", "tools", "apiRequestOptions", "apiEP", "chatProps" ];
} }
@ -1112,7 +1112,7 @@ class Me {
* @param {HTMLDivElement} elDiv * @param {HTMLDivElement} elDiv
*/ */
show_settings(elDiv) { show_settings(elDiv) {
ui.ui_show_obj_props_edit(elDiv, "", this, ["baseURL", "headers", "tools", "apiRequestOptions", "apiEP", "chatProps", "bTrimGarbage", "bCompletionInsertStandardRolePrefix"], "Settings", (prop, elProp)=>{ ui.ui_show_obj_props_edit(elDiv, "", this, ["baseURL", "headers", "tools", "apiRequestOptions", "apiEP", "chatProps", "bTrimGarbage"], "Settings", (prop, elProp)=>{
if (prop == "headers:Authorization") { if (prop == "headers:Authorization") {
// @ts-ignore // @ts-ignore
elProp.placeholder = "Bearer OPENAI_API_KEY"; elProp.placeholder = "Bearer OPENAI_API_KEY";