Skip to content

Commit a128f83

Browse files
committed
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.
1 parent 8b18473 commit a128f83

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tools/server/public_simplechat/simplechat.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,11 @@ class MultiChatUI {
741741
this.elInToolName.dataset.tool_call_id = ar.ns.tool_calls[0].id
742742
this.elInToolArgs.value = ar.ns.tool_calls[0].function.arguments
743743
this.elBtnTool.disabled = false
744+
if (gMe.tools.auto > 0) {
745+
setTimeout(()=>{
746+
this.elBtnTool.click()
747+
}, gMe.tools.auto*1000)
748+
}
744749
} else {
745750
this.elDivTool.hidden = true
746751
this.elInToolName.value = ""
@@ -808,6 +813,11 @@ class MultiChatUI {
808813
clearTimeout(this.idTimeOut)
809814
this.elInUser.value = ChatMessageEx.createToolCallResultAllInOne(id, name, data);
810815
this.ui_reset_userinput(false)
816+
if (gMe.tools.auto > 0) {
817+
setTimeout(()=>{
818+
this.elBtnUser.click()
819+
}, gMe.tools.auto*1000)
820+
}
811821
})
812822

813823
this.elInUser.addEventListener("keyup", (ev)=> {
@@ -1033,7 +1043,8 @@ class Me {
10331043
this.tools = {
10341044
enabled: false,
10351045
fetchProxyUrl: "http://127.0.0.1:3128",
1036-
toolNames: /** @type {Array<string>} */([])
1046+
toolNames: /** @type {Array<string>} */([]),
1047+
auto: 0
10371048
};
10381049
this.chatProps = {
10391050
apiEP: ApiEP.Type.Chat,

0 commit comments

Comments
 (0)