SimpleChatTC:UI:ClearChat, Unicode icons for Clear, settings

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.
This commit is contained in:
hanishkvc 2025-11-04 23:55:51 +05:30
parent 2394d38d58
commit 0fcb13257c
3 changed files with 22 additions and 7 deletions

View File

@ -24,7 +24,10 @@
<div class="sameline" id="heading"> <div class="sameline" id="heading">
<p class="heading flex-grow" > <b> SimpleChat </b> </p> <p class="heading flex-grow" > <b> SimpleChat </b> </p>
<button id="settings">Settings</button> <div>
<button id="clearchat">&#x1F9F9; ClearChat</button>
<button id="settings">&#x2699; Settings</button>
</div>
</div> </div>
<div id="sessions-div" class="sameline"></div> <div id="sessions-div" class="sameline"></div>

View File

@ -182,11 +182,14 @@ Once inside
not get/see a tool call, in such situations, dont forget to cross check that tool calling is not get/see a tool call, in such situations, dont forget to cross check that tool calling is
enabled in the settings. enabled in the settings.
* just refresh the page, to reset wrt the chat history and or system prompt and start afresh. * ClearChat/Refresh
This also helps if you had forgotten to start the bundled simpleproxy.py server before hand. * use the clearchat button to clear the currently active chat session.
Start the simpleproxy.py server and refresh the client ui page, to get access to web access * just refresh the page, to reset wrt the chat history and system prompts across chat sessions
related tool calls. and start afresh.
* if you refreshed unknowingly, you can use the Restore feature to try load the previous chat * This also helps if you had forgotten to start the bundled simpleproxy.py server before hand.
Start the simpleproxy.py server and refresh the client ui page, to get access to web access
related tool calls.
* if you refreshed/cleared unknowingly, you can use the Restore feature to try load previous chat
session and resume that session. This uses a basic local auto save logic that is in there. session and resume that session. This uses a basic local auto save logic that is in there.
* Using NewChat one can start independent chat sessions. * Using NewChat one can start independent chat sessions.
@ -434,7 +437,8 @@ The following tools/functions are currently provided by default
* simple_calculator - which can solve simple arithmatic expressions * simple_calculator - which can solve simple arithmatic expressions
* run_javascript_function_code - which can be used to run ai generated or otherwise javascript code using browser's js capabilities. * run_javascript_function_code - which can be used to run ai generated or otherwise javascript code
using browser's js capabilities.
* data_store_get/set/delete/list - allows for a basic data store to be used. * data_store_get/set/delete/list - allows for a basic data store to be used.
@ -620,6 +624,8 @@ channel of the handshake.
having ai responses built over multiple steps of tool callings etal. So independent of our client side 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. 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.
#### ToDo #### ToDo

View File

@ -326,6 +326,7 @@ class SimpleChat {
clear() { clear() {
this.xchat = []; this.xchat = [];
this.iLastSys = -1; this.iLastSys = -1;
this.latestResponse = new ChatMessageEx();
} }
ods_key() { ods_key() {
@ -797,6 +798,7 @@ class MultiChatUI {
this.elDivHeading = /** @type{HTMLSelectElement} */(document.getElementById("heading")); this.elDivHeading = /** @type{HTMLSelectElement} */(document.getElementById("heading"));
this.elDivSessions = /** @type{HTMLDivElement} */(document.getElementById("sessions-div")); this.elDivSessions = /** @type{HTMLDivElement} */(document.getElementById("sessions-div"));
this.elBtnSettings = /** @type{HTMLButtonElement} */(document.getElementById("settings")); this.elBtnSettings = /** @type{HTMLButtonElement} */(document.getElementById("settings"));
this.elBtnClearChat = /** @type{HTMLButtonElement} */(document.getElementById("clearchat"));
this.elDivTool = /** @type{HTMLDivElement} */(document.getElementById("tool-div")); this.elDivTool = /** @type{HTMLDivElement} */(document.getElementById("tool-div"));
this.elBtnTool = /** @type{HTMLButtonElement} */(document.getElementById("tool-btn")); this.elBtnTool = /** @type{HTMLButtonElement} */(document.getElementById("tool-btn"));
this.elInToolName = /** @type{HTMLInputElement} */(document.getElementById("toolname-in")); this.elInToolName = /** @type{HTMLInputElement} */(document.getElementById("toolname-in"));
@ -1030,6 +1032,10 @@ class MultiChatUI {
this.elDivChat.replaceChildren(); this.elDivChat.replaceChildren();
gMe.show_settings(this.elDivChat); gMe.show_settings(this.elDivChat);
}); });
this.elBtnClearChat.addEventListener("click", (ev)=>{
this.simpleChats[this.curChatId].clear()
this.chat_show(this.curChatId)
});
this.elBtnUser.addEventListener("click", (ev)=>{ this.elBtnUser.addEventListener("click", (ev)=>{
clearTimeout(this.timers.toolcallResponseSubmitClick) clearTimeout(this.timers.toolcallResponseSubmitClick)