Skip to content

Commit 25c9150

Browse files
committed
ui improvement
1 parent bd056a7 commit 25c9150

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

js/widgets/reflection.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,18 @@ class ReflectionMatrix {
9898
this.chatInterface.className = "chatInterface";
9999
widgetWindow.getWidgetBody().append(this.chatInterface);
100100

101-
widgetWindow.addButton("notes_icon.svg", ReflectionMatrix.ICONSIZE, _("Summary")).onclick =
102-
() => this.getAnalysis();
101+
this.summaryButton = widgetWindow.addButton(
102+
"notes_icon.svg",
103+
ReflectionMatrix.ICONSIZE,
104+
_("Summary")
105+
);
106+
107+
this.summaryButton.onclick = () => this.getAnalysis();
108+
109+
if (this.chatHistory.length < 10) {
110+
this.summaryButton.style.background = "gray";
111+
}
112+
103113
widgetWindow.addButton(
104114
"save-button-dark.svg",
105115
ReflectionMatrix.ICONSIZE,
@@ -430,6 +440,7 @@ class ReflectionMatrix {
430440
let reply;
431441
// check if message is from user or bot
432442
if (user_query === true) {
443+
if (this.typingDiv) return;
433444
reply = await this.generateBotReply(
434445
message,
435446
this.chatHistory,
@@ -451,6 +462,10 @@ class ReflectionMatrix {
451462
content: reply.response
452463
});
453464

465+
if (this.chatHistory.length > 10) {
466+
this.summaryButton.style.removeProperty("background");
467+
}
468+
454469
const messageContainer = document.createElement("div");
455470
messageContainer.className = "message-container";
456471

0 commit comments

Comments
 (0)