Commit Graph

24 Commits

Author SHA1 Message Date
hanishkvc 3e490cefc5 SimpleChatTC:Cleanup: Move bTools and toolFetchProxyUrl into tools
Also update the readme wrt same and related
2025-12-04 19:41:39 +05:30
hanishkvc 2a94cb3786 SimpleChatTC:Fetch:Proxy URL rename and in settings 2025-12-04 19:41:39 +05:30
hanishkvc 98d43fac7f SimpleChatTC:WebFetch: Try confirm simpleproxy before enabling 2025-12-04 19:41:39 +05:30
hanishkvc a6aa563a18 SimpleChatTC:WebFetch: Check for the specific proxy paths 2025-12-04 19:41:39 +05:30
hanishkvc 80dbbb89a5 SimpleChatTC:WebFetch: Enable only if something at proxyUrl
NOTE: not a robust check, just tries to establish a http connection
for now and doesnt really check if it is the specific proxy srvr
of interest or not.
2025-12-04 19:41:39 +05:30
hanishkvc 04644761e6 SimpleChatTC:Tools: Pick proxy server address from document[gMe] 2025-12-04 19:41:39 +05:30
hanishkvc 42f91df261 SimpleChatTC:WebFetch:Trap Non Ok status and raise error
So that the same error path is used for logical error wrt http req
also, without needing a different path for it.

Dont forget to return the resp text/json/..., so that the contents
are passed along the promise then chain
2025-12-04 19:41:39 +05:30
hanishkvc c2fb0cd241 SimpleChatTC:WebFetch: Cleanup the names and descriptions a bit 2025-12-04 19:41:39 +05:30
hanishkvc 8b950fd348 SimpleChatTC:WebFetch:UrlEnc url2fetch b4Passing toProxy asQuery
Ensures that if the url being requested as any query strings in
them then things dont get messed up, when the url to get inc its
query is extracted from the proxy request's query string
2025-12-04 19:41:39 +05:30
hanishkvc 9c7d6cc0e4 SimpleChatTC:WebUrlText:Update name and desc to see if prefered 2025-12-04 19:41:39 +05:30
hanishkvc 82ab08ec1a SimpleChatTC:WebUrl FetchStrip through simple proxy 2025-12-04 19:41:39 +05:30
hanishkvc c25b1968cd SimpleChatTC:WebFetch: Update to use internal SimpleProxy.py 2025-12-04 19:41:39 +05:30
hanishkvc 8fc74ef923 SimpleChatTC:WebFetchThroughProxy:Initial go creating request 2025-12-04 19:41:39 +05:30
hanishkvc ebc7f88b53 SimpleChatTC:Propogate toolcall id through tool call chain
Use HTMLElement's dataset to maintain tool call id along with
the element which maintains the toolname.

Pass it along to the tools manager and inturn the actual tool
calls and through them to the web worker handling the tool call
related code and inturn returning it back as part of the obj
which is used to return the tool call result.

Embed the tool call id, function name and function result into
the content field of chat message in terms of a xml structure

Also make use of tool role to send back the tool call result.
Do note that currently the id, name and content are all embedded
into the content field of the tool role message sent to the
ai engine on the server.

NOTE: Use the user query entry area for showing tool call result
in the above mentioned xml form, as well as for user to enter
their own queries. Based on presence of the xml format data at
beginning the logic will treat it has a tool result and if not
then as a normal user query.

The css has been updated to help show tool results/msgs in a
lightyellow background
2025-12-04 19:41:39 +05:30
hanishkvc 37faf8611a SimpleChatTC: update descs to indicate use of web workers
ie wrt the tool calls provided.
2025-12-04 19:41:39 +05:30
hanishkvc 2a8bd1c9e7 SimpleChatTC: Actual tool call implementations simplified
These no longer need to worry about

* setting up the console.log related redirection to capture
  the generated outputs, nor about
* setting up a dynamic function for executing the needed
  tool call related code

The web worker setup to help run tool calls in a relatively
isolated environment independent of the main browser env,
takes care of these.

One needs to only worry about getting the handle to the
web worker to use and inturn pass the need code wrt the
tool call to it.
2025-12-04 19:41:39 +05:30
hanishkvc 2701cb3a1e SimpleChatTC: Move console.log trapping into its own module
So that it can be used from different modules, if required.
2025-12-04 19:41:39 +05:30
hanishkvc 63b5c6d76d SimpleChatTC: Cleanup the function description a bit
to better describe how it will be run, so that genai/llm while
creating the code to run, will hopefully take care of any naunces
required.
2025-12-04 19:41:38 +05:30
hanishkvc a80da9a652 SimpleChatTC: Pass toolname to the tool handler
So that when tool handler writes the result to the tc_switch, it
can make use of the same, to write to the right location.

NOTE: This also fixes the issue with I forgetting to rename the
key in js_run wrt writing of result.
2025-12-04 19:41:38 +05:30
hanishkvc a408e5e017 SimpleChatTC: More clearer description of toolcalls execution env
Should hopeful ensure that the GenAi/LLM will generate appropriate
code/expression as the argument to pass to these tool calls, to
some extent.
2025-12-04 19:41:38 +05:30
hanishkvc 17c5daa52c SimpleChatTC: Cleanup initial/1st go toolcall flow
As output generated by any tool/function call is currently placed
into the TextArea provided for End user (for their queries), bcas
the GenAi (engine/LLM) may be expecting the tool response to be
sent as a user role data with tool_response tag surrounding the
results from the tool call. So also now at the end of submit btn
click handling, the end user input text area is not cleared, if
there was a tool call handled, for above reasons.

Also given that running a simple arithmatic expression in itself
doesnt generate any output, so wrap them in a console.log, to
help capture the result using the console.log trapping flow that
is already setup.
2025-12-04 19:41:38 +05:30
hanishkvc fa63a86c71 SimpleChatTC:tooljs: Trap console.log and store in new result key
The implementations of javascript and simple_calculator now use
provided helpers to trap console.log messages when they execute
the code / expression provided by GenAi and inturn store the
captured log messages in the newly added result key in tc_switch

This should help trap the output generated by the provided code
or expression as the case maybe and inturn return the same to the
GenAi, for its further processing.
2025-12-04 19:41:38 +05:30
hanishkvc 46f0304105 SimpleChatTC: More generic tooljs, SimpCalc, some main skeleton
Make tooljs structure and flow more generic

Add a simple_calculator tool/function call logic

Add initial skeleton wrt the main tools.mjs file.
2025-12-04 19:41:38 +05:30
hanishkvc f1aa0ee778 SimpleChatTC: Add skeleton for a javascript interpretor tool call
Define the meta that needs to be passed to the GenAi Engine.

Define the logic that implements the tool call, if called.

Implement the flow/structure such that a single tool calls
implementation file can define multiple tool calls.
2025-12-04 19:41:38 +05:30