fix: Show agent bot name and avatar correctly in messages (#11394)
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.
This commit is contained in:
@@ -394,23 +394,29 @@ function handleReplyTo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const avatarInfo = computed(() => {
|
const avatarInfo = computed(() => {
|
||||||
if (!props.sender || props.sender.type === SENDER_TYPES.AGENT_BOT) {
|
// If no sender, return bot info
|
||||||
|
if (!props.sender) {
|
||||||
return {
|
return {
|
||||||
name: t('CONVERSATION.BOT'),
|
name: t('CONVERSATION.BOT'),
|
||||||
src: '',
|
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 {
|
return {
|
||||||
name: props.sender.name,
|
name: name ?? '',
|
||||||
src: props.sender?.thumbnail,
|
src: avatarUrl ?? '',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For all other senders, use thumbnail
|
||||||
return {
|
return {
|
||||||
name: '',
|
name: name ?? '',
|
||||||
src: '',
|
src: thumbnail ?? '',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user