SimpleChatTC:Cleanup in general

Update readme wrt searchDrops, auto settings ui creation

Rename tools-auto to tools-autoSecs, to make it easy to realise
that the value represents seconds.
This commit is contained in:
hanishkvc 2025-11-03 23:13:12 +05:30
parent c316f5a2bd
commit c5ff065ad2
2 changed files with 12 additions and 8 deletions

View File

@ -263,6 +263,10 @@ It is attached to the document object. Some of these can also be updated using t
* searchUrl - specify the search engine's search url template along with the tag SEARCHWORDS in place where the search words should be substituted at runtime. * searchUrl - specify the search engine's search url template along with the tag SEARCHWORDS in place where the search words should be substituted at runtime.
* searchDrops - allows one to drop contents of html tags with specified id from the plain text search result.
* specify a list of dicts, where each dict should contain a 'tag' entry specifying the tag to filter like div or p or ... and also a 'id' entry which specifies the id of interest.
* iResultMaxDataLength - specify what amount of any tool call result should be sent back to the ai engine server. * iResultMaxDataLength - specify what amount of any tool call result should be sent back to the ai engine server.
* specifying 0 disables this truncating of the results, and inturn full result will be sent to the ai engine server. * specifying 0 disables this truncating of the results, and inturn full result will be sent to the ai engine server.
@ -271,7 +275,7 @@ It is attached to the document object. Some of these can also be updated using t
before a default timed out error response is generated and control given back to end user, for them to decide whether before a default timed out error response is generated and control given back to end user, for them to decide whether
to submit the error response or wait for actual tool call response further. to submit the error response or wait for actual tool call response further.
* auto - the amount of time in seconds to wait before the tool call request is auto triggered and generated response is auto submitted back. * autoSecs - the amount of time in seconds to wait before the tool call request is auto triggered and generated response is auto submitted back.
setting this value to 0 (default), disables auto logic, so that end user can review the tool calls requested by ai and if needed even modify them, before triggering/executing them as well as review and modify results generated by the tool call, before submitting them back to the ai. setting this value to 0 (default), disables auto logic, so that end user can review the tool calls requested by ai and if needed even modify them, before triggering/executing them as well as review and modify results generated by the tool call, before submitting them back to the ai.
@ -285,7 +289,7 @@ It is attached to the document object. Some of these can also be updated using t
If you want to add additional options/fields to send to the server/ai-model, and or modify the existing options value or remove them, for now you can update this global var using browser's development-tools/console. If you want to add additional options/fields to send to the server/ai-model, and or modify the existing options value or remove them, for now you can update this global var using browser's development-tools/console.
For string, numeric and boolean fields in apiRequestOptions, including even those added by a user at runtime by directly modifying gMe.apiRequestOptions, setting ui entries will be auto created. For string, numeric, boolean, object fields in apiRequestOptions, including even those added by a user at runtime by directly modifying gMe.apiRequestOptions, setting ui entries will be auto created.
cache_prompt option supported by example/server is allowed to be controlled by user, so that any caching supported wrt system-prompt and chat history, if usable can get used. When chat history sliding window is enabled, cache_prompt logic may or may not kick in at the backend wrt same, based on aspects related to model, positional encoding, attention mechanism etal. However system prompt should ideally get the benefit of caching. cache_prompt option supported by example/server is allowed to be controlled by user, so that any caching supported wrt system-prompt and chat history, if usable can get used. When chat history sliding window is enabled, cache_prompt logic may or may not kick in at the backend wrt same, based on aspects related to model, positional encoding, attention mechanism etal. However system prompt should ideally get the benefit of caching.

View File

@ -762,7 +762,7 @@ class MultiChatUI {
this.curChatId = ""; this.curChatId = "";
this.TimePeriods = { this.TimePeriods = {
ToolCallAutoTimeUnit: 1000 ToolCallAutoSecsTimeUnit: 1000
} }
this.timers = { this.timers = {
@ -840,10 +840,10 @@ class MultiChatUI {
this.elInToolName.dataset.tool_call_id = ar.ns.tool_calls[0].id this.elInToolName.dataset.tool_call_id = ar.ns.tool_calls[0].id
this.elInToolArgs.value = ar.ns.tool_calls[0].function.arguments this.elInToolArgs.value = ar.ns.tool_calls[0].function.arguments
this.elBtnTool.disabled = false this.elBtnTool.disabled = false
if ((gMe.tools.auto > 0) && (bAuto)) { if ((gMe.tools.autoSecs > 0) && (bAuto)) {
this.timers.toolcallTriggerClick = setTimeout(()=>{ this.timers.toolcallTriggerClick = setTimeout(()=>{
this.elBtnTool.click() this.elBtnTool.click()
}, gMe.tools.auto*this.TimePeriods.ToolCallAutoTimeUnit) }, gMe.tools.autoSecs*this.TimePeriods.ToolCallAutoSecsTimeUnit)
} }
} else { } else {
this.elDivTool.hidden = true this.elDivTool.hidden = true
@ -1066,10 +1066,10 @@ class MultiChatUI {
} }
chat.add(new ChatMessageEx(Roles.ToolTemp, ChatMessageEx.createToolCallResultAllInOne(tcid, name, limitedData))) chat.add(new ChatMessageEx(Roles.ToolTemp, ChatMessageEx.createToolCallResultAllInOne(tcid, name, limitedData)))
if (this.chat_show(cid)) { if (this.chat_show(cid)) {
if (gMe.tools.auto > 0) { if (gMe.tools.autoSecs > 0) {
this.timers.toolcallResponseSubmitClick = setTimeout(()=>{ this.timers.toolcallResponseSubmitClick = setTimeout(()=>{
this.elBtnUser.click() this.elBtnUser.click()
}, gMe.tools.auto*this.TimePeriods.ToolCallAutoTimeUnit) }, gMe.tools.autoSecs*this.TimePeriods.ToolCallAutoSecsTimeUnit)
} }
} }
this.ui_reset_userinput(false) this.ui_reset_userinput(false)
@ -1333,7 +1333,7 @@ class Me {
* Control how many seconds to wait before auto triggering tool call or its response submission. * Control how many seconds to wait before auto triggering tool call or its response submission.
* A value of 0 is treated as auto triggering disable. * A value of 0 is treated as auto triggering disable.
*/ */
auto: 0 autoSecs: 0
}; };
this.chatProps = { this.chatProps = {
apiEP: ApiEP.Type.Chat, apiEP: ApiEP.Type.Chat,