🤯 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): show the agent's name, not its title, on the IM bot page (#21674)
Arvin Xu24c532c67c12
diff --git a/src/features/AgentChannel/PlatformDetail/index.tsx b/src/features/AgentChannel/PlatformDetail/index.tsxindex f295626ced3..209e81c4ce8 100644--- a/src/features/AgentChannel/PlatformDetail/index.tsx+++ b/src/features/AgentChannel/PlatformDetail/index.tsx@@ -1,5 +1,6 @@'use client';+import { agentDisplayName } from '@lobechat/types';import {ActionIcon,Alert,@@ -185,7 +186,10 @@ const PlatformDetail = memo<PlatformDetailProps>(({ platformDef, agentId, currentConfig, disabled }) => {const { t } = useTranslation('agent');const navigate = useWorkspaceAwareNavigate();- const agentName = useAgentStore((s) => agentSelectors.getAgentMetaById(agentId)(s).title);+ // The name the agent is addressed by; its title is the role, used only when it has no name.+ const agentName = useAgentStore((s) =>+ agentDisplayName(agentSelectors.getAgentMetaById(agentId)(s)),+ );const agentAvatar = useAgentStore((s) => agentSelectors.getAgentMetaById(agentId)(s).avatar);const agentBackground = useAgentStore((s) => agentSelectors.getAgentMetaById(agentId)(s).backgroundColor,diff --git a/src/routes/(main)/agent/channel/permission.test.tsx b/src/routes/(main)/agent/channel/permission.test.tsxindex da95368cd08..0f74f8217b9 100644--- a/src/routes/(main)/agent/channel/permission.test.tsx+++ b/src/routes/(main)/agent/channel/permission.test.tsx@@ -85,7 +85,12 @@ vi.mock('@/store/agent', () => ({useAgentStore: (selector: (state: Record<string, unknown>) => unknown) =>selector({// The channel form names quick-created bot apps after the agent.- agentMap: {},+ agentMap: {+ // A name (who the agent is) and a title (the role it plays) that differ.+ 'agent-id': { name: 'Shadow Arvin', title: 'Simulated teammate' },+ },+ // The agent meta selector looks up the built-in agents for a default avatar.+ builtinAgentIdMap: {},connectBot: vi.fn(),createBotProvider: vi.fn(),deleteAllBotProviders: vi.fn(),@@ -313,6 +318,18 @@ describe('Agent channel permission gates', () => {expect(screen.getByRole('button', { name: 'channel.save' })).toBeDisabled();});+ it("speaks as the agent's name, not its role title", async () => {+ render(+ <PlatformDetail agentId="agent-id" currentConfig={currentConfig} platformDef={platformDef} />,+ );++ // The test window is narrow, so the preview opens from its button.+ fireEvent.click(await screen.findByRole('button', { name: 'channel.quickView.open' }));+ // The quick view's bot speaks under the name.+ await waitFor(() => expect(screen.getAllByText('Shadow Arvin').length).toBeGreaterThan(0));+ expect(screen.queryByText('Simulated teammate')).not.toBeInTheDocument();+ });+it('discards form edits and restores the persisted configuration', async () => {render(<PlatformDetail agentId="agent-id" currentConfig={currentConfig} platformDef={platformDef} />,