Rename to get_chatmessage_index.
Return the index of the chatmessage deleted.
Add a scroll element into view helper.
Now the UniqId wrt the ChatMessage is stored as a attribute
wrt the corresponding chatmessage block. And same used wrt
scrolling after deleting messages.
When a chat message is deleted, previously the screen would have
moved to last message in the chat session, now it tries to remain
wrt adjacent messages on the screen.
Use position fixed followed by using position-area so that one
can use anchor passed through showPopover.
Avoid the hidePopover from mouseLeave, because as the mouse moves
over the poped up popover ui, the mouseLeave will be called on
the chat message block/container. And that would have closed the
popover and inturn mouseEnter would have got called on ChatMsg,
given now with the popover hidden, the ChatMsg block is directly
accessible. So this leads to twinkling / toggling ie continues
show/hide of the popover.
Inturn in mouseEnter itself decide when to close the previous
popover (ie if the chatmessage id is different from what it was
before).
Trap the mouseenter and mouseleave events wrt the chatmessage
block to show the chatmessage-popover ui inturn within the
corresponding chatmessage.
When ever user clicks the popover menu's delete button, the
uniqId associated with each chat message, is now used to
delete the user selected chat message.
Initial skeleton wrt clipboard copy.
Had forgotten to move the one shot resp into try catch before.
Fixed it. Ensure both oneshot multipart resp try catch
Add some todos for later.
Add a new check wrt response being normal or a error related one
ie the content is actually a error message.
Allow passing the accept list for file type input element helper.
Inturn given that currently it is used for the image selection
for vision models, set it to jpeg and png in the caller for the
same.
Move all dataUrl handling into helper functions.
So that its manipulation is done in a controlled manner, as well as
in future, changes to the semantic can be easily carried out by
updating the helper functions suitably and inturn updating the caller
as needed.
For now avoid push and pop and work with 0th index directly, given
that currently the logic is setup for handling only a single image
with the ai model. This keeps things simple. It can be changed if
required in future easily.
There can be issue with chat.add->chat.save, in that trying to
store into localStorage or so can raise exception, like quota
exceeded and so.
So now trap chat.add also and inturn for now take care of clearing
image state while also trapping and rethrowing a new error which
identifies the above location, as well as tracks the original err
Add a new helper to create a file type input which includes a btn
with image. Use same wrt the user image selection button.
Update button creation helper to show innerText only if the newly
added innerHTML arg is undefined.
When ever user makes a image selection, the image will be shown
in the input-filetype-image-button. In turn when the same is
submitted to ai engine server, the image will be cleared.
Avoid directly accessing content field, from any place other than
where it is absolutely requried.
Add a bOverwrite field to the content_adj helper, so that one can
overwrite instead of appending passed content to whats already in.
* this is currently used only wrt
* promote_tooltemp helper
* trim garbage helper
* the oneshot could ideally use overwriting, but currently
not doing as this flow will occur only once per message
Add a image_url field for the image url with image data in dataurl
format with base64 encoded image data.
Currently the logic doesnt allow user to send a empty message to
ai, during their term. Previously this path wasnt directly alerting
the end user. Now it informs the end user using placeholder property
so they can see the alert, while also ensuring that once user enters
something, the alert wont interfere.
The logic takes care of saving any original placeholder, so that
the same is restored, when user switches sessions.
Allow for empty tool call results
Block no content response from user role only.
Also change for console.debug to console.log so people can
see the blocking of empty response from user, in the browser
console.
Had forgotten to update these two functions wrt the tool response
related new fields. This is fixed now.
Also show tool-call-id and tool-name to end user as part of chat
message showing.
ALERT on disk structure change old saves wont work esp wrt tool
responses
Given that the user query box no longer includes the special xml
string wrt tool response data (TOOL.TEMP ROLE), so now instead set
a special attribute to indicate that user query/input box is
maintaining a tool response.
For regular Tool responses in the chat session, now show the tool
call id and tool name before the tool response data (ie content
field).
Add a new static helper to create a ChatMessageEx for a given
tool response data.
Use the same when storing tool response in the chat session msgs
list.
This inturn avoids the need for creating a xml string with all
the fields corresponding to tool response. So also no need to
extract the individiual tool response fields from the all-in-one
xml string and populate the tool response fields in the network
structure equivalent ns data structure, when recent_chat_ns is
called.
TODO: individual tool/function calls from tool_calls field, accessed
using different methods in different places for now. Need to think
on which is the best method to retain and use everywhere and or
retain things as is.
Remove the load from disk support that was previously retained
wrt the old on-disk-storage format for the chat session messages.
Make a note to allow non ai server handshake roles to be maintained
wrt NSChatMessage. Add helper to cross check if a message belongs
to such temp roles or not.
Update SimpleChat class to make use of the new NSChatMessage based
needed flow.
NSChatMessage implements the undefined based flow and provides
helpers to check if any of the field like content or reasoning
or tool_calls is available in the chat message or not.
It also provides helpers to get the corresponding fields.
ChatMessageEx updated to make use of NSChatMessage.
Switch from empty strings or empty list and so to undefined.
undefined will be treated by Javascript and JSON to mean, not even
instantiated and also dont instantiate the same
Rather a chat with gpt-oss generated a assistant response which
included chat-content, chat-reasoning and chat-toolcall all in the
same response. On responding to same with tool call result, the
server http handshake responded with a 500 Internal server error,
So added this to get more details in this case, as well as in
general for future.
Rename Tools to ToolsManager to convey its semantic better.
Move setup of workers onmessage callback as well as directly passing
result to these callbacks into ToolsManager.
Now that Workers have been moved into ToolsManager, and ToolsManager
has been instantiated as a member of Me, use the same in place of
prev workers of Me.
Given that Me is now passed to the tools logic during setup, have
the web worker handles in Me itself, instead of in tool related
modules.
Move setup of web worker related main thread callbacks, as well as
posting messages directly to these main thread callbacks, into Me.
Have main classes defined independent of and away from runtime flow
Move out the entry point including runtime instantiation of the
core Me class (which inturn brings other class instances as neede)
into its own main.js file.
With this one should be able to import simplechat.js into other
files, where one might need the SimpleChat or MultiChat or Me class
definitions.
Allow user to clear the existing chat. The user does have the
option to load the just cleared chat, if required.
Add icons wrt clearing chat and settings.
Update readme wrt searchDrops, auto settings ui creation
Rename tools-auto to tools-autoSecs, to make it easy to realise
that the value represents seconds.
Allow the web tools handshake helper to pass additional header
entries provided by its caller.
Make use of this to send a list of tag and id pairs wrt web search
tool. Which will be used to drop div's matching the specified id.
Chances are for ai models which dont support tool calling, things
will be such that the tool calls meta data shared will be silently
ignored without much issue.
So enabling tool calling feature by default, so that in case one
is using a ai model with tool calling the feature is readily
available for use.
Revert SlidingWindow ChatHistory in Context from last 10 to last 5
(2 more then origianl, given more context support in todays models)
by default, given that now tool handshakes go through the tools
related side channel in the http handshake and arent morphed into
normal user-assistant channel of the handshake.
Usage Note
* Cleanup / fix some wording.
* Pick chat history handshaked len from config
Ensure the settings info is uptodate wrt available tool names
by chaining a reshowing with tools manager initialisation.