From f3f65895b66e12ff33d2822e2c62bc0ba4d3d53b Mon Sep 17 00:00:00 2001 From: hanishkvc Date: Sun, 23 Nov 2025 09:41:07 +0530 Subject: [PATCH] SimpleChatTCRV:Config:WIP: Move config fields into a Config class TODO: Rather than maintaining a reference to Me within SimpleChat, maintain an duplicated instance of the Config class in there, bcas that is what is needed in SimpleChat wrt Me. This should also avoid the seperete data object which was created yesterday to accomodate external_ai tool call. --- tools/server/public_simplechat/simplechat.js | 27 +++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/tools/server/public_simplechat/simplechat.js b/tools/server/public_simplechat/simplechat.js index 478929a793..7e5517b7df 100644 --- a/tools/server/public_simplechat/simplechat.js +++ b/tools/server/public_simplechat/simplechat.js @@ -1950,12 +1950,10 @@ const SearchURLS = { } -export class Me { +export class Config { constructor() { this.baseURL = "http://127.0.0.1:8080"; - this.defaultChatIds = [ "Default", "Other", AI_TC_SESSIONNAME ]; - this.multiChat = new MultiChatUI(this); this.tools = { enabled: true, proxyUrl: "http://127.0.0.1:3128", @@ -2014,6 +2012,29 @@ export class Me { //"frequency_penalty": 1.2, //"presence_penalty": 1.2, }; + } + + /** + * Clone a given instance of Config + * @param {Config} cloneMePlease + */ + static clone (cloneMePlease) { + let clonedData = structuredClone(cloneMePlease) + // Object.setPrototypeOf(clonedData, Config.prototype); + let newMe = new Config() + return Object.assign(newMe, clonedData) + } + +} + + + +export class Me { + + constructor() { + this.defaultChatIds = [ "Default", "Other", AI_TC_SESSIONNAME ]; + this.defaultCfg = new Config() + this.multiChat = new MultiChatUI(this); this.toolsMgr = new mTools.ToolsManager() /** * @type {(string | ArrayBuffer | null)[]}