From f8af792dc2f2eb7d66f50f93541b098d7513ded5 Mon Sep 17 00:00:00 2001 From: hanishkvc Date: Tue, 11 Nov 2025 14:38:00 +0530 Subject: [PATCH] SimpleChatTCRV:UICleanup: ObjInfo dClassNames Distinguish between top level and remaining levels. More flexibility and also cleaner flow --- tools/server/public_simplechat/simplechat.js | 2 +- tools/server/public_simplechat/ui.mjs | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/server/public_simplechat/simplechat.js b/tools/server/public_simplechat/simplechat.js index 53a22db1e9..201452a64f 100644 --- a/tools/server/public_simplechat/simplechat.js +++ b/tools/server/public_simplechat/simplechat.js @@ -1677,7 +1677,7 @@ export class Me { modelPath: json["model_path"], ctxSize: json["default_generation_settings"]["n_ctx"] } - ui.ui_show_obj_props_info(elDiv, this, props, "Current Settings/Info (dev console document[gMe])", "", { legend: 'role-system' }) + ui.ui_show_obj_props_info(elDiv, this, props, "Current Settings/Info (dev console document[gMe])", "", { toplegend: 'role-system' }) }).catch(err=>console.log(`WARN:ShowInfo:${err}`)) } diff --git a/tools/server/public_simplechat/ui.mjs b/tools/server/public_simplechat/ui.mjs index 985bc322e7..019493481b 100644 --- a/tools/server/public_simplechat/ui.mjs +++ b/tools/server/public_simplechat/ui.mjs @@ -363,15 +363,14 @@ export function ui_show_obj_props_edit(elParent, propsTreeRoot, oObj, lProps, sL * @param {Array} lProps * @param {string} sLegend - the legend/title for the currrent block of properties * @param {string} sOffset - can be used to prefix each of the prop entries - * @param {any | undefined} dClassNames - can specify class for top level parent and legend + * @param {any | undefined} dClassNames - can specify class for toplegend and remaining levels parent and legend */ export function ui_show_obj_props_info(elParent, oObj, lProps, sLegend, sOffset="", dClassNames=undefined) { if (sOffset.length == 0) { let elDet = document.createElement("details"); let elSum = document.createElement("summary") - if (dClassNames['legend']) { - elSum.classList.add(dClassNames['legend']) - dClassNames['legend'] = undefined + if (dClassNames && dClassNames['toplegend']) { + elSum.classList.add(dClassNames['toplegend']) } elSum.appendChild(document.createTextNode(sLegend)) sLegend = "" @@ -381,7 +380,7 @@ export function ui_show_obj_props_info(elParent, oObj, lProps, sLegend, sOffset= elParent = elDet } let elPLegend = el_create_append_p(sLegend, elParent) - if (dClassNames) { + if ((dClassNames) && (sOffset.length > 0)) { if (dClassNames['parent']) { elParent.classList.add(dClassNames['parent']) } @@ -401,7 +400,7 @@ export function ui_show_obj_props_info(elParent, oObj, lProps, sLegend, sOffset= if (vtype != 'object') { el_create_append_p(`${kPrint}: ${oObj[k]}`, elS) } else { - ui_show_obj_props_info(elS, val, Object.keys(val), kPrint, `>${sOffset}`) + ui_show_obj_props_info(elS, val, Object.keys(val), kPrint, `>${sOffset}`, dClassNames) //el_create_append_p(`${k}:${JSON.stringify(oObj[k], null, " - ")}`, elS); } }