From 45f9db9963e3993ed0b24ab8896177bddae3ad97 Mon Sep 17 00:00:00 2001 From: hanishkvc Date: Fri, 24 Oct 2025 05:05:24 +0530 Subject: [PATCH] SimpleChatTC:Auto tool calling control to end user Instead of enforcing always explicit user triggered tool calling, now user is given the option whether to use explicit user triggered tool calling or to use auto triggering after showing tool details for a user specified amount of seconds. NOTE: The current logic doesnt account for user clicking the buttons before the autoclick triggers; need to cancel the auto clicks, if user triggers before autoclick, ie in future. --- tools/server/public_simplechat/simplechat.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/server/public_simplechat/simplechat.js b/tools/server/public_simplechat/simplechat.js index 6f4d55940c..13d8034c51 100644 --- a/tools/server/public_simplechat/simplechat.js +++ b/tools/server/public_simplechat/simplechat.js @@ -741,6 +741,11 @@ class MultiChatUI { this.elInToolName.dataset.tool_call_id = ar.ns.tool_calls[0].id this.elInToolArgs.value = ar.ns.tool_calls[0].function.arguments this.elBtnTool.disabled = false + if (gMe.tools.auto > 0) { + setTimeout(()=>{ + this.elBtnTool.click() + }, gMe.tools.auto*1000) + } } else { this.elDivTool.hidden = true this.elInToolName.value = "" @@ -808,6 +813,11 @@ class MultiChatUI { clearTimeout(this.idTimeOut) this.elInUser.value = ChatMessageEx.createToolCallResultAllInOne(id, name, data); this.ui_reset_userinput(false) + if (gMe.tools.auto > 0) { + setTimeout(()=>{ + this.elBtnUser.click() + }, gMe.tools.auto*1000) + } }) this.elInUser.addEventListener("keyup", (ev)=> { @@ -1033,7 +1043,8 @@ class Me { this.tools = { enabled: false, fetchProxyUrl: "http://127.0.0.1:3128", - toolNames: /** @type {Array} */([]) + toolNames: /** @type {Array} */([]), + auto: 0 }; this.chatProps = { apiEP: ApiEP.Type.Chat,