@lobehub/lobehub 2.0.0-next.296 → 2.0.0-next.297

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 (48) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/changelog/v1.json +9 -0
  3. package/package.json +2 -2
  4. package/packages/types/package.json +1 -1
  5. package/packages/types/src/discover/assistants.ts +4 -0
  6. package/packages/types/src/discover/groupAgents.ts +196 -0
  7. package/packages/types/src/discover/index.ts +5 -1
  8. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/DetailProvider.tsx +19 -0
  9. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Details/Members/index.tsx +137 -0
  10. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Details/Nav.tsx +88 -0
  11. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Details/Overview/index.tsx +213 -0
  12. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Details/Related/index.tsx +85 -0
  13. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Details/SystemRole/TagList.tsx +20 -0
  14. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Details/SystemRole/index.tsx +71 -0
  15. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Details/Versions/index.tsx +119 -0
  16. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Details/index.tsx +51 -0
  17. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Header.tsx +253 -0
  18. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Sidebar/ActionButton/AddGroupAgent.tsx +222 -0
  19. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Sidebar/ActionButton/index.tsx +34 -0
  20. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Sidebar/Summary/index.tsx +42 -0
  21. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Sidebar/index.tsx +41 -0
  22. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/StatusPage/index.tsx +104 -0
  23. package/src/app/[variants]/(main)/community/(detail)/group_agent/index.tsx +103 -0
  24. package/src/app/[variants]/(main)/community/(detail)/group_agent/loading.tsx +1 -0
  25. package/src/app/[variants]/(main)/community/(detail)/user/features/DetailProvider.tsx +7 -1
  26. package/src/app/[variants]/(main)/community/(detail)/user/features/UserContent.tsx +2 -0
  27. package/src/app/[variants]/(main)/community/(detail)/user/features/UserGroupCard.tsx +186 -0
  28. package/src/app/[variants]/(main)/community/(detail)/user/features/UserGroupList.tsx +59 -0
  29. package/src/app/[variants]/(main)/community/(detail)/user/index.tsx +3 -1
  30. package/src/app/[variants]/(main)/community/(list)/assistant/features/List/Item.tsx +26 -8
  31. package/src/app/[variants]/(main)/community/(list)/assistant/index.tsx +1 -0
  32. package/src/app/[variants]/(main)/group/profile/features/GroupProfile/index.tsx +2 -0
  33. package/src/app/[variants]/(main)/group/profile/features/Header/AgentPublishButton/PublishResultModal.tsx +2 -1
  34. package/src/app/[variants]/(main)/group/profile/features/Header/GroupPublishButton/GroupForkConfirmModal.tsx +60 -0
  35. package/src/app/[variants]/(main)/group/profile/features/Header/GroupPublishButton/GroupPublishResultModal.tsx +62 -0
  36. package/src/app/[variants]/(main)/group/profile/features/Header/GroupPublishButton/PublishButton.tsx +122 -0
  37. package/src/app/[variants]/(main)/group/profile/features/Header/GroupPublishButton/index.tsx +46 -0
  38. package/src/app/[variants]/(main)/group/profile/features/Header/GroupPublishButton/types.ts +12 -0
  39. package/src/app/[variants]/(main)/group/profile/features/Header/GroupPublishButton/useMarketGroupPublish.ts +211 -0
  40. package/src/app/[variants]/(main)/group/profile/features/Header/GroupPublishButton/utils.ts +22 -0
  41. package/src/app/[variants]/router/desktopRouter.config.tsx +7 -0
  42. package/src/locales/default/setting.ts +12 -0
  43. package/src/server/routers/lambda/market/agentGroup.ts +296 -0
  44. package/src/server/routers/lambda/market/index.ts +134 -4
  45. package/src/server/services/discover/index.ts +123 -7
  46. package/src/services/discover.ts +55 -0
  47. package/src/store/discover/slices/groupAgent/action.ts +80 -0
  48. package/src/store/discover/store.ts +3 -0
@@ -20,6 +20,7 @@ import {
20
20
  type DiscoverPluginDetail,
21
21
  type DiscoverProviderDetail,
22
22
  type DiscoverUserProfile,
23
+ type GroupAgentQueryParams,
23
24
  type IdentifiersResponse,
24
25
  type McpListResponse,
25
26
  type McpQueryParams,
@@ -448,6 +449,60 @@ class DiscoverService {
448
449
  }
449
450
  return null;
450
451
  }
452
+
453
+ // ============================== Group Agent Market ==============================
454
+
455
+ getGroupAgentCategories = async (params: CategoryListQuery = {}): Promise<CategoryItem[]> => {
456
+ const locale = globalHelpers.getCurrentLanguage();
457
+ return lambdaClient.market.getGroupAgentCategories.query({
458
+ ...params,
459
+ locale,
460
+ });
461
+ };
462
+
463
+ getGroupAgentDetail = async (params: {
464
+ identifier: string;
465
+ locale?: string;
466
+ version?: string;
467
+ }): Promise<any> => {
468
+ const locale = globalHelpers.getCurrentLanguage();
469
+ return lambdaClient.market.getGroupAgentDetail.query({
470
+ identifier: params.identifier,
471
+ locale,
472
+ version: params.version,
473
+ });
474
+ };
475
+
476
+ getGroupAgentIdentifiers = async (): Promise<IdentifiersResponse> => {
477
+ return lambdaClient.market.getGroupAgentIdentifiers.query();
478
+ };
479
+
480
+ getGroupAgentList = async (
481
+ params: GroupAgentQueryParams = {},
482
+ ): Promise<any> => {
483
+ const locale = globalHelpers.getCurrentLanguage();
484
+ return lambdaClient.market.getGroupAgentList.query(
485
+ {
486
+ ...params,
487
+ locale,
488
+ page: params.page ? Number(params.page) : 1,
489
+ pageSize: params.pageSize ? Number(params.pageSize) : 20,
490
+ },
491
+ { context: { showNotification: false } },
492
+ );
493
+ };
494
+
495
+ reportGroupAgentEvent = async (params: {
496
+ event: 'add' | 'chat' | 'click';
497
+ identifier: string;
498
+ source?: string;
499
+ }): Promise<void> => {
500
+ await lambdaClient.market.reportGroupAgentEvent.mutate(params);
501
+ };
502
+
503
+ reportGroupAgentInstall = async (identifier: string): Promise<void> => {
504
+ await lambdaClient.market.reportGroupAgentInstall.mutate({ identifier });
505
+ };
451
506
  }
452
507
 
453
508
  export const discoverService = new DiscoverService();
@@ -0,0 +1,80 @@
1
+ import { type CategoryItem, type CategoryListQuery } from '@lobehub/market-sdk';
2
+ import useSWR, { type SWRResponse } from 'swr';
3
+ import type { StateCreator } from 'zustand/vanilla';
4
+
5
+ import { discoverService } from '@/services/discover';
6
+ import { type DiscoverStore } from '@/store/discover';
7
+ import { globalHelpers } from '@/store/global/helpers';
8
+ import {
9
+ type DiscoverGroupAgentDetail,
10
+ type GroupAgentListResponse,
11
+ type GroupAgentQueryParams,
12
+ type IdentifiersResponse,
13
+ } from '@/types/discover';
14
+
15
+ export interface GroupAgentAction {
16
+ useGroupAgentCategories: (params?: CategoryListQuery) => SWRResponse<CategoryItem[]>;
17
+ useGroupAgentDetail: (params: {
18
+ identifier: string;
19
+ version?: string;
20
+ }) => SWRResponse<DiscoverGroupAgentDetail | undefined>;
21
+ useGroupAgentIdentifiers: () => SWRResponse<IdentifiersResponse>;
22
+ useGroupAgentList: (params?: GroupAgentQueryParams) => SWRResponse<GroupAgentListResponse>;
23
+ }
24
+
25
+ export const createGroupAgentSlice: StateCreator<
26
+ DiscoverStore,
27
+ [['zustand/devtools', never]],
28
+ [],
29
+ GroupAgentAction
30
+ > = () => ({
31
+ useGroupAgentCategories: (params = {}) => {
32
+ const locale = globalHelpers.getCurrentLanguage();
33
+ return useSWR(
34
+ ['group-agent-categories', locale, ...Object.values(params)].filter(Boolean).join('-'),
35
+ async () => discoverService.getGroupAgentCategories(params),
36
+ {
37
+ revalidateOnFocus: false,
38
+ },
39
+ );
40
+ },
41
+
42
+ useGroupAgentDetail: (params) => {
43
+ const locale = globalHelpers.getCurrentLanguage();
44
+ return useSWR(
45
+ ['group-agent-details', locale, params.identifier, params.version]
46
+ .filter(Boolean)
47
+ .join('-'),
48
+ async () => discoverService.getGroupAgentDetail(params),
49
+ {
50
+ revalidateOnFocus: false,
51
+ },
52
+ );
53
+ },
54
+
55
+ useGroupAgentIdentifiers: () => {
56
+ return useSWR(
57
+ 'group-agent-identifiers',
58
+ async () => discoverService.getGroupAgentIdentifiers(),
59
+ {
60
+ revalidateOnFocus: false,
61
+ },
62
+ );
63
+ },
64
+
65
+ useGroupAgentList: (params = {}) => {
66
+ const locale = globalHelpers.getCurrentLanguage();
67
+ return useSWR(
68
+ ['group-agent-list', locale, ...Object.values(params)].filter(Boolean).join('-'),
69
+ async () =>
70
+ discoverService.getGroupAgentList({
71
+ ...params,
72
+ page: params.page ? Number(params.page) : 1,
73
+ pageSize: params.pageSize ? Number(params.pageSize) : 20,
74
+ }),
75
+ {
76
+ revalidateOnFocus: false,
77
+ },
78
+ );
79
+ },
80
+ });
@@ -4,6 +4,7 @@ import { type StateCreator } from 'zustand/vanilla';
4
4
 
5
5
  import { createDevtools } from '../middleware/createDevtools';
6
6
  import { type AssistantAction, createAssistantSlice } from './slices/assistant/action';
7
+ import { type GroupAgentAction, createGroupAgentSlice } from './slices/groupAgent/action';
7
8
  import { type MCPAction, createMCPSlice } from './slices/mcp';
8
9
  import { type ModelAction, createModelSlice } from './slices/model/action';
9
10
  import { type PluginAction, createPluginSlice } from './slices/plugin/action';
@@ -15,6 +16,7 @@ import { type UserAction, createUserSlice } from './slices/user';
15
16
 
16
17
  export type DiscoverStore = MCPAction &
17
18
  AssistantAction &
19
+ GroupAgentAction &
18
20
  ProviderAction &
19
21
  ModelAction &
20
22
  PluginAction &
@@ -26,6 +28,7 @@ const createStore: StateCreator<DiscoverStore, [['zustand/devtools', never]]> =
26
28
  ) => ({
27
29
  ...createMCPSlice(...parameters),
28
30
  ...createAssistantSlice(...parameters),
31
+ ...createGroupAgentSlice(...parameters),
29
32
  ...createProviderSlice(...parameters),
30
33
  ...createModelSlice(...parameters),
31
34
  ...createPluginSlice(...parameters),