SimpleChatTC: Add ui elements for tool call verify and trigger

Instead of automatically calling the requested tool with supplied
arguments, rather allow user to verify things before triggering the
tool.

NOTE: User already provided control over tool_response before
submitting it to the ai assistant.
This commit is contained in:
hanishkvc 2025-10-13 00:41:19 +05:30
parent fd662b4b0b
commit 1fc44c971d
2 changed files with 22 additions and 1 deletions

View File

@ -40,6 +40,15 @@
<p> You need to have javascript enabled.</p>
</div>
<hr>
<div id="tool-div">
<div class="sameline">
<textarea id="toolname-in" rows="1" placeholder="name of tool to run"></textarea>
<button id="tool-btn">run tool</button>
</div>
<textarea id="toolargs-in" class="flex-grow" rows="2" placeholder="arguments to pass to the specified tool"></textarea>
</div>
<hr>
<div class="sameline">
<textarea id="user-in" class="flex-grow" rows="2" placeholder="enter your query to the ai model here" ></textarea>

View File

@ -91,7 +91,11 @@ let gUsageMsg = `
<li> Completion mode - no system prompt normally.</li>
</ul>
<li> Use shift+enter for inserting enter/newline.</li>
<li> Enter your query to ai assistant below.</li>
<li> Enter your query to ai assistant in textarea provided below.</li>
<li> If ai assistant requests a tool call, varify same before triggering it.</li>
<ul class="ul2">
<li> submit tool response placed into user query textarea</li>
</ul>
<li> Default ContextWindow = [System, Last Query+Resp, Cur Query].</li>
<ul class="ul2">
<li> ChatHistInCtxt, MaxTokens, ModelCtxt window to expand</li>
@ -562,6 +566,10 @@ class MultiChatUI {
this.elDivHeading = /** @type{HTMLSelectElement} */(document.getElementById("heading"));
this.elDivSessions = /** @type{HTMLDivElement} */(document.getElementById("sessions-div"));
this.elBtnSettings = /** @type{HTMLButtonElement} */(document.getElementById("settings"));
this.elDivTool = /** @type{HTMLDivElement} */(document.getElementById("tool-div"));
this.elBtnTool = /** @type{HTMLButtonElement} */(document.getElementById("tool-btn"));
this.elInToolName = /** @type{HTMLInputElement} */(document.getElementById("toolname-in"));
this.elInToolArgs = /** @type{HTMLInputElement} */(document.getElementById("toolargs-in"));
this.validate_element(this.elInSystem, "system-in");
this.validate_element(this.elDivChat, "chat-div");
@ -569,6 +577,10 @@ class MultiChatUI {
this.validate_element(this.elDivHeading, "heading");
this.validate_element(this.elDivChat, "sessions-div");
this.validate_element(this.elBtnSettings, "settings");
this.validate_element(this.elDivTool, "tool-div");
this.validate_element(this.elInToolName, "toolname-in");
this.validate_element(this.elInToolArgs, "toolargs-in");
this.validate_element(this.elBtnTool, "tool-btn");
}
/**