From 6b42305f59ff2b8e576c80a968ebc7d78a207d73 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Tue, 6 May 2025 04:56:30 +0530 Subject: [PATCH] fix: Show agent bot name and avatar correctly in messages (#11394) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR fixes an issue where messages from the agent bot were incorrectly displayed as "BOT" with a missing avatar. It now correctly shows the agent bot’s name and avatar URL in the message list. --- .../components-next/message/Message.vue | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/javascript/dashboard/components-next/message/Message.vue b/app/javascript/dashboard/components-next/message/Message.vue index 9d6b30f81..a3d5df015 100644 --- a/app/javascript/dashboard/components-next/message/Message.vue +++ b/app/javascript/dashboard/components-next/message/Message.vue @@ -394,23 +394,29 @@ function handleReplyTo() { } const avatarInfo = computed(() => { - if (!props.sender || props.sender.type === SENDER_TYPES.AGENT_BOT) { + // If no sender, return bot info + if (!props.sender) { return { name: t('CONVERSATION.BOT'), src: '', }; } - if (props.sender) { + const { sender } = props; + const { name, type, avatarUrl, thumbnail } = sender || {}; + + // If sender type is agent bot, use avatarUrl + if (type === SENDER_TYPES.AGENT_BOT) { return { - name: props.sender.name, - src: props.sender?.thumbnail, + name: name ?? '', + src: avatarUrl ?? '', }; } + // For all other senders, use thumbnail return { - name: '', - src: '', + name: name ?? '', + src: thumbnail ?? '', }; });