Commit Graph

7420 Commits

Author SHA1 Message Date
hanishkvc f221a2c356 SimpleChatTC:SimpleProxy:LoadConfig ProcessArgs cleanup - initial
Now both follow a similar mechanism and do the following

* exit on finding any issue, so that things are in a known
  state from usage perspective, without any confusion/overlook

* check if the cmdlineArgCmd/configCmd being processed is a known
  one or not.

* check value of the cmd is of the expected type

* have a generic flow which can accomodate more cmds in future
  in a simple way
2025-12-04 19:41:39 +05:30
hanishkvc a1b33ecd1c SimpleChatTC:ToolCallResponseTimeout: Allow end user to control
Moved it into Me->tools, so that end user can modify the same as
required from the settings ui.

TODO: Currently, if tc response is got after a tool call timed out
and user submitted default timed out error response, the delayed
actual response when it is got may overwrite any new content in
user query box, this needs to be tackled.
2025-12-04 19:41:39 +05:30
hanishkvc 252fb91e95 SimpleChatTC:WebSearchPlus: Update readme, Wikipedia in allowed
If using wikipedia or so, remember to have sufficient context window
in general wrt the ai engine as well as wrt the handshake / chat
end point.
2025-12-04 19:41:39 +05:30
hanishkvc 221b5a9228 SimpleChatTC:ToolCallWeby: Cleanup the toolweb module flow
Avoid code duplication, by creating helpers for setup and toolcall.

Also send indication of the path that will be used, when checking
for simpleproxy.py server to be running at runtime setup.
2025-12-04 19:41:39 +05:30
hanishkvc de6f370d3b SimpleChatTC:ToolCall:SearchWebText using UrlText
Initial go at implementing a web search tool call, which uses the
existing UrlText support of the bundled simpleproxy.py.

It allows user to control the search engine to use, by allowing
them to set the search engine url template.

The logic comes with search engine url template strings for
duckduckgo, brave, bing and google. With duckduckgo set by default.
2025-12-04 19:41:39 +05:30
hanishkvc 978ee3db1e SimpleChatTC:ToolCalling:Seprat out JSWebWorker and ProxyBasedWeb
Remove the unneed (belonging to the other file) stuff from tooljs
and toolweb files.

Update tools manager to make use of the new toolweb module
2025-12-04 19:41:39 +05:30
hanishkvc d00e5b341a SimpleChatTC:Duplicate tooljs.mjs to toolweb.mjs
So as to split browser js webworker based tool calls from web
related tool calls.
2025-12-04 19:41:39 +05:30
hanishkvc 8c8ddb1e59 SimpleChatTC:Update and cleanup the readme a bit
include info about the auto option within tools.

use nonwrapped text wrt certain sections, so that the markdown
readme can be viewed properly wrt the structure of the content
in it.
2025-12-04 19:41:39 +05:30
hanishkvc 2192ae6dd3 SimpleChatTC:Cleanup whitespace - github editorconfig checker
Add missing newline to ending bracket line of json config file
2025-12-04 19:41:39 +05:30
hanishkvc f74ce327e5 SimpleChatTC: Cleanup whitespaces
identified by llama.cpp editorconfig check

* convert tab to spaces in json config file
* remove extra space at end of line
2025-12-04 19:41:39 +05:30
hanishkvc fb968347b0 SimpleChatTC:AutoToolCalls: Track and clear related timers
also cleanup the existing toolResponseTimeout timer to be in the
same structure and have similar flow convention.
2025-12-04 19:41:39 +05:30
hanishkvc 45f9db9963 SimpleChatTC:Auto tool calling control to end user
Instead of enforcing always explicit user triggered tool calling,
now user is given the option whether to use explicit user triggered
tool calling or to use auto triggering after showing tool details
for a user specified amount of seconds.

NOTE: The current logic doesnt account for user clicking the buttons
before the autoclick triggers; need to cancel the auto clicks, if
user triggers before autoclick, ie in future.
2025-12-04 19:41:39 +05:30
hanishkvc 9e97880dde SimpleChatTC:SimpleProxy:Cleanup
avoid logically duplicate debug log
2025-12-04 19:41:39 +05:30
hanishkvc 4c1c363504 SimpleChatTC:SimpleProxy: debug dumps to identify funny bing
bing raised a challenge for chrome triggered search requests after
few requests, which were spread few minutes apart, while still
seemingly allowing wget based search to continue (again spread
few minutes apart).

Added a simple helper to trace this, use --debug True to enable
same.
2025-12-04 19:41:39 +05:30
hanishkvc dbb24fec77 SimpleChatTC:ToolResponse: Use browser dom for xml/html safe
Instead of simple concatenating of tool call id, name and result
now use browser's dom logic to create the xml structure used for
now to store these within content field.

This should take care of transforming / escaping any xml special
chars in the result, so that extracting them later for putting
into different fields in the server handshake doesnt have any
problem.
2025-12-04 19:41:39 +05:30
hanishkvc 90d232dc4a SimpleChatTC:SimpleProxy: Update readme wrt mimicing client req
ie during proxying
2025-12-04 19:41:39 +05:30
hanishkvc 74226a0992 SimpleChatTC:ToolCall response relaxed handling
Use DOMParser parseFromString in text/html mode rather than text/xml
as it makes it more relaxed without worrying about special chars
of xml like & etal
2025-12-04 19:41:39 +05:30
hanishkvc c109da870f SimpleChatTC:SimpleProxy: mimicing got req helps wrt duckduckgo
mimicing got req in generated req helps with duckduckgo also and
not just yahoo.

also update allowed.domains to allow a url generated by ai when
trying to access the bing's news aggregation url
2025-12-04 19:41:39 +05:30
hanishkvc bebf846157 SimpleChatTC:SimpleProxy:Cleanup a bit
The tagging of messages wrt ValidateUrl and UrlReq

Also dump req

Move check for --allowed.domains to ValidateUrl

NOTE: Also with mimicing of user agent etal from got request to
the generated request, yahoo search/news is returning results now,
instead of the bland error before.
2025-12-04 19:41:39 +05:30
hanishkvc d0b9103176 SimpleChatTC:SimpleProxy:Try mimic real client using got req info
ie include User-Agent, Accept-Language and Accept in the generated
request using equivalent values got in the request being proxied.
2025-12-04 19:41:39 +05:30
hanishkvc e6e0adbe90 SimpleChatTC:SimpleProxy: Some debug prints which give info 2025-12-04 19:41:39 +05:30
hanishkvc 17365ed4b9 SimpleChatTC: Update readme a bit 2025-12-04 19:41:39 +05:30
hanishkvc 840cab0b1c SimpleChatTC:SimpleProxy: Include a sample config file
with allowed domains set to few sites in general to show its use

this includes some sites which allow search to be carried out
through them as well as provide news aggregation
2025-12-04 19:41:39 +05:30
hanishkvc 370326b1ec SimpleChatTC:SimpleProxy: Cleanup domain filtering and general
Had confused between js and python wrt accessing dictionary
contents and its consequence on non existent key. Fixed it.

Use different error ids to distinguish between failure in common
urlreq and the specific urltext and urlraw helpers.
2025-12-04 19:41:39 +05:30
hanishkvc 71ad609db6 SimpleChatTC:SimpleProxy: AllowedDomains based filtering
Allow fetching from only specified allowed.domains
2025-12-04 19:41:39 +05:30
hanishkvc 58954c8814 SimpleChatTC:SimpleProxy: Update doc following python convention 2025-12-04 19:41:39 +05:30
hanishkvc 62dcd506e3 SimpleChatTC:SimpleProxy:Allow for loading json based config file
The config entries should be named same as their equivalent cmdline
argument entries but without the -- prefix
2025-12-04 19:41:39 +05:30
hanishkvc aac5213104 SimpleChatTC:Tools: Show available tool names
Dont allow tool names to be changed in settings page
2025-12-04 19:41:39 +05:30
hanishkvc aa8c8040cf SimpleChatTC:Cleanup:ChatProps: apiEP 2025-12-04 19:41:39 +05:30
hanishkvc ad65659a63 SimpleChatTC:Cleanup:ChatProps: bTrimGarbage
Also remove more inner/detailed stuff from show info in not bAll
mode, given that many of the previous differentiated stuff have
been moved into chatProps and inturn shown for now
2025-12-04 19:41:39 +05:30
hanishkvc 82be13aa33 SimpleChatTC:Cleanup:ChatProps: bCompletionInsertStandardRolePrefix 2025-12-04 19:41:39 +05:30
hanishkvc 734f74c908 SimpleChatTC:Cleanup:ChatProps: bCompletionFreshChatAlways
Moved into Me.chatProps
2025-12-04 19:41:39 +05:30
hanishkvc 78ccca056f SimpleChatTC:Cleanup:ChatProps: iRecentUserMsgCnt
Update Me class

Update show settings

Update show props info

Update readme
2025-12-04 19:41:39 +05:30
hanishkvc 7409b29862 SimpleChatTC:Cleanup:ChatProps: Move bStream into it 2025-12-04 19:41:39 +05:30
hanishkvc a54fa472dd SimpleChatTC:ShowObjPropsEdit:Any depth trapping of ui setup - t2
Fix up the oversights wrt any depth trapping flow

Remember to start the propWithTree being checked/trapped with :
to indicate the root of the prop hierarchy and also use : as sep
between the elements of the props hierarchy tree

Also had forgotten about the goof up possible with using in in a
condition statement to check for array to contain a entry of interest
in JS, fixed it now.
2025-12-04 19:41:39 +05:30
hanishkvc 8d7eb68712 SimpleChatTC:ShowObjPropsEdit:Any depth trapping of ui setup
Maintain the current property hierarchy to its root over recursive
calls.

Allow callers to specify the props to be trapped using the prop
hierarchy.

Pass the prop hierarchy to the fTrapper.

This should allow one to trap any prop wrt its editing ui setup,
irrespective of whether it is a prop of the main object passed,
or a member of a child prop of the main object passed or so ...

Update the setting up of ChatHistoryInCtxt and ApiEndPoint to follow
the new semantic/flow.
2025-12-04 19:41:39 +05:30
hanishkvc b19e754322 SimpleChatTC:Cleanup:Rename func arg to match semantic better 2025-12-04 19:41:39 +05:30
hanishkvc 03426f0276 SimpleChatTC:Cleanup:EditObjProps: rename vars followingConvention
Part 1 - add el prefix wrt the element handle related vars
2025-12-04 19:41:39 +05:30
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 303af1800e SimpleChatTC:ShowInfo:Clean up layout of showing of props data
Also ensure when switching between sessions, the full set of props
info is shown.
2025-12-04 19:41:39 +05:30
hanishkvc 0e21d67e8a SimpleChatTC:ShowInfo: Allow showing minimal info set, if needed 2025-12-04 19:41:39 +05:30
hanishkvc fc26e47222 SimpleChatTC:ShowObjPropsInfo: Use sections to indicate relations
Also create a top level div wrt whole. And allow class to be
specified for the same as well as the top level legend, optionally
2025-12-04 19:41:39 +05:30
hanishkvc 24ba85026e SimpleChatTC:ShowInfo: Make logic recursive, avoid JSON.stringify 2025-12-04 19:41:39 +05:30
hanishkvc 34b2beea1a SimpleChatTC:ShowInfo: Create and use common automated info show
Also fetch info from ai-server, and place path and ctx size into
current Me instance and include in show info.
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 fa0a6919cb SimpleChatTC: Update/Cleanup readme 2025-12-04 19:41:39 +05:30
hanishkvc 8ca77e455a SimpleChatTC:NonStreaming: Update oneshot mode wrt tool calls
Take care of the possibility of content not being there as well as
take care of retrieving the tool calls for further processing.

With this tool calls should work in non streaming mode also
2025-12-04 19:41:39 +05:30