:zap: [Enhance] Displayer: Prettify button-group
Browse files- components/chat_operator.js +8 -4
- components/messager.js +9 -9
- css/default.css +6 -0
components/chat_operator.js
CHANGED
@@ -80,11 +80,15 @@ export function get_latest_user_messager() {
|
|
80 |
return $(".message-user").last();
|
81 |
}
|
82 |
|
|
|
|
|
|
|
|
|
83 |
export function start_latest_message_animation() {
|
84 |
-
|
85 |
.find(".content-displayer")
|
86 |
.addClass("blinking");
|
87 |
-
|
88 |
.find(".button-group")
|
89 |
.find(".regenerate-button")
|
90 |
.find("i")
|
@@ -92,10 +96,10 @@ export function start_latest_message_animation() {
|
|
92 |
}
|
93 |
|
94 |
export function stop_latest_message_animation() {
|
95 |
-
|
96 |
.find(".content-displayer")
|
97 |
.removeClass("blinking");
|
98 |
-
|
99 |
.find(".button-group")
|
100 |
.find(".regenerate-button")
|
101 |
.find("i")
|
|
|
80 |
return $(".message-user").last();
|
81 |
}
|
82 |
|
83 |
+
export function get_latest_assistant_messager() {
|
84 |
+
return $(".message-assistant").last();
|
85 |
+
}
|
86 |
+
|
87 |
export function start_latest_message_animation() {
|
88 |
+
get_latest_assistant_messager()
|
89 |
.find(".content-displayer")
|
90 |
.addClass("blinking");
|
91 |
+
get_latest_assistant_messager()
|
92 |
.find(".button-group")
|
93 |
.find(".regenerate-button")
|
94 |
.find("i")
|
|
|
96 |
}
|
97 |
|
98 |
export function stop_latest_message_animation() {
|
99 |
+
get_latest_assistant_messager()
|
100 |
.find(".content-displayer")
|
101 |
.removeClass("blinking");
|
102 |
+
get_latest_assistant_messager()
|
103 |
.find(".button-group")
|
104 |
.find(".regenerate-button")
|
105 |
.find("i")
|
components/messager.js
CHANGED
@@ -17,7 +17,7 @@ class MessagerViewer {
|
|
17 |
}
|
18 |
create_role_displayer() {
|
19 |
this.role_displayer = $("<div>")
|
20 |
-
.addClass("position-absolute
|
21 |
.addClass("role-displayer")
|
22 |
.css("z-index", "1")
|
23 |
.css("padding", "auto")
|
@@ -38,31 +38,31 @@ class MessagerViewer {
|
|
38 |
}
|
39 |
create_button_group() {
|
40 |
this.button_group = $("<div>")
|
41 |
-
.addClass("position-absolute
|
42 |
.addClass("button-group")
|
43 |
.css("z-index", "1")
|
44 |
.css("padding", "auto");
|
45 |
|
46 |
this.edit_button = $("<button>")
|
47 |
-
.addClass("btn px-2")
|
48 |
.addClass("edit-button")
|
49 |
.attr("title", "Edit")
|
50 |
-
.append($("<
|
51 |
this.button_group.append(this.edit_button);
|
52 |
|
53 |
this.copy_button = $("<button>")
|
54 |
-
.addClass("btn px-2")
|
55 |
.addClass("copy-button")
|
56 |
.attr("title", "Copy")
|
57 |
-
.append($("<
|
58 |
this.button_group.append(this.copy_button);
|
59 |
|
60 |
-
if (this.message.role === "
|
61 |
this.regenerate_button = $("<button>")
|
62 |
-
.addClass("btn px-2")
|
63 |
.addClass("regenerate-button")
|
64 |
.attr("title", "Regenerate")
|
65 |
-
.append($("<
|
66 |
this.button_group.append(this.regenerate_button);
|
67 |
} else {
|
68 |
}
|
|
|
17 |
}
|
18 |
create_role_displayer() {
|
19 |
this.role_displayer = $("<div>")
|
20 |
+
.addClass("position-absolute px-2")
|
21 |
.addClass("role-displayer")
|
22 |
.css("z-index", "1")
|
23 |
.css("padding", "auto")
|
|
|
38 |
}
|
39 |
create_button_group() {
|
40 |
this.button_group = $("<div>")
|
41 |
+
.addClass("position-absolute text-end px-1")
|
42 |
.addClass("button-group")
|
43 |
.css("z-index", "1")
|
44 |
.css("padding", "auto");
|
45 |
|
46 |
this.edit_button = $("<button>")
|
47 |
+
.addClass("btn pt-0 px-2")
|
48 |
.addClass("edit-button")
|
49 |
.attr("title", "Edit")
|
50 |
+
.append($("<span>").addClass("fa fa-small fa-edit"));
|
51 |
this.button_group.append(this.edit_button);
|
52 |
|
53 |
this.copy_button = $("<button>")
|
54 |
+
.addClass("btn pt-0 px-2")
|
55 |
.addClass("copy-button")
|
56 |
.attr("title", "Copy")
|
57 |
+
.append($("<span>").addClass("fa fa-small fa-copy"));
|
58 |
this.button_group.append(this.copy_button);
|
59 |
|
60 |
+
if (this.message.role === "assistant") {
|
61 |
this.regenerate_button = $("<button>")
|
62 |
+
.addClass("btn pt-0 px-2")
|
63 |
.addClass("regenerate-button")
|
64 |
.attr("title", "Regenerate")
|
65 |
+
.append($("<span>").addClass("fa fa-small fa-rotate"));
|
66 |
this.button_group.append(this.regenerate_button);
|
67 |
} else {
|
68 |
}
|
css/default.css
CHANGED
@@ -98,6 +98,12 @@
|
|
98 |
color: lightsalmon;
|
99 |
}
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
.icon-success {
|
102 |
color: green;
|
103 |
}
|
|
|
98 |
color: lightsalmon;
|
99 |
}
|
100 |
|
101 |
+
.fa-small {
|
102 |
+
font-size: small;
|
103 |
+
margin: 0;
|
104 |
+
padding: 0;
|
105 |
+
}
|
106 |
+
|
107 |
.icon-success {
|
108 |
color: green;
|
109 |
}
|