SimpleChatTCRV:Cleanup: Starting flow, cleanup description, readme
Avoid chat_show getting called twice during starting. Update description of sys_date_time to be more verbose Update the readme DONE section, where I had few days back forgotten and started making entries as parts of a item list or so.
This commit is contained in:
parent
c4cbeba463
commit
735a8b382c
|
|
@ -27,12 +27,12 @@ function startme() {
|
|||
gMe.debug_disable();
|
||||
devel_expose()
|
||||
gMe.toolsMgr.init(gMe).then(()=>{
|
||||
gMe.multiChat.chat_show(gMe.multiChat.curChatId);
|
||||
gMe.multiChat.handle_session_switch(gMe.multiChat.curChatId)
|
||||
})
|
||||
for (let cid of gMe.defaultChatIds) {
|
||||
gMe.multiChat.new_chat_session(cid);
|
||||
}
|
||||
gMe.multiChat.setup_ui(gMe.defaultChatIds[0], true);
|
||||
gMe.multiChat.setup_ui(gMe.defaultChatIds[0]);
|
||||
gMe.multiChat.show_sessions();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -654,132 +654,141 @@ channel of the handshake.
|
|||
having ai responses built over multiple steps of tool callings etal. So independent of our client side
|
||||
sliding window based drop off or even before they kick in, this can help in many cases.
|
||||
|
||||
* UI - add ClearChat button and logic. Also add unicode icons for same as well as for Settings.
|
||||
UI - add ClearChat button and logic. Also add unicode icons for same as well as for Settings.
|
||||
|
||||
* renamed pdf_to_text to fetch_pdf_as_text so that ai model can understand the semantic better.
|
||||
Renamed pdf_to_text to fetch_pdf_as_text so that ai model can understand the semantic better.
|
||||
|
||||
* sys_date_time tool call has been added.
|
||||
sys_date_time tool call has been added.
|
||||
|
||||
* Refactor code and flow a bit wrt the client web ui
|
||||
* Move the main chat related classes into its own js module file, independent of the main
|
||||
runtime entry point (rather move out the runtime entry point into its own file). This allows
|
||||
these classes to be referenced from other modules like tools related modules with full access
|
||||
to these classes's details for developers and static check tools.
|
||||
* building on same make the Tools management code into a ToolsManager class which is inturn
|
||||
instantiated and the handle stored in top level Me class. This class also maintains and
|
||||
manages the web workers as well as routing of the tool calling among others.
|
||||
* add a common helper for posting results directly to the main thread side web worker callback
|
||||
handlers. Inturn run the calling through a setTimeout0, so that delayed/missing response
|
||||
situation rescuer timeout logic etal flow doesnt get messed for now.
|
||||
Refactor code and flow a bit wrt the client web ui
|
||||
* Move the main chat related classes into its own js module file, independent of the main
|
||||
runtime entry point (rather move out the runtime entry point into its own file). This allows
|
||||
these classes to be referenced from other modules like tools related modules with full access
|
||||
to these classes's details for developers and static check tools.
|
||||
* building on same make the Tools management code into a ToolsManager class which is inturn
|
||||
instantiated and the handle stored in top level Me class. This class also maintains and
|
||||
manages the web workers as well as routing of the tool calling among others.
|
||||
* add a common helper for posting results directly to the main thread side web worker callback
|
||||
handlers. Inturn run the calling through a setTimeout0, so that delayed/missing response
|
||||
situation rescuer timeout logic etal flow doesnt get messed for now.
|
||||
|
||||
* track tool calling and inturn maintain pending tool calls so that only still valid tool call responses
|
||||
will be accepted when the asynchronous tool call response is recieved. Also take care of clearing
|
||||
pending tool call tracking in unhappy paths like when exception noticied as part of tool call execution,
|
||||
or if there is no response within the configured timeout period.
|
||||
NOTE: Currently the logic supports only 1 pending tool call per chat session.
|
||||
Track tool calling and inturn maintain pending tool calls so that only still valid tool call responses
|
||||
will be accepted when the asynchronous tool call response is recieved. Also take care of clearing
|
||||
pending tool call tracking in unhappy paths like when exception noticied as part of tool call execution,
|
||||
or if there is no response within the configured timeout period.
|
||||
NOTE: Currently the logic supports only 1 pending tool call per chat session.
|
||||
|
||||
* add support for fetch_xml_as_text tool call, fix importmaps in index.html
|
||||
Add support for fetch_xml_as_text tool call, fix importmaps in index.html
|
||||
|
||||
* renamed and updated logic wrt xml fetching to be fetch_xml_filtered. allow one to use re to identify
|
||||
the tags to be filtered in a fine grained manner including filtering based on tag heirarchy
|
||||
* avoid showing empty skipped tag blocks
|
||||
Renamed and updated logic wrt xml fetching to be fetch_xml_filtered. allow one to use re to identify
|
||||
the tags to be filtered in a fine grained manner including filtering based on tag heirarchy
|
||||
* avoid showing empty skipped tag blocks
|
||||
|
||||
* logic which shows the generated tool call has been updated to trap errors when parsing the function call
|
||||
arguments generated by the ai. This ensures that the chat ui itself doesnt get stuck in it. Instead now
|
||||
the tool call response can inform the ai model that its function call had issues.
|
||||
Logic which shows the generated tool call has been updated to trap errors when parsing the function call
|
||||
arguments generated by the ai. This ensures that the chat ui itself doesnt get stuck in it. Instead now
|
||||
the tool call response can inform the ai model that its function call had issues.
|
||||
|
||||
* renamed fetch_web_url_text to fetch_html_text, so that gen ai model wont try to use this to fetch xml or
|
||||
rss files, because it will return empty content, because there wont be any html content to strip the tags
|
||||
and unwanted blocks before returning.
|
||||
Renamed fetch_web_url_text to fetch_html_text, so that gen ai model wont try to use this to fetch xml or
|
||||
rss files, because it will return empty content, because there wont be any html content to strip the tags
|
||||
and unwanted blocks before returning.
|
||||
|
||||
* capture the body of ai server not ok responses, to help debug as well as to show same to user.
|
||||
Capture the body of ai server not ok responses, to help debug as well as to show same to user.
|
||||
|
||||
* extract and include the outline of titles (along with calculated numbering) in the text output of pdftext
|
||||
* ensure that one doesnt recurse beyond a predefined limit.
|
||||
Extract and include the outline of titles (along with calculated numbering) in the text output of pdftext
|
||||
* ensure that one doesnt recurse beyond a predefined limit.
|
||||
|
||||
* Convert NSChatMessage from typedef to Class and update ChatMessageEx, SimpleChat, MultiChatUI classes to
|
||||
make use of the same.
|
||||
* helpers consolidated
|
||||
* helpers to check if given instance contains reasoning or content or toolcall or tool response related
|
||||
fields/info in them.
|
||||
* helpers to get the corresponding field values
|
||||
* some of these helpers where in ChatMessageEx and beyond before
|
||||
* now the network handshaked fields are declared as undefined by default (instead of empty values).
|
||||
this ensures that json stringify will automatically discard fields whose values are still undefined.
|
||||
* add fields wrt tool response and update full flow to directly work with these fields instead of the
|
||||
xml based serialisation which was previously used for maintaining the different tool response fields
|
||||
within the content field (and inturn extract from there when sending to server).
|
||||
* now a dataset based attribute is used to identify when input element contains user input and when
|
||||
it contains tool call result/response.
|
||||
* this simplifies the flow wrt showing chat message (also make it appear more cleanly) as well as
|
||||
identifying not yet accepted tool result and showing in user query input field and related things.
|
||||
* ALERT: ON-DISK-STORAGE structure of chat sessions have changed wrt tool responses. So old saves will
|
||||
no longer work wrt tool responses
|
||||
Convert NSChatMessage from typedef to Class and update ChatMessageEx, SimpleChat, MultiChatUI classes to
|
||||
make use of the same.
|
||||
* helpers consolidated
|
||||
* helpers to check if given instance contains reasoning or content or toolcall or tool response related
|
||||
fields/info in them.
|
||||
* helpers to get the corresponding field values
|
||||
* some of these helpers where in ChatMessageEx and beyond before
|
||||
* now the network handshaked fields are declared as undefined by default (instead of empty values).
|
||||
this ensures that json stringify will automatically discard fields whose values are still undefined.
|
||||
* add fields wrt tool response and update full flow to directly work with these fields instead of the
|
||||
xml based serialisation which was previously used for maintaining the different tool response fields
|
||||
within the content field (and inturn extract from there when sending to server).
|
||||
* now a dataset based attribute is used to identify when input element contains user input and when
|
||||
it contains tool call result/response.
|
||||
* this simplifies the flow wrt showing chat message (also make it appear more cleanly) as well as
|
||||
identifying not yet accepted tool result and showing in user query input field and related things.
|
||||
* ALERT: ON-DISK-STORAGE structure of chat sessions have changed wrt tool responses. So old saves will
|
||||
no longer work wrt tool responses
|
||||
|
||||
* UI updates
|
||||
* update logic to allow empty tool results to be sent to ai engine server
|
||||
* css - when user input textarea is in tool result mode (ie wrt TOOL.TEMP role), change the background
|
||||
color to match the tool role chat message block color, so that user can easily know that the input
|
||||
area is being used for submitting tool response or user response, at any given moment in time.
|
||||
UI updates
|
||||
* update logic to allow empty tool results to be sent to ai engine server
|
||||
* css - when user input textarea is in tool result mode (ie wrt TOOL.TEMP role), change the background
|
||||
color to match the tool role chat message block color, so that user can easily know that the input
|
||||
area is being used for submitting tool response or user response, at any given moment in time.
|
||||
|
||||
* Vision
|
||||
* Add image_url field. Allow user to load image, which is inturn stored as a dataURL in image_url.
|
||||
* when user presses submit with a message, if there is some content (image for now) in dataURL,
|
||||
then initialise image_url field with same.
|
||||
* when generating chat messages for ai server network handshake, create the mixed content type of
|
||||
content field which includes both the text (from content field) and image (from image_url field)
|
||||
ie if a image_url is found wrt a image.
|
||||
* follow the openai format/template wrt these mixed content messages.
|
||||
* Usage: specify a mmproj file directly or through -hf, additionally had to set --batch-size to 8k
|
||||
and ubatch-size to 2k wrt gemma3-4b-it
|
||||
* when showing chat instantiate img elements to show image_urls.
|
||||
* limit horizontally to max width and vertically to 20% of the height
|
||||
* show any image loaded by the user, in the corresponding image button
|
||||
* consolidate dataurl handling into a bunch of helper functions.
|
||||
* trap quota errors wrt localStorage etal
|
||||
* dont forget to reset the file type input's value, so that reselecting the same image still
|
||||
triggers the input's change event.
|
||||
Vision
|
||||
* Add image_url field. Allow user to load image, which is inturn stored as a dataURL in image_url.
|
||||
* when user presses submit with a message, if there is some content (image for now) in dataURL,
|
||||
then initialise image_url field with same.
|
||||
* when generating chat messages for ai server network handshake, create the mixed content type of
|
||||
content field which includes both the text (from content field) and image (from image_url field)
|
||||
ie if a image_url is found wrt a image.
|
||||
* follow the openai format/template wrt these mixed content messages.
|
||||
* Usage: specify a mmproj file directly or through -hf, additionally had to set --batch-size to 8k
|
||||
and ubatch-size to 2k wrt gemma3-4b-it
|
||||
* when showing chat instantiate img elements to show image_urls.
|
||||
* limit horizontally to max width and vertically to 20% of the height
|
||||
* show any image loaded by the user, in the corresponding image button
|
||||
* consolidate dataurl handling into a bunch of helper functions.
|
||||
* trap quota errors wrt localStorage etal
|
||||
* dont forget to reset the file type input's value, so that reselecting the same image still
|
||||
triggers the input's change event.
|
||||
|
||||
* SimpleChat class now allows extra fields to be specified while adding, in a generic way using a
|
||||
object/literal object or equivalent.
|
||||
SimpleChat class now allows extra fields to be specified while adding, in a generic way using a
|
||||
object/literal object or equivalent.
|
||||
|
||||
* UI Cleanup - msgs spaced out, toolcall edit hr not always, scroll ui only when required,
|
||||
hide settings/info till user requests, heading gradient
|
||||
UI Cleanup - msgs spaced out, toolcall edit hr not always, scroll ui only when required,
|
||||
hide settings/info till user requests, heading gradient
|
||||
|
||||
* iDB module
|
||||
* add open, transact, put and get. Use for chat session save and load
|
||||
* getKeys used to show Restore/Load button wrt chat sessions.
|
||||
iDB module
|
||||
* add open, transact, put and get. Use for chat session save and load
|
||||
* getKeys used to show Restore/Load button wrt chat sessions.
|
||||
|
||||
* ChatMessage
|
||||
* assign a globally unique (ie across sessions) id to each chat message instance.
|
||||
* add support for deleting chat message based on its uniquie id in SimpleChat.
|
||||
* try ensure that adjacent messages remain on screen, after a message is deleted from session.
|
||||
* add a popover div block in html, which acts as a popup menu containing buttons to work with
|
||||
individual chat messages.
|
||||
* experiment and finalise on anchor based relative positioning of the popover menu.
|
||||
* have a del button, which allows one to delete the currently in focus chat message.
|
||||
* have a copy button, which allows one to copy the textual content into system clipboard.
|
||||
ChatMessage
|
||||
* assign a globally unique (ie across sessions) id to each chat message instance.
|
||||
* add support for deleting chat message based on its uniquie id in SimpleChat.
|
||||
* try ensure that adjacent messages remain on screen, after a message is deleted from session.
|
||||
* add a popover div block in html, which acts as a popup menu containing buttons to work with
|
||||
individual chat messages.
|
||||
* experiment and finalise on anchor based relative positioning of the popover menu.
|
||||
* have a del button, which allows one to delete the currently in focus chat message.
|
||||
* have a copy button, which allows one to copy the textual content into system clipboard.
|
||||
|
||||
* MultiChatUI
|
||||
* chat_show takes care of showing or clearing tool call edit / trigger as well as tool response
|
||||
edit / submit. Also show the currently active tool call and its response before it is submitted
|
||||
was previously only shown in the edit / trigger and edit / submit ui elements, now instead it
|
||||
also shows as part of the chat session message blocks, so that user can delete or copy these
|
||||
if needed using the same mechanism as other messages in the chat session.
|
||||
* use a delete msg helper, which takes care of deleting the msg from chat session as well as
|
||||
efficiently update ui to any extent by removing the corresponding element directly from existing
|
||||
chat session ui without recreating the full chat session ui.
|
||||
* a helper to add a message into specified chat session, as well as show/update in the chat session
|
||||
ui by appending the chat message, instead of recreating the full chat session ui.
|
||||
...
|
||||
MultiChatUI
|
||||
* chat_show takes care of showing or clearing tool call edit / trigger as well as tool response
|
||||
edit / submit. Also show the currently active tool call and its response before it is submitted
|
||||
was previously only shown in the edit / trigger and edit / submit ui elements, now instead it
|
||||
also shows as part of the chat session message blocks, so that user can delete or copy these
|
||||
if needed using the same mechanism as other messages in the chat session.
|
||||
* use a delete msg helper, which takes care of deleting the msg from chat session as well as
|
||||
efficiently update ui to any extent by removing the corresponding element directly from existing
|
||||
chat session ui without recreating the full chat session ui.
|
||||
* a helper to add a message into specified chat session, as well as show/update in the chat session
|
||||
ui by appending the chat message, instead of recreating the full chat session ui.
|
||||
...
|
||||
|
||||
MultiChatUI+
|
||||
* both chat_show and chat_uirefresh (if lastN >= 2) both take care of updating tool call edit/trigger
|
||||
as well as the tool call response edit/submit related ui elements suitably.
|
||||
* chat_show recreates currently active sliding window of chat session (which could even be full)
|
||||
* while chat_uirefresh recreates/updates ui only for the lastN messages (prefer in general, as optimal)
|
||||
* normal user response / query submit as well as tool call response or error submit have been updated
|
||||
to use the optimal uirefresh logic now.
|
||||
|
||||
Cleanup in general
|
||||
* Inform end user when loading from a saved session.
|
||||
* Update starting entry point flow to avoid calling chat_show twice indirectly, inturn leading to
|
||||
two restore previously saved session blocks. Rather when adding tool calls support, and inturn
|
||||
had to account for delayed collating of available simpleproxy based tool calls, I forgot to clean
|
||||
this flow up.
|
||||
* Make the sys_date_time template description bit more verbose, just in case.
|
||||
|
||||
* MultiChatUI+
|
||||
* both chat_show and chat_uirefresh (if lastN >= 2) both take care of updating tool call edit/trigger
|
||||
as well as the tool call response edit/submit related ui elements suitably.
|
||||
* chat_show recreates currently active sliding window of chat session (which could even be full)
|
||||
* while chat_uirefresh recreates/updates ui only for the lastN messages (prefer in general, as optimal)
|
||||
* normal user response / query submit as well as tool call response or error submit have been updated
|
||||
to use the optimal uirefresh logic now.
|
||||
|
||||
|
||||
#### ToDo
|
||||
|
|
|
|||
|
|
@ -23,12 +23,14 @@ let sysdatetime_meta = {
|
|||
"properties": {
|
||||
"template": {
|
||||
"type": "string",
|
||||
"description": `Optional template can be any combination of Y,M,D,h,m,s.
|
||||
"description": `Template is used to control what is included in the returned date time string.
|
||||
It can be any combination of Y,M,D,h,m,s. Here
|
||||
Y - FullYear 4 digits, M - Month 2 digits, D - Day 2 digits,
|
||||
h - hour 2 digits, m - minutes 2 digits, s - seconds 2 digits,
|
||||
any other char will be returned as is
|
||||
any other char will be returned as is.
|
||||
|
||||
If no template is given, it defaults to YMDThm
|
||||
If no template is given, it defaults to YMDThm.
|
||||
Remember that the template characters are case sensitive.
|
||||
`
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue