From dac97c1e8fa499ccc6bebf388526ca9af292c1e5 Mon Sep 17 00:00:00 2001 From: hanishkvc Date: Tue, 11 Nov 2025 12:52:25 +0530 Subject: [PATCH] SimpleChatTCRV:UI Cleanup: DetailsNotDiv Current settings info So that we dont overload users with the details by default, but user can open or close the block of current settings info details. --- tools/server/public_simplechat/simplechat.js | 2 +- tools/server/public_simplechat/ui.mjs | 28 +++++++++++++------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/tools/server/public_simplechat/simplechat.js b/tools/server/public_simplechat/simplechat.js index 3076763d51..53a22db1e9 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, "Settings/Info (devel-tools-console document[gMe])", "", { legend: 'role-system' }) + ui.ui_show_obj_props_info(elDiv, this, props, "Current Settings/Info (dev console document[gMe])", "", { legend: '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 159234b60a..985bc322e7 100644 --- a/tools/server/public_simplechat/ui.mjs +++ b/tools/server/public_simplechat/ui.mjs @@ -356,27 +356,37 @@ export function ui_show_obj_props_edit(elParent, propsTreeRoot, oObj, lProps, sL /** * Show the specified properties and their values wrt the given object, * with in the elParent provided. + * Uses recursion to show embedded objects. + * * @param {HTMLDivElement | HTMLElement} elParent * @param {any} oObj * @param {Array} lProps - * @param {string} sLegend + * @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 div and legend + * @param {any | undefined} dClassNames - can specify class for top level parent and legend */ export function ui_show_obj_props_info(elParent, oObj, lProps, sLegend, sOffset="", dClassNames=undefined) { if (sOffset.length == 0) { - let div = document.createElement("div"); - div.classList.add(`DivObjPropsInfoL${sOffset.length}`) - elParent.appendChild(div) - elParent = div + let elDet = document.createElement("details"); + let elSum = document.createElement("summary") + if (dClassNames['legend']) { + elSum.classList.add(dClassNames['legend']) + dClassNames['legend'] = undefined + } + elSum.appendChild(document.createTextNode(sLegend)) + sLegend = "" + elDet.appendChild(elSum) + elDet.classList.add(`DivObjPropsInfoL${sOffset.length}`) + elParent.appendChild(elDet) + elParent = elDet } let elPLegend = el_create_append_p(sLegend, elParent) if (dClassNames) { - if (dClassNames['div']) { - elParent.className = dClassNames['div'] + if (dClassNames['parent']) { + elParent.classList.add(dClassNames['parent']) } if (dClassNames['legend']) { - elPLegend.className = dClassNames['legend'] + elPLegend.classList.add(dClassNames['legend']) } } let elS = document.createElement("section");