SimpleChatTCRV:UICleanup: Full chat messages ui refresh when needed

Starting out with a new chat.

Switching back from settings directly.
This commit is contained in:
hanishkvc 2025-11-20 03:28:19 +05:30
parent 9e720e7688
commit d242e7021a
2 changed files with 21 additions and 2 deletions

View File

@ -824,6 +824,10 @@ Cleanup in general
* however retain the horizontal line seperation between the tool trigger block and user input block,
given that some users and some ai dont seem to identify the difference very easily.
* work around firefox currently not yet supporting anchor based relative positioning of popover.
* ensure the new uirefresh flow handles the following situations in a clean way like
* a new chat session clearing out usagenote+restore+currentconfig, as user starts chatting
* the settings ui getting cleared out as user starts/continues chatting directly into user input
without using chat session button to switch back to the chat.
* Auto ObjPropsEdit UI
* allow it to be themed by assigning id to top level block.
* fix a oversight (forgotten $) with use of templated literals and having variables in them.
@ -855,8 +859,11 @@ Have a seperate helper to show the user input area, based on set state. And have
if the models support same. It should also take care of some aspects of the tool call response edit / submit,
potentially.
Should I force a chat_show which clears usage and current settings info from chat session ui block at the
begining like before the new optimised uirefresh based flow?
MAYBE add a special ClientSideOnly role for use wrt Chat history to maintain things to be shown in a chat
session to the end user, but inturn not to be sent to the ai server. Ex current settings or so ...
Update UIRefresh helper to optionally remove messages no longer in the sliding window, so user only sees
what is sent to the ai server in the chat session messages ui.
Updating system prompt, will reset user input area fully now, which seems a good enough behaviour, while
keeping the code flow also simple and straight, do I need to change it, I dont think so as of now.

View File

@ -1425,6 +1425,9 @@ class MultiChatUI {
* Also tool call & response edit/trigger/submit ui will be
* updated as needed, provided lastN is atleast 2.
*
* If the houseKeeping.clear flag is set then fallback to
* the brute force full on chat_show.
*
* @param {string} chatId
* @param {number} lastN
*/
@ -1433,6 +1436,10 @@ class MultiChatUI {
if (chat.chatId != this.curChatId) {
return false
}
if (this.me.houseKeeping.clear) {
this.me.houseKeeping.clear = false
return this.chat_show(chatId, true, true)
}
this.ui_userinput_reset(false)
this.ui_reset_toolcall_as_needed(new ChatMessageEx());
for(let i=lastN; i > 0; i-=1) {
@ -1502,6 +1509,7 @@ class MultiChatUI {
this.elBtnSettings.addEventListener("click", (ev)=>{
this.elDivChat.replaceChildren();
this.me.show_settings(this.elDivChat);
this.me.houseKeeping.clear = true;
});
this.elBtnClearChat.addEventListener("click", (ev)=>{
this.simpleChats[this.curChatId].clear()
@ -1797,6 +1805,7 @@ class MultiChatUI {
this.curChatId = chatId;
this.chat_show(chatId, true, true);
this.elInUser.focus();
this.me.houseKeeping.clear = true;
console.log(`INFO:SimpleChat:MCUI:HandleSessionSwitch:${chatId} entered...`);
}
@ -1893,6 +1902,9 @@ export class Me {
* @type {(string | ArrayBuffer | null)[]}
*/
this.dataURLs = []
this.houseKeeping = {
clear: true,
}
}
/**