Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix: render mention name from serialized attribute instead of falling back to unknown (#15831)

Arvin Xu3c43d55c69a0
diff --git a/src/features/Conversation/Markdown/plugins/Mention/Render.tsx b/src/features/Conversation/Markdown/plugins/Mention/Render.tsx
index 2860f98bf0d..d11f99e0a17 100644
--- a/src/features/Conversation/Markdown/plugins/Mention/Render.tsx
+++ b/src/features/Conversation/Markdown/plugins/Mention/Render.tsx
@@ -44,7 +44,7 @@ interface MentionProps {
name: string;
}
const Render = memo<MarkdownElementProps<MentionProps>>(({ children, node }) => {
- const { id: mentionId } = node?.properties || {};
+ const { id: mentionId, name } = node?.properties || {};
const { t } = useTranslation('chat');
const currentGroupMembers = useSessionStore(sessionSelectors.currentGroupAgents, isEqual);
@@ -67,7 +67,7 @@ const Render = memo<MarkdownElementProps<MentionProps>>(({ children, node }) =>
return (
<span className={styles.mention}>
{'@'}
- {children || 'unknown'}
+ {name || children || 'unknown'}
</span>
);
}
@@ -95,7 +95,7 @@ const Render = memo<MarkdownElementProps<MentionProps>>(({ children, node }) =>
>
<span className={styles.mention}>
{'@'}
- {member.title || children}
+ {member.title || name || children}
</span>
</Popover>
);