:gem: [Feature] Replace text with icon for buttons
Browse files
apps/llm_mixer/index.html
CHANGED
@@ -4,11 +4,15 @@
|
|
4 |
|
5 |
<head>
|
6 |
<title>LLM Mixer</title>
|
7 |
-
<link href="./js/common/bootstrap.min.css"
|
8 |
-
<script src="./js/common/bootstrap.bundle.min.js"></script>
|
9 |
<script src="./js/common/jquery.min.js"></script>
|
10 |
<script type="text/javascript" src="./js/common/live.js"></script>
|
|
|
11 |
<link rel="stylesheet" href="./js/default.css" />
|
|
|
|
|
|
|
|
|
12 |
</head>
|
13 |
<body>
|
14 |
<div class="container">
|
@@ -24,6 +28,11 @@
|
|
24 |
</div>
|
25 |
<div class="mt-2">
|
26 |
<div class="row no-gutters">
|
|
|
|
|
|
|
|
|
|
|
27 |
<div class="col">
|
28 |
<textarea
|
29 |
id="user-input"
|
@@ -33,11 +42,8 @@
|
|
33 |
></textarea>
|
34 |
</div>
|
35 |
<div class="col-auto">
|
36 |
-
<button
|
37 |
-
|
38 |
-
class="btn btn-primary"
|
39 |
-
>
|
40 |
-
Send
|
41 |
</button>
|
42 |
</div>
|
43 |
</div>
|
|
|
4 |
|
5 |
<head>
|
6 |
<title>LLM Mixer</title>
|
7 |
+
<link rel="stylesheet" href="./js/common/bootstrap.min.css" />
|
|
|
8 |
<script src="./js/common/jquery.min.js"></script>
|
9 |
<script type="text/javascript" src="./js/common/live.js"></script>
|
10 |
+
<script src="./js/common/bootstrap.bundle.min.js"></script>
|
11 |
<link rel="stylesheet" href="./js/default.css" />
|
12 |
+
<link
|
13 |
+
rel="stylesheet"
|
14 |
+
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"
|
15 |
+
/>
|
16 |
</head>
|
17 |
<body>
|
18 |
<div class="container">
|
|
|
28 |
</div>
|
29 |
<div class="mt-2">
|
30 |
<div class="row no-gutters">
|
31 |
+
<div class="col-auto">
|
32 |
+
<button id="new-chat-session" class="btn">
|
33 |
+
<i class="fa fa-circle-plus"></i>
|
34 |
+
</button>
|
35 |
+
</div>
|
36 |
<div class="col">
|
37 |
<textarea
|
38 |
id="user-input"
|
|
|
42 |
></textarea>
|
43 |
</div>
|
44 |
<div class="col-auto">
|
45 |
+
<button id="send-user-input" class="btn">
|
46 |
+
<i class="fa-solid fa-paper-plane"></i>
|
|
|
|
|
|
|
47 |
</button>
|
48 |
</div>
|
49 |
</div>
|
apps/llm_mixer/js/buttons_binder.js
CHANGED
@@ -7,13 +7,17 @@ export class ButtonsBinder {
|
|
7 |
}
|
8 |
bind_send_user_input() {
|
9 |
const button = $("#send-user-input");
|
|
|
10 |
button.click(async () => {
|
11 |
await this.handle_user_input(button);
|
12 |
});
|
13 |
|
14 |
$("#user-input").keypress(async (event) => {
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
17 |
event.preventDefault();
|
18 |
await this.send(button);
|
19 |
}
|
@@ -24,12 +28,10 @@ export class ButtonsBinder {
|
|
24 |
if (user_input_content === "") {
|
25 |
return;
|
26 |
}
|
27 |
-
let status = button.
|
28 |
-
if (status === "
|
29 |
this.send(button);
|
30 |
-
} else if (status === "
|
31 |
-
this.regenerate(button);
|
32 |
-
} else if (status === "Stop") {
|
33 |
this.stop(button);
|
34 |
return;
|
35 |
} else {
|
@@ -46,40 +48,25 @@ export class ButtonsBinder {
|
|
46 |
|
47 |
async send(button) {
|
48 |
console.log("Send");
|
49 |
-
button
|
50 |
-
|
51 |
-
|
52 |
-
.
|
|
|
|
|
53 |
await this.post_user_input();
|
54 |
-
button
|
55 |
-
|
56 |
-
.removeClass("btn-warning")
|
57 |
-
.addClass("btn-success")
|
58 |
-
.attr("disabled", false);
|
59 |
-
}
|
60 |
-
async regenerate(button) {
|
61 |
-
console.log("Regenerate");
|
62 |
-
button
|
63 |
-
.text("Stop")
|
64 |
-
.removeClass("btn-primary btn-success")
|
65 |
-
.addClass("btn-warning");
|
66 |
-
pop_messager(2);
|
67 |
-
await this.post_user_input();
|
68 |
-
button
|
69 |
-
.text("Regenerate")
|
70 |
-
.removeClass("btn-warning")
|
71 |
-
.addClass("btn-success")
|
72 |
-
.attr("disabled", false);
|
73 |
}
|
74 |
async stop(button) {
|
75 |
console.log("Stop");
|
|
|
76 |
this.requester.stop();
|
77 |
-
button
|
78 |
-
|
79 |
-
.removeClass(
|
80 |
-
.addClass("
|
81 |
-
.
|
82 |
-
.attr("disabled", false);
|
83 |
}
|
84 |
bind() {
|
85 |
this.bind_send_user_input();
|
|
|
7 |
}
|
8 |
bind_send_user_input() {
|
9 |
const button = $("#send-user-input");
|
10 |
+
button.attr("status", "send");
|
11 |
button.click(async () => {
|
12 |
await this.handle_user_input(button);
|
13 |
});
|
14 |
|
15 |
$("#user-input").keypress(async (event) => {
|
16 |
+
if (
|
17 |
+
event.key === "Enter" &&
|
18 |
+
!event.shiftKey &&
|
19 |
+
button.attr("status") === "send"
|
20 |
+
) {
|
21 |
event.preventDefault();
|
22 |
await this.send(button);
|
23 |
}
|
|
|
28 |
if (user_input_content === "") {
|
29 |
return;
|
30 |
}
|
31 |
+
let status = button.attr("status");
|
32 |
+
if (status === "send") {
|
33 |
this.send(button);
|
34 |
+
} else if (status === "stop") {
|
|
|
|
|
35 |
this.stop(button);
|
36 |
return;
|
37 |
} else {
|
|
|
48 |
|
49 |
async send(button) {
|
50 |
console.log("Send");
|
51 |
+
let button_icon = button.find("i");
|
52 |
+
button.attr("status", "stop");
|
53 |
+
button_icon
|
54 |
+
.removeClass()
|
55 |
+
.addClass("fa fa-circle-pause fa-fade")
|
56 |
+
.css("color", "orange");
|
57 |
await this.post_user_input();
|
58 |
+
button.attr("status", "send");
|
59 |
+
button_icon.removeClass().addClass("fa fa-paper-plane");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
}
|
61 |
async stop(button) {
|
62 |
console.log("Stop");
|
63 |
+
let button_icon = button.find("i");
|
64 |
this.requester.stop();
|
65 |
+
button.attr("status", "send");
|
66 |
+
button_icon
|
67 |
+
.removeClass()
|
68 |
+
.addClass("fa fa-paper-plane")
|
69 |
+
.css("color", "red");
|
|
|
70 |
}
|
71 |
bind() {
|
72 |
this.bind_send_user_input();
|
apps/llm_mixer/js/llm_models_loader.js
CHANGED
@@ -5,7 +5,7 @@ export async function setup_available_models_on_select(default_option = null) {
|
|
5 |
select.empty();
|
6 |
await request_available_models();
|
7 |
if (default_option === null) {
|
8 |
-
default_option = "gpt-
|
9 |
}
|
10 |
|
11 |
available_models.forEach((value, index) => {
|
|
|
5 |
select.empty();
|
6 |
await request_available_models();
|
7 |
if (default_option === null) {
|
8 |
+
default_option = "gpt-3.5-turbo";
|
9 |
}
|
10 |
|
11 |
available_models.forEach((value, index) => {
|