🤯 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(contact): name an Agent's card by its personal name, as every list does (#23569)
Arvin Xu8a4ce321384c
diff --git a/packages/database/src/models/__tests__/contact.test.ts b/packages/database/src/models/__tests__/contact.test.tsindex cc4d27d47ad..cdd58bbb4e5 100644--- a/packages/database/src/models/__tests__/contact.test.ts+++ b/packages/database/src/models/__tests__/contact.test.ts@@ -660,6 +660,14 @@ describe('contact cards', () => {});});+ it('names an Agent by its personal name, as every list does, over its role title', async () => {+ await serverDB.update(agents).set({ name: '晚诺' }).where(eq(agents.id, bobAgent));++ expect(await aliceModel.resolveCard({ agentId: bobAgent, type: 'agent' })).toMatchObject({+ name: '晚诺',+ });+ });+it('asks the owner to turn sharing on instead of opening it', async () => {await serverDB.update(agentShares)diff --git a/packages/database/src/models/contact.ts b/packages/database/src/models/contact.tsindex 6e3e56fbde1..8daee19fac8 100644--- a/packages/database/src/models/contact.ts+++ b/packages/database/src/models/contact.ts@@ -12,7 +12,7 @@ import type {ContactUserProfile,ContactWorkspace,} from '@lobechat/types';-import { channelMessageDeletedAt, contactCardOf } from '@lobechat/types';+import { agentDisplayName, channelMessageDeletedAt, contactCardOf } from '@lobechat/types';import { TRPCError } from '@trpc/server';import type { SQLWrapper } from 'drizzle-orm';import { and, desc, eq, exists, inArray, isNotNull, isNull, not, or, sql } from 'drizzle-orm';@@ -64,6 +64,7 @@ const agentProfileColumns = {agentBackgroundColor: agents.backgroundColor,agentDescription: agents.description,agentId: agents.id,+ agentName: agents.name,agentSlug: agents.slug,agentTitle: agents.title,isDeleted: agents.isDeleted,@@ -81,6 +82,7 @@ type AgentProfileRow = {agentBackgroundColor: string | null;agentDescription: string | null;agentId: string;+ agentName: string | null;agentSlug: string | null;agentTitle: string | null;ownerAvatar: string | null;@@ -96,6 +98,7 @@ const toAgentProfile = (row: AgentProfileRow): ContactAgentProfile => ({avatar: normalizeInboxAgentAvatar(row.agentAvatar, { slug: row.agentSlug }) ?? null,backgroundColor: row.agentBackgroundColor,description: row.agentDescription,+ name: row.agentName?.trim() || null,owner: {avatar: row.ownerAvatar,fullName: row.ownerFullName,@@ -896,7 +899,8 @@ export class ContactModel {agentId: profile.agentId,avatar: profile.avatar,backgroundColor: profile.backgroundColor,- name: profile.title,+ // The name every list shows: the personal name, else the role title.+ name: agentDisplayName(profile) ?? null,ownerName: profile.owner.fullName || profile.owner.username,shareId: profile.shareId,type: 'agent',diff --git a/packages/types/src/contact.ts b/packages/types/src/contact.tsindex 6ec4230ee7e..586b970c366 100644--- a/packages/types/src/contact.ts+++ b/packages/types/src/contact.ts@@ -24,6 +24,8 @@ export interface ContactAgentProfile {avatar: string | null;backgroundColor: string | null;description: string | null;+ /** Personal name; the label is `agentDisplayName` of it and `title`. */+ name: string | null;owner: ContactUserProfile;/** Share id; the visitor page and every run authorize against it. */shareId: string;