🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
💄 fix(channel): thread card shows the Agent's own avatar and fills only on hover (#22925)
Lobehub Codereb411101213a
diff --git a/src/features/Channels/ChannelMessage.test.tsx b/src/features/Channels/ChannelMessage.test.tsxindex dd01fa58b64..390c71bb995 100644--- a/src/features/Channels/ChannelMessage.test.tsx+++ b/src/features/Channels/ChannelMessage.test.tsx@@ -53,6 +53,14 @@ vi.mock('@/features/AgentProfileCard/AgentProfilePopup', () => ({children,),}));+vi.mock('@/components/AgentAvatar', () => ({+ default: ({ agentId, size }: { agentId?: string; size?: number }) =>+ createElement('span', {+ 'data-agent-id': agentId,+ 'data-size': size,+ 'data-testid': 'agent-avatar',+ }),+}));vi.mock('@lobehub/ui', async (importOriginal) => ({...(await importOriginal<Record<string, unknown>>()),DropdownMenu: ({ items }: { items: { key: string; label: string; onClick: () => void }[] }) =>@@ -276,6 +284,11 @@ describe('ChannelMessage thread card', () => {expect(card.querySelector('.lucide-git-branch')).toBeNull();expect(screen.getByText('Nasa')).toBeTruthy();expect(screen.getByText('PR is up')).toBeTruthy();+ // An Agent without an avatar of its own shows the character generated from its id, as the+ // thread does, not the generic fallback.+ expect(+ replyRow.querySelector('[data-testid="agent-avatar"]')?.getAttribute('data-agent-id'),+ ).toBe('agt_1');fireEvent.click(screen.getByRole('button', { name: /Topic header is unclickable/ }));expect(onOpenThread).toHaveBeenCalledWith('cht_1');diff --git a/src/features/Channels/ThreadPreviewCard.tsx b/src/features/Channels/ThreadPreviewCard.tsxindex 84cbd5f1339..ccc1e0efbd9 100644--- a/src/features/Channels/ThreadPreviewCard.tsx+++ b/src/features/Channels/ThreadPreviewCard.tsx@@ -7,6 +7,7 @@ import relativeTime from 'dayjs/plugin/relativeTime';import { ChevronRight, CornerDownRight } from 'lucide-react';import { useTranslation } from 'react-i18next';+import AgentAvatar from '@/components/AgentAvatar';import UserAvatar from '@/features/User/UserAvatar';import { useUserStore } from '@/store/user';import { userProfileSelectors } from '@/store/user/selectors';@@ -31,14 +32,15 @@ const styles = stylex.create({marginInline: 0,paddingBlock: 6,paddingInline: 10,- // A quiet fill instead of a bordered box: the card follows the message, it is not a new one.+ // No box at rest: the card follows the message, it is not a new one. The fill only answers+ // the pointer, to show the row opens the thread.borderWidth: 0,borderStyle: 'none',borderRadius: cssVar.borderRadius,font: 'inherit',textAlign: 'start',backgroundColor: {- 'default': cssVar.colorFillQuaternary,+ 'default': 'transparent',':hover': cssVar.colorFillTertiary,},cursor: 'pointer',@@ -140,6 +142,16 @@ export const ThreadPreviewCard = ({<span {...stylex.props(styles.row, styles.replyRow)}>{isOwnReply ? (<UserAvatar shape="circle" size={16} />+ ) : lastReply.author.type === 'agent' ? (+ // The timeline's Agent avatar: without an image of its own it draws the character+ // generated from the Agent id, so the card shows the face the thread shows.+ <AgentAvatar+ agentId={lastReply.author.id}+ avatar={lastReply.author.avatar}+ name={lastReply.author.name}+ shape="circle"+ size={16}+ />) : (<Avataravatar={authorAvatar(lastReply.author)}