Skip to content

Commit 1c5bf66

Browse files
committed
SimpleChatTC:Fixup auto toolcall wrt newer ChatShow flow
This is a initial go wrt the new overall flow, should work, but need to cross check.
1 parent e4d2ca0 commit 1c5bf66

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tools/server/public_simplechat/simplechat.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -867,15 +867,16 @@ class MultiChatUI {
867867
/**
868868
* Reset/Setup Tool Call UI parts as needed
869869
* @param {ChatMessageEx} ar
870+
* @param {boolean} bAuto
870871
*/
871-
ui_reset_toolcall_as_needed(ar) {
872+
ui_reset_toolcall_as_needed(ar, bAuto = false) {
872873
if (ar.has_toolcall()) {
873874
this.elDivTool.hidden = false
874875
this.elInToolName.value = ar.ns.tool_calls[0].function.name
875876
this.elInToolName.dataset.tool_call_id = ar.ns.tool_calls[0].id
876877
this.elInToolArgs.value = ar.ns.tool_calls[0].function.arguments
877878
this.elBtnTool.disabled = false
878-
if (gMe.tools.auto > 0) {
879+
if ((gMe.tools.auto > 0) && (bAuto)) {
879880
this.timers.toolcallTriggerClick = setTimeout(()=>{
880881
this.elBtnTool.click()
881882
}, gMe.tools.auto*this.TimePeriods.ToolCallAutoTimeUnit)
@@ -976,16 +977,18 @@ class MultiChatUI {
976977
}
977978
// Handle tool call ui, if reqd
978979
let bTC = false
980+
let bAuto = false
979981
if (msg.ns.role === Roles.Assistant) {
980982
if (iFromLast == 0) {
981983
bTC = true
984+
bAuto = true
982985
} else if ((iFromLast == 1) && (nextMsg != undefined)) {
983986
if (nextMsg.ns.role == Roles.ToolTemp) {
984987
bTC = true
985988
}
986989
}
987990
if (bTC) {
988-
this.ui_reset_toolcall_as_needed(msg);
991+
this.ui_reset_toolcall_as_needed(msg, bAuto);
989992
}
990993
}
991994
// Handle tool call non ui

0 commit comments

Comments
 (0)