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.
This commit is contained in:
hanishkvc 2025-10-24 05:05:24 +05:30
parent 9e97880dde
commit 45f9db9963
1 changed files with 12 additions and 1 deletions

View File

@ -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<string>} */([])
toolNames: /** @type {Array<string>} */([]),
auto: 0
};
this.chatProps = {
apiEP: ApiEP.Type.Chat,