Hansimov commited on
Commit
af8a4b7
1 Parent(s): ebbfc38

:gem: [Feature] Memorize last used model

Browse files
apps/llm_mixer/index.html CHANGED
@@ -27,7 +27,7 @@
27
  </head>
28
  <body>
29
  <div id="main-container">
30
- <div id="chat-session-container">
31
  <div id="messagers-container" class="container m-3 py-2"></div>
32
  </div>
33
  <div id="user-interactions" class="container fixed-bottom mb-3">
 
27
  </head>
28
  <body>
29
  <div id="main-container">
30
+ <div id="chat-session-container" class="container">
31
  <div id="messagers-container" class="container m-3 py-2"></div>
32
  </div>
33
  <div id="user-interactions" class="container fixed-bottom mb-3">
apps/llm_mixer/js/buttons_binder.js CHANGED
@@ -26,6 +26,8 @@ export function bind_chat_buttons() {
26
  chat_session_container_scroll_binder.bind();
27
  let screenshot_button_binder = new ScreenshotButtonBinder();
28
  screenshot_button_binder.bind();
 
 
29
  }
30
 
31
  class SendUserInputButtonBinder {
@@ -222,3 +224,14 @@ class ScreenshotButtonBinder {
222
  });
223
  }
224
  }
 
 
 
 
 
 
 
 
 
 
 
 
26
  chat_session_container_scroll_binder.bind();
27
  let screenshot_button_binder = new ScreenshotButtonBinder();
28
  screenshot_button_binder.bind();
29
+ let available_models_select_binder = new AvailableModelsSelectBinder();
30
+ available_models_select_binder.bind();
31
  }
32
 
33
  class SendUserInputButtonBinder {
 
224
  });
225
  }
226
  }
227
+
228
+ class AvailableModelsSelectBinder {
229
+ constructor() {}
230
+ bind() {
231
+ const select = $("#available-models-select");
232
+ select.change(() => {
233
+ console.log(select.val());
234
+ localStorage.setItem("default_model", select.val());
235
+ });
236
+ }
237
+ }
apps/llm_mixer/js/llm_models_loader.js CHANGED
@@ -4,9 +4,6 @@ export async function setup_available_models_on_select(default_option = null) {
4
  var select = $("#available-models-select");
5
  select.empty();
6
  await request_available_models();
7
- if (default_option === null) {
8
- default_option = "gpt-3.5-turbo";
9
- }
10
  const working_models = [
11
  "bing-precise",
12
  "bing-balanced",
@@ -53,10 +50,12 @@ export async function setup_available_models_on_select(default_option = null) {
53
  if (available_models.includes(value)) {
54
  select.append(option);
55
  }
56
- if (value === default_option) {
57
- $(option).prop("selected", true);
58
- }
59
  });
 
 
 
 
 
60
  console.log(`Default model: ${select.val()}`);
61
  }
62
 
 
4
  var select = $("#available-models-select");
5
  select.empty();
6
  await request_available_models();
 
 
 
7
  const working_models = [
8
  "bing-precise",
9
  "bing-balanced",
 
50
  if (available_models.includes(value)) {
51
  select.append(option);
52
  }
 
 
 
53
  });
54
+ let default_model = "gpt-turbo-3.5";
55
+ if (localStorage.getItem("default_model")) {
56
+ default_model = localStorage.getItem("default_model");
57
+ }
58
+ select.val(default_model);
59
  console.log(`Default model: ${select.val()}`);
60
  }
61