Commit Graph

7608 Commits

Author SHA1 Message Date
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
hanishkvc 3e0cf2a2df SimpleChatTC:ObjPropsEdit: Obj within Obj aware fRefiner
Use same to set a placeholder for Authorization entry in headers
2025-12-04 19:41:39 +05:30
hanishkvc f874c69983 SimpleChatTC:UiShowObjPropsEdit allow refining 2025-12-04 19:41:39 +05:30
hanishkvc 6253c717b3 SimpleChatTC:Trappable UiShowObjPropsEdit for custom handling
Use it to handle apiEP and iRecentUserMsgCnt in more user friendly
way, where they get a selection to choose from.
2025-12-04 19:41:39 +05:30
hanishkvc 3718a39c06 SimpleChatTC:Use generic obj props edit for settings in general
Bring more user controllable properties into this new settings ui
2025-12-04 19:41:39 +05:30
hanishkvc 756b128539 SimpleChatTC:UI:ObjPropEdits handle objects, use for gMe 2025-12-04 19:41:39 +05:30
hanishkvc b771e42dc1 SimpleChatTC:UI:Common helper to edit obj members of few types
Make the previously relatively generic flow wrt apiRequestOptions
settings into a fully generic reusable by others flow.

Rather had stopped short of it, when previously moved onto other
things at that time.
2025-12-04 19:41:39 +05:30
hanishkvc 6e5b532313 SimpleChatTC:UI: el_get/el_set to avoid warnings 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 9b55775e8a SimpleChatTC:WebFetch: Update readme to reflect the new names 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 d04c8cd38d SimpleChatTC:SimpleProxy: Ensure CORS related headers sent always
Add a new send headers common helper and use the same wrt the
overridden send_error as well as do_OPTIONS

This ensures that if there is any error during proxy opertions,
the send_error propogates to the fetch from any browser properly
without browser intercepting it with a CORS error
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