🤯 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): keep 1:1 conversations with a person out of the Channel list (#23687)
Lobehub Coder4c855b0f6757
diff --git a/src/features/Channels/channelScope.test.ts b/src/features/Channels/channelScope.test.tsindex c32acf024bd..28ff960a68e 100644--- a/src/features/Channels/channelScope.test.ts+++ b/src/features/Channels/channelScope.test.ts@@ -10,6 +10,8 @@ const channels = [{ agentId: null, id: 'legacy', projectId: undefined as unknown as null },// A 1:1 conversation with an Agent.{ agentId: 'agt_1', id: 'direct', projectId: null },+ // A 1:1 conversation with another person.+ { agentId: null, id: 'peer', peerUserId: 'user_2', projectId: null },];describe('channelsInScope', () => {@@ -21,6 +23,10 @@ describe('channelsInScope', () => {expect(channelsInScope(channels)?.map((c) => c.id)).toEqual(['standalone', 'legacy']);});+ it('keeps 1:1 conversations with a person out of the list', () => {+ expect(channelsInScope(channels)?.map((c) => c.id)).not.toContain('peer');+ });+it('waits for the list to load', () => {expect(channelsInScope(undefined, 'pro_1')).toBeUndefined();});diff --git a/src/features/Channels/channelScope.ts b/src/features/Channels/channelScope.tsindex 5cef000550c..4afab40e50a 100644--- a/src/features/Channels/channelScope.ts+++ b/src/features/Channels/channelScope.ts@@ -2,14 +2,19 @@ import type { ChannelListItem } from '@lobechat/types';/*** The Channels one sidebar lists: a project's own, or (without a project) those outside every- * project, so each Channel appears in exactly one place. A direct (1:1 Agent) Channel is left- * out: it opens from its Agent's row, not as a group Channel.+ * project, so each Channel appears in exactly one place. A 1:1 conversation is left out, whether+ * with an Agent (it opens from the Agent's row) or with another person: neither is a group+ * Channel.*/-export const channelsInScope = <T extends Pick<ChannelListItem, 'agentId' | 'projectId'>>(+export const channelsInScope = <+ T extends Pick<ChannelListItem, 'agentId' | 'peerUserId' | 'projectId'>,+>(channels: T[] | undefined,projectId?: string,): T[] | undefined =>channels?.filter((channel) =>- !channel.agentId && (projectId ? channel.projectId === projectId : !channel.projectId),+ !channel.agentId &&+ !channel.peerUserId &&+ (projectId ? channel.projectId === projectId : !channel.projectId),);