Hansimov commited on
Commit
ab4c27f
1 Parent(s): 436c8c4

:zap: [Enhance] Confirm before clear chat history, toggle if add new point, and change icons

Browse files
Files changed (2) hide show
  1. components/buttons_binder.js +8 -1
  2. index.html +5 -6
components/buttons_binder.js CHANGED
@@ -144,6 +144,9 @@ class AddEndpointAndApiKeyItemButtonBinder {
144
  const button = $("#add-endpoint-and-api-key-item-button");
145
  button.attr("title", "Add endpoint and api key item");
146
  button.click(() => {
 
 
 
147
  endpoint_storage.add_endpoint_and_api_key_item();
148
  });
149
  }
@@ -236,7 +239,11 @@ class ClearChatHistoryButtonBinder {
236
  const button = $("#clear-chat-history-button");
237
  button.attr("title", "Clear chat history");
238
  button.click(() => {
239
- chat_history_storer.clear_database();
 
 
 
 
240
  });
241
  }
242
  }
 
144
  const button = $("#add-endpoint-and-api-key-item-button");
145
  button.attr("title", "Add endpoint and api key item");
146
  button.click(() => {
147
+ if (!$("#endpoint-and-api-key-items").is(":visible")) {
148
+ $("#endpoint-and-api-key-items").toggle();
149
+ }
150
  endpoint_storage.add_endpoint_and_api_key_item();
151
  });
152
  }
 
239
  const button = $("#clear-chat-history-button");
240
  button.attr("title", "Clear chat history");
241
  button.click(() => {
242
+ if (confirm("Clear chat history?")) {
243
+ chat_history_storer.clear_database();
244
+ } else {
245
+ console.log("Clear chat history canceled.");
246
+ }
247
  });
248
  }
249
  }
index.html CHANGED
@@ -51,13 +51,13 @@
51
  </div>
52
  <div class="mt-2 row no-gutters">
53
  <div class="col-auto">
54
- <button id="toggle-endpoint-and-api-key-items-button" class="btn px-0">
55
- <i class="fa fa-key"></i>
56
  </button>
57
  </div>
58
  <div class="col-auto">
59
- <button id="add-endpoint-and-api-key-item-button" class="btn px-0 ">
60
- <i class="fa fa-circle-plus"></i>
61
  </button>
62
  </div>
63
  <div class="col px-0">
@@ -85,7 +85,7 @@
85
  <div class="mt-2 row no-gutters">
86
  <div class="col-auto pr-0">
87
  <button id="new-chat-session" class="btn px-0">
88
- <i class="fa fa-circle-plus"></i>
89
  </button>
90
  </div>
91
  <div class="col px-0">
@@ -98,7 +98,6 @@
98
  </button>
99
  </div>
100
  </div>
101
-
102
  </div>
103
  </div>
104
  </body>
 
51
  </div>
52
  <div class="mt-2 row no-gutters">
53
  <div class="col-auto">
54
+ <button id="add-endpoint-and-api-key-item-button" class="btn px-0 ">
55
+ <i class="fa fa-circle-plus"></i>
56
  </button>
57
  </div>
58
  <div class="col-auto">
59
+ <button id="toggle-endpoint-and-api-key-items-button" class="btn px-0">
60
+ <i class="fa fa-key"></i>
61
  </button>
62
  </div>
63
  <div class="col px-0">
 
85
  <div class="mt-2 row no-gutters">
86
  <div class="col-auto pr-0">
87
  <button id="new-chat-session" class="btn px-0">
88
+ <i class="fa fa-compass"></i>
89
  </button>
90
  </div>
91
  <div class="col px-0">
 
98
  </button>
99
  </div>
100
  </div>
 
101
  </div>
102
  </div>
103
  </body>