By default ensure external_ai tool call related special chat session
starts with tool calls disabled and client side sliding window of 1.
Add a helper in SimpleChat class to set these along with clearing of
any chat history.
Inturn now give the user flexibility to change this from within
the program, if they need to for what ever reason, till the program
restarts.
Gives quick overview of the features, given that the original readme
(now docs/details.md++) got created over a period of disjoined time
as features got added.
Ensure we are working with the Chat Messages in Chat session, which
are in the currently active sliding window.
Remove any chat message blocks in the chat session ui, which are
no longer in the sliding window of context.
This brings uirefresh semantic to be in sync with chat_show logic
Rename the default 2 chat session names to make them neutral.
Update internal name to include AnveshikaSallap, better matching
the semantic of the logic, given support for tool calling, vision,
reasoning, ...
Also update usage note wrt simpleproxy.py for web access related
tool calls and few other minor tweeks.
Ensure toolNames array is reset, each time setup is called, so
that it doesnt end up with duplicate entries and equally dont
end up with entries of tool calls which are no longer available,
maybe because some config changed etal.
Ensure the ChatId is logged wrt the toolweb related setup actions.
Ensure that ExternalAi tool call related chat session, has its
tools config disabled, when its created itself, so that end user
doesnt get confused, given that external_ai toolcall explicitly
forces tools support to disabled.
Update some of the notes and readme
When switching to settings ui, hide the User input and ValidateTC
areas.
When switching back to any chat session, unhide User input, while
the ValidateTC ui will be handled by corresponding helper logic
called through the ShowMessage
Given that ValidatedToolCallTrigger UI setup has to also setup
the auto trigger logic, which inturn is dependent on the autosecs
value in the Config associated with the Chat session involved, so
pass chatId to ShowMessage and inturn ValidatedToolCallTriggerUI
setup logic
Rename the function name to better match the semantic.
Split init from setup wrt Tools. Init is called when the program
is started, while setup is called when ever a session is created
and or when ever any tools setup related config is changed (like
proxyUrl getting modified or so).
This allows one to modify tool related config and inturn update
the tools related states wrt same (like wrt the proxyUrl, bcas
the simpleproxy server will change, one needs to cross check which
and all web services are available with the new simpleproxy server
and so and so ...)
To help with the above, now ToolsManager maintains multiple tool
call switches, where there will be a tc_switch wrt each chat
session.
All tool related codes, where needed have been updated to work
with the chat session for which they have been called, instead
of any global states.
In future, this can enable one to allow user to enable or disable
the tool calls exposed in each of the chat sessions,
This immidiately needed toolweb and toolai to account for chat
session as needed.
In future, if we want to keep the data store isolated across
chat sessions, then this can be useful, in that it can create
uniq store names for each of the chat sessions, isntead of
sharing a common store name across all sessions.
The chat session creation as well as tool init/setup related
flows have been updated to chain through or account for the
promises as needed
Given that now currently settings relates to only those related
to the current chat session, so indicate the name/chatId of the
current chat session in the Settings heading.
* this inturn makes the id dynamic, so change the css rule wrt
settings block from using id to classname, and to help with same
also set a class name for the top level settings block.
As part of same, as well as to help and ensure sanity in general
add a helper to clean up a string to be a form usable as a chatId
Update SimpleChat to have a duplicated instance of Config instead
of a reference to the global Me instance.
Most logics updated to work with the config entries corresponding
to the current chat session.
ShowSettings, ShowInfo and getting current sliding window size in
user friendly textual form have been moved to Config from Me.
ALERT: With this now, user clicking settings will be able to modify
only the settings corresponding to current in focus chat session.
TODO:
ToolsMgr related use within SimpleChat and beyond needs to be thought
through and updated as needed.
Should tools.proxyUrl be unique to each SimpleChat or ...
TODO: Rather than maintaining a reference to Me within SimpleChat,
maintain an duplicated instance of the Config class in there, bcas
that is what is needed in SimpleChat wrt Me.
This should also avoid the seperete data object which was created
yesterday to accomodate external_ai tool call.
Update the external ai tool call description to indicate that it
doesnt have access to internet or tool calls.
Update the sys_date_time description and avoid the confusion caused
to some ai wrt the template string as to whether it is optional or
required and wasting reasoning time around it. Now simply state that
it is a reqd argument, and suggest the internal default template as
a useful one to use.
Update the msg returned by data store tool calls, to make them less
verbose (ie avoid duplicating key list or got key data) while also
more informative (ie num of keys, data length)
Update the readme.
Include the DivStream of ExternalAi toolcall in the other chat
session UIs, so that user can see what the external_ai toolcall
is doing, without having to switch out to external ai session tab.
Update the name of the tool call external ai session.
Ensure to clear previous chat session wrt external ai tool calls
As the ai may call external ai toolcall with the same system
prompt sometimes, which wont trigger the autoclear logic, wrt
the corresponding chat session.
TODO: In future maybe provide a option to continue any previous
chat session if the system prompt is not changed wrt external ai
toolcall.
Make DivStream hold a Role element and Data element and inturn
have the live got data go into the data element.
Set some of the relavent classes wrt these, so that it is themed
matching other chat blocks, to any extent.
Add a clear helper function to cleanup as and when needed.
NOTE: Remember to use this to get hold of the DivStream instance
being worked on.
NOTE: Dont forget that setting a parent wrt a HTMLElement wont
automatically add it to the corresponding DOM with a parent child
relation. The new html element will just remain in memory ignored
by everyone else.
Missing DivStream caught. Logic ready for a distant future,
where one may allow the chat session to be switched even
if there is a pending ai server / tool call response.
Avoids the unneeded removeChild before calling appendChild.
Also found the reason why sometimes the DivStream was missing
from DivChat. Rather when I switched from the transient <p>
element to the persistant session specific <div> elements,
I had forgotten to convert the flow fully, rather I had
forgotten to replace the elP.remove() with elP.replaceChildren
Also retaining that debug log wrt missing DivStream path, Just
in case for now, to cross check once later, I havent missed
any other path.
Sometimes the session specific DivStream seems to be missing from
DivChat. Explicitly spliting the remove and append just for the
heck of it didnt help. So also have used try-catch-finally to
ensure it gets added back even if its not already in there, by
not allowing removeChild failure to bypass append etal.
Retaining this here just for the heck of it. WIll be switching
to the appendChild only flow (given it automatically moves the
node, as needed).
This will help ensure that switching sessions etal wont lead to
loosing handle to sessions that one exited from, with additional
logic to be added later.
Rather I am thinking, maybe it may make more sense to dynamically
pick the currently active chat sessions latestResponse field to
inturn show into a div element at end of the elDivChat.
On thinking further, maybe making elDivStream into elDivStreams
with seperate div for each session is the better thing, as the
SC.handle_response will be able to update its corresponding div
and the session switch can link the currently visible session's
div to be mapped to elDivChat.
NOTE: Rather this commit in itself should take care of the current
normal flow, which wont allow user to switch sessions when a tool
call or handshake with server is pending. However in future if
I want the ui to be freely switched independent of if a tool call
or server handshake is active, then I need the logic mentioned in
previous para.
Had a custom struct for parts of Me needed by SimpleChat, and inturn
that need to be controlled when starting a independent parallel ai
session. For now if chat streaming is used or not and tools is enabled
or not is allowed to be explicitly controlled when handle_chat_hs is
called.
Inturn when toolai triggers the parallel ai session, it disables
tools calling support wrt this child/external ai tool call. Else
even the external ai session may end up triggering tool call wrt
external ai for the same job and thus get into a infinite recursive
loop.
Also
* update the toolai meta data a bit.
* increase time allowed for toolcall to return a response, especially
usefull for external_ai tool call.
Cleanup some old notes and update readme in general.
Instead use the explicit positioning, which was already added to
support firefox, given that firefox still doesnt support anchor
based positioning.
Also move the popover to top of the chat message bubble/block,
instead of the bottom area. This ensures that the popover isnt
butting heads with the tool call trigger or user input blocks.
Use variables in css for colors.
Change the tool response color to be bit more soothing and kind of
syncd with the user collor. However the tool call color is left
bit odder, to ensure user sight goes there for validating and
triggering.
Also had forgotten to rename to image_urls, when switching from
single image with its corresponding field image_url to image_urls,
wrt removing the same after it has been added to the content array.
Now NSChatMessage inturn ChatMessageEx, ... have been updated
to maintain a array of image data instead of a single image.
Inturn the ShowMessage as well as submit logics have been updated
to account for multiple images.
Also fix a oversight from previous commit, where when pushing new
image, I had forgotten to remove the old logic, which would have
always updated the 0th image data in the array.
Instead of having texts submit and image, replace them with equiv
unicode icons.
Adjust the size of these buttons to be smaller, given that now they
only contain icons in them.
Switch from btn+inputfile+img to btn+inputfile wrt image loading btn
given that the image will be shown in seperate dynamically created
images in the user in div.
move sessions buttons div to heading block
and move program name to the default block added to chat div, if
there is no chat in a given chat session.
cleanup the default block helpers to follow a common pattern.
also make the chat message bubbles/blocks bit more prominently box
shadowy
Now popover menu autocloses faster, so that it doesnt distract the
user too long, if not needed.
Reasoning bubble dashed border has been made thinner, so that it
appears pleasant and not over bearing.
As firefox doesnt seem to currently support anchor based relative
positioning of the popover, so explicitly set the position of the
popover.
Also reposition the popover to be in the bottom right corner rather
than the previous top center position.
* Rather updated position-area css property ensures this automatically
wrt chrome browsers.
* while for firefox the explicit code that is added is needed.
NOTE: Had added that id, just in case firefox was goofing up bcas of
the element not having unique id or so, either way the firefox issue
is unrelated and more fundamental lack of support for now.
Add better visual cues wrt the tool call trigger block and the
user input block, and inturn remove the now unneeded horizontal
seperation line between chat messages block and the tool call
trigger block.
Bring in the user role color gradient to the full user input block
Change the TEMP roles to use -TEMP instead of .TEMP suffix, so
that role based css rules get applied without any complexity
that may inturn not get applied.
Avoid extra newlines in the err message returned by the tool call
workers. Given that now there is a proper tool call response
sent back to the ai backend/server, without using user and ai
text content block itself to maintain the tool call and its
response info (which is what this client was doing initially
and so more spacing was added to important parts to bring it
into better focus, just in case).
Now use javascript to trap the button click and inturn change css
class to hide or show the corresponding div.
This moving away from details with summary being the top level
title + buttons block, avoids the warning wrt non standard use of
details element, as well as gives a clear icon to end users wrt
toggling the sessions+systemprompt block.
Had forgotten to use ${} for variable within a literal template
string.
Had forgotten to use the full hierarchy of props when setting the
id of elements, which is useful to map a label to a button and so.
This would have led to the wrong button being clicked when a label
with duplicated id was clicked. Ie if two different objects within
a object, have properties/fields with the same name, then previously
this would have led to a bunch of labels and buttons or so having
the same id, bcas their hierarchy was not being accounted for. This
is fixed now.
Allow AutoCreated Object Properties Editing UI to be themed to an
extent by assigning a id to the top level element, which is based
on the legend specified.
Use the same to add inline padding as well as adjust border radius
wrt the elements within, for the Settings ui. And min height and
border width wrt input, select and buttons within.
Similarly for the default Usage,Restore and SettingsInfo summary
titles, avoid border-radius.
Show the string representation of the sliding window selected.
Add some padding to system prompt input.