🤯 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(trash): show a deleted agent under its name, not Untitled (#21797)
Lobehub Codere34b0683630e
diff --git a/apps/server/src/services/trash/__tests__/index.test.ts b/apps/server/src/services/trash/__tests__/index.test.tsindex ed418b6cf05..d6972dd951b 100644--- a/apps/server/src/services/trash/__tests__/index.test.ts+++ b/apps/server/src/services/trash/__tests__/index.test.ts@@ -169,6 +169,16 @@ describe('TrashService', () => {});describe('agents', () => {+ it('labels the entry with the agent name the sidebar shows, falling back to its title', async () => {+ const nameOnly = await agentModel.create({ name: 'Alice' });+ const named = await agentModel.create({ name: 'Bob', title: 'Health Assistant' });+ const unnamed = await agentModel.create({ title: 'Bot' });++ expect((await service.trashAgent(nameOnly.id))?.title).toBe('Alice');+ expect((await service.trashAgent(named.id))?.title).toBe('Bob');+ expect((await service.trashAgent(unnamed.id))?.title).toBe('Bot');+ });+it('cascades to topics (incl. legacy session-scoped ones), hides the session shell, and restores the whole unit', async () => {const session = await sessionModel.create({ config: { title: 'Legacy' }, type: 'agent' });const agent = (await sessionModel.findByIdOrSlug(session.id))!.agent;diff --git a/apps/server/src/services/trash/handlers/agent.ts b/apps/server/src/services/trash/handlers/agent.tsindex 988e901256d..b0983b78c98 100644--- a/apps/server/src/services/trash/handlers/agent.ts+++ b/apps/server/src/services/trash/handlers/agent.ts@@ -1,3 +1,5 @@+import { agentDisplayName } from '@lobechat/types';+import { AgentModel } from '@/database/models/agent';import { MessageModel } from '@/database/models/message';import { ResourcePermissionModel } from '@/database/models/resourcePermission';@@ -26,7 +28,9 @@ export const agentEntry = (agent: AgentItem, childCount: number) => ({projectId: null,resourceId: agent.id,resourceType: 'agent' as const,- title: agent.title,+ // Label the entry the way the sidebar does: `name` first, `title` (the+ // agent's role) only when it has no name.+ title: agentDisplayName(agent) ?? null,});/**