From f41850e4044b6cb52b3117a23582b24a04aabb36 Mon Sep 17 00:00:00 2001
From: Alexander <98586297+Alexander-Kezik@users.noreply.github.com>
Date: Tue, 24 Dec 2024 10:08:37 +0100
Subject: [PATCH] fix(chat): show like/dislike/copy buttons only if content
message hasn't error message or content isn't empty (Issue #125) (#2865)
---
.../Chat/ChatMessage/MessageButtons.tsx | 139 +++++++++---------
1 file changed, 71 insertions(+), 68 deletions(-)
diff --git a/apps/chat/src/components/Chat/ChatMessage/MessageButtons.tsx b/apps/chat/src/components/Chat/ChatMessage/MessageButtons.tsx
index 85e095fd01..0e7249dc19 100644
--- a/apps/chat/src/components/Chat/ChatMessage/MessageButtons.tsx
+++ b/apps/chat/src/components/Chat/ChatMessage/MessageButtons.tsx
@@ -154,81 +154,84 @@ export const MessageAssistantButtons = ({
)}
- {messageCopied ? (
-
-
-
- ) : (
-
-
-
- )}
+ {(message.content.trim() || !message.errorMessage) &&
+ (messageCopied ? (
+
+
+
+ ) : (
+
+
+
+ ))}
- {isLikesEnabled && !!message.responseId && (
- <>
- {message.like !== LikeState.Disliked && (
-
-
-
- )}
- {message.like !== LikeState.Liked && (
-
-
+ )}
+ {message.like !== LikeState.Liked && (
+
-
-
-
- )}
- >
- )}
+ {
+ if (message.like !== LikeState.NoState) {
+ onLike(LikeState.Disliked);
+ }
+ }}
+ className={
+ message.like !== LikeState.Disliked
+ ? 'text-secondary'
+ : 'text-accent-primary'
+ }
+ disabled={message.like === LikeState.Disliked}
+ data-qa="dislike"
+ >
+
+
+
+ )}
+ >
+ )}
);