:recycle: [Refactor] Encapsulate bind_buttons to class ButtonsBinder
Browse files- components/buttons_binder.js +23 -20
- main.js +3 -2
components/buttons_binder.js
CHANGED
@@ -8,26 +8,29 @@ import {
|
|
8 |
set_user_scroll_status,
|
9 |
} from "./chat_operator.js";
|
10 |
|
11 |
-
export
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
31 |
}
|
32 |
|
33 |
class SendUserInputButtonBinder {
|
|
|
8 |
set_user_scroll_status,
|
9 |
} from "./chat_operator.js";
|
10 |
|
11 |
+
export class ButtonsBinder {
|
12 |
+
constructor() {}
|
13 |
+
bind() {
|
14 |
+
let send_user_input_binder = new SendUserInputButtonBinder();
|
15 |
+
send_user_input_binder.bind();
|
16 |
+
let new_chat_binder = new NewChatButtonBinder();
|
17 |
+
new_chat_binder.bind();
|
18 |
+
let openai_endpoint_binder = new OpenaiEndpointButtonBinder();
|
19 |
+
openai_endpoint_binder.bind();
|
20 |
+
let openai_api_key_binder = new OpenaiAPIKeyButtonBinder();
|
21 |
+
openai_api_key_binder.bind();
|
22 |
+
let show_endpoint_and_key_binder = new ShowEndpointAndKeyButtonBinder();
|
23 |
+
show_endpoint_and_key_binder.bind();
|
24 |
+
let scroll_to_bottom_binder = new ScrollToBottomButtonBinder();
|
25 |
+
scroll_to_bottom_binder.bind();
|
26 |
+
let chat_session_container_scroll_binder =
|
27 |
+
new ChatSessionContainerScrollBinder();
|
28 |
+
chat_session_container_scroll_binder.bind();
|
29 |
+
let screenshot_button_binder = new ScreenshotButtonBinder();
|
30 |
+
screenshot_button_binder.bind();
|
31 |
+
let available_models_select_binder = new AvailableModelsSelectBinder();
|
32 |
+
available_models_select_binder.bind();
|
33 |
+
}
|
34 |
}
|
35 |
|
36 |
class SendUserInputButtonBinder {
|
main.js
CHANGED
@@ -2,7 +2,7 @@ import {
|
|
2 |
setup_available_models_on_select,
|
3 |
setup_temperature_on_select,
|
4 |
} from "./components/llm_models_loader.js";
|
5 |
-
import {
|
6 |
|
7 |
function auto_resize_user_input() {
|
8 |
// https://stackoverflow.com/questions/37629860/automatically-resizing-textarea-in-bootstrap
|
@@ -28,7 +28,8 @@ function setup_interactive_components() {
|
|
28 |
setup_available_models_on_select();
|
29 |
setup_temperature_on_select();
|
30 |
auto_resize_user_input();
|
31 |
-
|
|
|
32 |
adjust_messagers_container_max_height();
|
33 |
$(window).on("resize", adjust_messagers_container_max_height);
|
34 |
}
|
|
|
2 |
setup_available_models_on_select,
|
3 |
setup_temperature_on_select,
|
4 |
} from "./components/llm_models_loader.js";
|
5 |
+
import { ButtonsBinder } from "./components/buttons_binder.js";
|
6 |
|
7 |
function auto_resize_user_input() {
|
8 |
// https://stackoverflow.com/questions/37629860/automatically-resizing-textarea-in-bootstrap
|
|
|
28 |
setup_available_models_on_select();
|
29 |
setup_temperature_on_select();
|
30 |
auto_resize_user_input();
|
31 |
+
let buttons_binder = new ButtonsBinder();
|
32 |
+
buttons_binder.bind();
|
33 |
adjust_messagers_container_max_height();
|
34 |
$(window).on("resize", adjust_messagers_container_max_height);
|
35 |
}
|