SimpleChatTC:TC Result truncating only if needed

As I was seeing the truncated message even for stripped plain text
web acces, relooking at that initial go at truncating, revealed
a oversight, which had the truncation logic trigger anytime the
iResultMaxDataLength was greater than 0, irrespective of whether
the actual result was smaller than the allowed limit or not,
thus adding that truncated message to end of result unnecessarily.
Have fixed that oversight

Also recent any number of args based simpleprox handshake helper
in toolweb seems to be working (atleast for the existing single
arg based calls).
This commit is contained in:
hanishkvc 2025-11-02 03:05:30 +05:30
parent 63a8ddfbb9
commit 8bc7de4416
2 changed files with 4 additions and 2 deletions

View File

@ -261,7 +261,7 @@ It is attached to the document object. Some of these can also be updated using t
* 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. * specifying 0 disables this truncating of the results, and inturn full result will be sent to the ai engine server.
* toolCallResponseTimeoutMS - specifies the time (in msecs) for which the logic should wait for a tool call to respond * toolCallResponseTimeoutMS - specifies the time (in msecs) for which the logic should wait for a tool call to respond
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

View File

@ -1093,7 +1093,9 @@ class MultiChatUI {
let chat = this.simpleChats[cid]; let chat = this.simpleChats[cid];
let limitedData = data let limitedData = data
if (gMe.tools.iResultMaxDataLength > 0) { if (gMe.tools.iResultMaxDataLength > 0) {
limitedData = data.slice(0, gMe.tools.iResultMaxDataLength) + `\n\n\nALERT: Data too long, was chopped ....` if (data.length > gMe.tools.iResultMaxDataLength) {
limitedData = data.slice(0, gMe.tools.iResultMaxDataLength) + `\n\n\nALERT: Data too long, was chopped ....`
}
} }
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)) {