@lobehub/lobehub 2.1.13 → 2.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/apps/desktop/src/main/menus/impls/linux.ts +1 -1
  3. package/apps/desktop/src/main/menus/impls/macOS.ts +8 -8
  4. package/apps/desktop/src/main/menus/impls/windows.ts +1 -1
  5. package/changelog/v2.json +18 -0
  6. package/docs/development/database-schema.dbml +1 -0
  7. package/locales/en-US/chat.json +2 -0
  8. package/locales/en-US/discover.json +9 -0
  9. package/locales/zh-CN/chat.json +2 -0
  10. package/locales/zh-CN/discover.json +9 -0
  11. package/package.json +1 -1
  12. package/packages/database/migrations/0076_add_message_group_index.sql +1 -0
  13. package/packages/database/migrations/meta/0076_snapshot.json +11270 -0
  14. package/packages/database/migrations/meta/_journal.json +8 -1
  15. package/packages/database/src/schemas/message.ts +1 -0
  16. package/packages/types/src/discover/assistants.ts +1 -0
  17. package/packages/types/src/discover/index.ts +8 -0
  18. package/packages/utils/src/chunkers/trimBatchProbe/trimBatchProbe.ts +1 -1
  19. package/packages/utils/src/pricing.ts +6 -6
  20. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Header/Nav.tsx +1 -2
  21. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Header.tsx +3 -3
  22. package/src/app/[variants]/(main)/community/(detail)/user/features/DetailProvider.tsx +2 -0
  23. package/src/app/[variants]/(main)/community/(detail)/user/features/StatusFilter.tsx +36 -0
  24. package/src/app/[variants]/(main)/community/(detail)/user/features/UserAgentList.tsx +69 -13
  25. package/src/app/[variants]/(main)/community/(detail)/user/features/UserContent.tsx +0 -11
  26. package/src/app/[variants]/(main)/community/(detail)/user/features/UserGroupList.tsx +68 -14
  27. package/src/app/[variants]/(main)/community/(detail)/user/index.tsx +3 -1
  28. package/src/app/[variants]/(main)/community/(list)/agent/features/List/Item.tsx +2 -1
  29. package/src/features/Conversation/Messages/CompressedGroup/index.tsx +26 -6
  30. package/src/features/Conversation/store/slices/message/action/state.ts +25 -0
  31. package/src/locales/default/chat.ts +3 -0
  32. package/src/locales/default/discover.ts +12 -0
  33. package/src/server/routers/lambda/market/social.ts +1 -1
  34. package/src/server/routers/lambda/message.ts +37 -6
  35. package/src/server/services/discover/index.ts +57 -2
  36. package/src/server/services/message/index.ts +19 -0
  37. package/src/services/message/index.ts +14 -0
  38. package/src/services/models.ts +0 -1
  39. package/src/services/social.ts +1 -1
@@ -48,7 +48,32 @@ export const messageRouter = router({
48
48
  return ctx.messageService.addFilesToMessage(id, fileIds, resolved);
49
49
  }),
50
50
 
51
- count: messageProcedure
51
+ /**
52
+ * Cancel compression by deleting the compression group and restoring original messages
53
+ */
54
+ cancelCompression: messageProcedure
55
+ .input(
56
+ z.object({
57
+ agentId: z.string(),
58
+ groupId: z.string().nullable().optional(),
59
+ messageGroupId: z.string(),
60
+ threadId: z.string().nullable().optional(),
61
+ topicId: z.string(),
62
+ }),
63
+ )
64
+ .mutation(async ({ input, ctx }) => {
65
+ const { messageGroupId, agentId, groupId, threadId, topicId } = input;
66
+
67
+ return ctx.messageService.cancelCompression(messageGroupId, {
68
+ agentId,
69
+ groupId,
70
+ threadId,
71
+ topicId,
72
+ });
73
+ }),
74
+
75
+
76
+ count: messageProcedure
52
77
  .input(
53
78
  z
54
79
  .object({
@@ -62,7 +87,9 @@ export const messageRouter = router({
62
87
  return ctx.messageModel.count(input);
63
88
  }),
64
89
 
65
- countWords: messageProcedure
90
+
91
+
92
+ countWords: messageProcedure
66
93
  .input(
67
94
  z
68
95
  .object({
@@ -76,12 +103,13 @@ export const messageRouter = router({
76
103
  return ctx.messageModel.countWords(input);
77
104
  }),
78
105
 
79
- /**
106
+
107
+ /**
80
108
  * Create a compression group for old messages
81
109
  * Creates a placeholder group, marks messages as compressed
82
110
  * Returns messages to summarize for frontend AI generation
83
111
  */
84
- createCompressionGroup: messageProcedure
112
+ createCompressionGroup: messageProcedure
85
113
  .input(
86
114
  z.object({
87
115
  agentId: z.string(),
@@ -102,7 +130,9 @@ export const messageRouter = router({
102
130
  });
103
131
  }),
104
132
 
105
- createMessage: messageProcedure
133
+
134
+
135
+ createMessage: messageProcedure
106
136
  .input(CreateNewMessageParamsSchema)
107
137
  .mutation(async ({ input, ctx }) => {
108
138
  // If there's no agentId but has sessionId, resolve agentId from sessionId
@@ -115,10 +145,11 @@ export const messageRouter = router({
115
145
  return ctx.messageService.createMessage({ ...input, agentId } as any);
116
146
  }),
117
147
 
148
+
118
149
  /**
119
150
  * Finalize compression by updating the group with generated summary
120
151
  */
121
- finalizeCompression: messageProcedure
152
+ finalizeCompression: messageProcedure
122
153
  .input(
123
154
  z.object({
124
155
  agentId: z.string(),
@@ -745,6 +745,7 @@ export class DiscoverService {
745
745
  title: item.name || item.identifier,
746
746
  tokenUsage: item.tokenUsage || 0,
747
747
  type: item.type,
748
+ updatedAt: item.updatedAt,
748
749
  userName: normalizedAuthor.userName,
749
750
  };
750
751
  });
@@ -1710,6 +1711,8 @@ export class DiscoverService {
1710
1711
  locale,
1711
1712
  })) as UserInfoResponse & {
1712
1713
  agentGroups?: any[];
1714
+ favoriteAgentGroups?: any[];
1715
+ favoriteAgents?: any[];
1713
1716
  forkedAgentGroups?: any[];
1714
1717
  forkedAgents?: any[];
1715
1718
  };
@@ -1719,7 +1722,7 @@ export class DiscoverService {
1719
1722
  return undefined;
1720
1723
  }
1721
1724
 
1722
- const { user, agents, agentGroups, forkedAgents, forkedAgentGroups } = response;
1725
+ const { user, agents, agentGroups, forkedAgents, forkedAgentGroups, favoriteAgents, favoriteAgentGroups } = response;
1723
1726
 
1724
1727
  // Transform agents to DiscoverAssistantItem format
1725
1728
  const transformedAgents: DiscoverAssistantItem[] = (agents || []).map((agent: any) => ({
@@ -1811,9 +1814,59 @@ export class DiscoverService {
1811
1814
  updatedAt: group.updatedAt,
1812
1815
  }));
1813
1816
 
1817
+ // Transform favoriteAgents to DiscoverAssistantItem format
1818
+ const transformedFavoriteAgents: DiscoverAssistantItem[] = (favoriteAgents || []).map(
1819
+ (agent: any) => ({
1820
+ author: agent.author || '',
1821
+ avatar: agent.avatar || '',
1822
+ category: agent.category as any,
1823
+ config: {} as any,
1824
+ createdAt: agent.createdAt,
1825
+ description: agent.description || '',
1826
+ forkCount: agent.forkCount || 0,
1827
+ forkedFromAgentId: agent.forkedFromAgentId || null,
1828
+ homepage: `https://lobehub.com/discover/assistant/${agent.identifier}`,
1829
+ identifier: agent.identifier,
1830
+ installCount: agent.installCount,
1831
+ isValidated: agent.isValidated,
1832
+ knowledgeCount: agent.knowledgeCount || 0,
1833
+ pluginCount: agent.pluginCount || 0,
1834
+ schemaVersion: 1,
1835
+ status: agent.status,
1836
+ tags: agent.tags || [],
1837
+ title: agent.name || agent.identifier,
1838
+ tokenUsage: agent.tokenUsage || 0,
1839
+ }),
1840
+ );
1841
+
1842
+ // Transform favoriteAgentGroups to DiscoverGroupAgentItem format
1843
+ const transformedFavoriteAgentGroups = (favoriteAgentGroups || []).map((group: any) => ({
1844
+ author: group.author || '',
1845
+ avatar: group.avatar || '👥',
1846
+ category: group.category as any,
1847
+ createdAt: group.createdAt,
1848
+ description: group.description || '',
1849
+ forkCount: group.forkCount || 0,
1850
+ forkedFromGroupId: group.forkedFromGroupId || null,
1851
+ homepage: `https://lobehub.com/discover/group_agent/${group.identifier}`,
1852
+ identifier: group.identifier,
1853
+ installCount: group.installCount || 0,
1854
+ isFeatured: group.isFeatured || false,
1855
+ isOfficial: group.isOfficial || false,
1856
+ isValidated: group.isValidated,
1857
+ memberCount: 0, // Will be populated from memberAgents in detail view
1858
+ schemaVersion: 1,
1859
+ status: group.status,
1860
+ tags: group.tags || [],
1861
+ title: group.name || group.identifier,
1862
+ updatedAt: group.updatedAt,
1863
+ }));
1864
+
1814
1865
  const result: DiscoverUserProfile = {
1815
1866
  agentGroups: transformedAgentGroups,
1816
1867
  agents: transformedAgents,
1868
+ favoriteAgentGroups: transformedFavoriteAgentGroups,
1869
+ favoriteAgents: transformedFavoriteAgents,
1817
1870
  forkedAgentGroups: transformedForkedAgentGroups,
1818
1871
  forkedAgents: transformedForkedAgents,
1819
1872
  user: {
@@ -1833,11 +1886,13 @@ export class DiscoverService {
1833
1886
  };
1834
1887
 
1835
1888
  log(
1836
- 'getUserInfo: returning user profile with %d agents, %d groups, %d forked agents, %d forked groups',
1889
+ 'getUserInfo: returning user profile with %d agents, %d groups, %d forked agents, %d forked groups, %d favorite agents, %d favorite groups',
1837
1890
  result.agents.length,
1838
1891
  result.agentGroups?.length || 0,
1839
1892
  result.forkedAgents?.length || 0,
1840
1893
  result.forkedAgentGroups?.length || 0,
1894
+ result.favoriteAgents?.length || 0,
1895
+ result.favoriteAgentGroups?.length || 0,
1841
1896
  );
1842
1897
  return result;
1843
1898
  } catch (error) {
@@ -359,4 +359,23 @@ export class MessageService {
359
359
 
360
360
  return { messages };
361
361
  }
362
+
363
+ /**
364
+ * Cancel compression by deleting the compression group and restoring original messages
365
+ *
366
+ * @param messageGroupId - The compression group ID to cancel
367
+ * @param context - Query options for returning updated messages
368
+ */
369
+ async cancelCompression(
370
+ messageGroupId: string,
371
+ context: QueryOptions,
372
+ ): Promise<{ messages: UIChatMessage[]; success: boolean }> {
373
+ // Delete compression group (this also unmarks messages)
374
+ await this.compressionRepository.deleteCompressionGroup(messageGroupId);
375
+
376
+ // Query updated messages
377
+ const messages = await this.messageModel.query(context, this.getQueryOptions());
378
+
379
+ return { messages, success: true };
380
+ }
362
381
  }
@@ -276,6 +276,20 @@ export class MessageService {
276
276
  messages: (result.messages || []) as unknown as UIChatMessage[],
277
277
  };
278
278
  };
279
+
280
+ /**
281
+ * Cancel compression by deleting the compression group and restoring original messages
282
+ */
283
+ cancelCompression = async (params: {
284
+ agentId: string;
285
+ groupId?: string | null;
286
+ messageGroupId: string;
287
+ threadId?: string | null;
288
+ topicId: string;
289
+ }): Promise<{ messages: UIChatMessage[] }> => {
290
+ const result = await lambdaClient.message.cancelCompression.mutate(params);
291
+ return { messages: (result.messages || []) as unknown as UIChatMessage[] };
292
+ };
279
293
  }
280
294
 
281
295
  export const messageService = new MessageService();
@@ -75,7 +75,6 @@ export class ModelsService {
75
75
  const runtimeProvider = resolveRuntimeProvider(provider);
76
76
  const enableFetchOnClient = isEnableFetchOnClient(provider);
77
77
 
78
- console.log('enableFetchOnClient:', enableFetchOnClient);
79
78
  let res: Response;
80
79
  if (enableFetchOnClient) {
81
80
  const agentRuntime = await initializeWithClientStore({
@@ -1,6 +1,6 @@
1
1
  import { lambdaClient } from '@/libs/trpc/client';
2
2
 
3
- export type SocialTargetType = 'agent' | 'plugin';
3
+ export type SocialTargetType = 'agent' | 'plugin' | 'agent-group';
4
4
 
5
5
  export interface FollowStatus {
6
6
  isFollowing: boolean;