Skip to content

Commit 685c6ea

Browse files
committed
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.
1 parent 45908af commit 685c6ea

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

tools/server/public_simplechat/index.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424

2525
<div class="sameline" id="heading">
2626
<p class="heading flex-grow" > <b> SimpleChat </b> </p>
27-
<button id="settings">Settings</button>
27+
<div>
28+
<button id="clearchat">&#x1F9F9; ClearChat</button>
29+
<button id="settings">&#x2699; Settings</button>
30+
</div>
2831
</div>
2932

3033
<div id="sessions-div" class="sameline"></div>

tools/server/public_simplechat/readme.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,14 @@ Once inside
182182
not get/see a tool call, in such situations, dont forget to cross check that tool calling is
183183
enabled in the settings.
184184

185-
* just refresh the page, to reset wrt the chat history and or system prompt and start afresh.
186-
This also helps if you had forgotten to start the bundled simpleproxy.py server before hand.
187-
Start the simpleproxy.py server and refresh the client ui page, to get access to web access
188-
related tool calls.
189-
* if you refreshed unknowingly, you can use the Restore feature to try load the previous chat
185+
* ClearChat/Refresh
186+
* use the clearchat button to clear the currently active chat session.
187+
* just refresh the page, to reset wrt the chat history and system prompts across chat sessions
188+
and start afresh.
189+
* This also helps if you had forgotten to start the bundled simpleproxy.py server before hand.
190+
Start the simpleproxy.py server and refresh the client ui page, to get access to web access
191+
related tool calls.
192+
* if you refreshed/cleared unknowingly, you can use the Restore feature to try load previous chat
190193
session and resume that session. This uses a basic local auto save logic that is in there.
191194

192195
* Using NewChat one can start independent chat sessions.
@@ -434,7 +437,8 @@ The following tools/functions are currently provided by default
434437

435438
* simple_calculator - which can solve simple arithmatic expressions
436439

437-
* run_javascript_function_code - which can be used to run ai generated or otherwise javascript code using browser's js capabilities.
440+
* run_javascript_function_code - which can be used to run ai generated or otherwise javascript code
441+
using browser's js capabilities.
438442

439443
* data_store_get/set/delete/list - allows for a basic data store to be used.
440444

@@ -620,6 +624,8 @@ channel of the handshake.
620624
having ai responses built over multiple steps of tool callings etal. So independent of our client side
621625
sliding window based drop off or even before they kick in, this can help in many cases.
622626

627+
* UI - add ClearChat button and logic. Also add unicode icons for same as well as for Settings.
628+
623629

624630
#### ToDo
625631

tools/server/public_simplechat/simplechat.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ class SimpleChat {
326326
clear() {
327327
this.xchat = [];
328328
this.iLastSys = -1;
329+
this.latestResponse = new ChatMessageEx();
329330
}
330331

331332
ods_key() {
@@ -797,6 +798,7 @@ class MultiChatUI {
797798
this.elDivHeading = /** @type{HTMLSelectElement} */(document.getElementById("heading"));
798799
this.elDivSessions = /** @type{HTMLDivElement} */(document.getElementById("sessions-div"));
799800
this.elBtnSettings = /** @type{HTMLButtonElement} */(document.getElementById("settings"));
801+
this.elBtnClearChat = /** @type{HTMLButtonElement} */(document.getElementById("clearchat"));
800802
this.elDivTool = /** @type{HTMLDivElement} */(document.getElementById("tool-div"));
801803
this.elBtnTool = /** @type{HTMLButtonElement} */(document.getElementById("tool-btn"));
802804
this.elInToolName = /** @type{HTMLInputElement} */(document.getElementById("toolname-in"));
@@ -1030,6 +1032,10 @@ class MultiChatUI {
10301032
this.elDivChat.replaceChildren();
10311033
gMe.show_settings(this.elDivChat);
10321034
});
1035+
this.elBtnClearChat.addEventListener("click", (ev)=>{
1036+
this.simpleChats[this.curChatId].clear()
1037+
this.chat_show(this.curChatId)
1038+
});
10331039

10341040
this.elBtnUser.addEventListener("click", (ev)=>{
10351041
clearTimeout(this.timers.toolcallResponseSubmitClick)

0 commit comments

Comments
 (0)