@lobehub/lobehub 2.0.0-next.187 → 2.0.0-next.189

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 (177) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/changelog/v1.json +18 -0
  3. package/e2e/CLAUDE.md +109 -2
  4. package/e2e/docs/llm-mock.md +68 -0
  5. package/e2e/docs/local-setup.md +354 -0
  6. package/e2e/docs/testing-tips.md +94 -0
  7. package/e2e/src/features/journeys/agent/agent-conversation.feature +0 -32
  8. package/e2e/src/mocks/llm/index.ts +6 -6
  9. package/e2e/src/steps/agent/conversation.steps.ts +3 -471
  10. package/locales/ar/models.json +89 -5
  11. package/locales/ar/plugin.json +5 -0
  12. package/locales/ar/providers.json +1 -0
  13. package/locales/bg-BG/models.json +68 -0
  14. package/locales/bg-BG/plugin.json +5 -0
  15. package/locales/bg-BG/providers.json +1 -0
  16. package/locales/de-DE/models.json +85 -0
  17. package/locales/de-DE/plugin.json +5 -0
  18. package/locales/de-DE/providers.json +1 -0
  19. package/locales/en-US/models.json +11 -10
  20. package/locales/en-US/plugin.json +5 -0
  21. package/locales/en-US/providers.json +1 -0
  22. package/locales/es-ES/models.json +72 -0
  23. package/locales/es-ES/plugin.json +5 -0
  24. package/locales/es-ES/providers.json +1 -0
  25. package/locales/fa-IR/models.json +86 -0
  26. package/locales/fa-IR/plugin.json +5 -0
  27. package/locales/fa-IR/providers.json +1 -0
  28. package/locales/fr-FR/models.json +49 -0
  29. package/locales/fr-FR/plugin.json +5 -0
  30. package/locales/fr-FR/providers.json +1 -0
  31. package/locales/it-IT/models.json +82 -0
  32. package/locales/it-IT/plugin.json +5 -0
  33. package/locales/it-IT/providers.json +1 -0
  34. package/locales/ja-JP/models.json +42 -5
  35. package/locales/ja-JP/plugin.json +5 -0
  36. package/locales/ja-JP/providers.json +1 -0
  37. package/locales/ko-KR/models.json +54 -0
  38. package/locales/ko-KR/plugin.json +5 -0
  39. package/locales/ko-KR/providers.json +1 -0
  40. package/locales/nl-NL/models.json +12 -1
  41. package/locales/nl-NL/plugin.json +5 -0
  42. package/locales/nl-NL/providers.json +1 -0
  43. package/locales/pl-PL/models.json +46 -0
  44. package/locales/pl-PL/plugin.json +5 -0
  45. package/locales/pl-PL/providers.json +1 -0
  46. package/locales/pt-BR/models.json +59 -0
  47. package/locales/pt-BR/plugin.json +5 -0
  48. package/locales/pt-BR/providers.json +1 -0
  49. package/locales/ru-RU/models.json +85 -0
  50. package/locales/ru-RU/plugin.json +5 -0
  51. package/locales/ru-RU/providers.json +1 -0
  52. package/locales/tr-TR/models.json +81 -0
  53. package/locales/tr-TR/plugin.json +5 -0
  54. package/locales/tr-TR/providers.json +1 -0
  55. package/locales/vi-VN/models.json +54 -0
  56. package/locales/vi-VN/plugin.json +5 -0
  57. package/locales/vi-VN/providers.json +1 -0
  58. package/locales/zh-CN/models.json +42 -5
  59. package/locales/zh-CN/plugin.json +5 -0
  60. package/locales/zh-CN/providers.json +1 -0
  61. package/locales/zh-TW/models.json +85 -0
  62. package/locales/zh-TW/plugin.json +5 -0
  63. package/locales/zh-TW/providers.json +1 -0
  64. package/package.json +2 -2
  65. package/packages/builtin-tool-gtd/src/manifest.ts +13 -8
  66. package/packages/builtin-tool-gtd/src/systemRole.ts +54 -19
  67. package/packages/builtin-tool-knowledge-base/package.json +1 -0
  68. package/packages/builtin-tool-knowledge-base/src/client/Inspector/ReadKnowledge/index.tsx +97 -0
  69. package/packages/builtin-tool-knowledge-base/src/client/Inspector/SearchKnowledgeBase/index.tsx +75 -0
  70. package/packages/builtin-tool-knowledge-base/src/client/Inspector/index.ts +11 -0
  71. package/packages/builtin-tool-knowledge-base/src/client/Render/ReadKnowledge/FileCard.tsx +12 -12
  72. package/packages/builtin-tool-knowledge-base/src/client/Render/ReadKnowledge/index.tsx +16 -25
  73. package/packages/builtin-tool-knowledge-base/src/client/Render/SearchKnowledgeBase/Item/index.tsx +21 -47
  74. package/packages/builtin-tool-knowledge-base/src/client/Render/SearchKnowledgeBase/index.tsx +19 -31
  75. package/packages/builtin-tool-knowledge-base/src/client/Render/index.ts +0 -5
  76. package/packages/builtin-tool-knowledge-base/src/client/index.ts +5 -1
  77. package/packages/builtin-tool-knowledge-base/src/executor/index.ts +119 -0
  78. package/packages/builtin-tool-local-system/package.json +1 -0
  79. package/packages/builtin-tool-local-system/src/client/Inspector/EditLocalFile/index.tsx +44 -29
  80. package/packages/builtin-tool-local-system/src/client/Inspector/GrepContent/index.tsx +20 -18
  81. package/packages/builtin-tool-local-system/src/client/Inspector/ListLocalFiles/index.tsx +76 -0
  82. package/packages/builtin-tool-local-system/src/client/Inspector/ReadLocalFile/index.tsx +8 -32
  83. package/packages/builtin-tool-local-system/src/client/Inspector/RenameLocalFile/index.tsx +62 -0
  84. package/packages/builtin-tool-local-system/src/client/Inspector/SearchLocalFiles/index.tsx +17 -11
  85. package/packages/builtin-tool-local-system/src/client/Inspector/WriteLocalFile/index.tsx +61 -0
  86. package/packages/builtin-tool-local-system/src/client/Inspector/index.ts +6 -0
  87. package/packages/builtin-tool-local-system/src/client/Render/EditLocalFile/index.tsx +6 -1
  88. package/packages/builtin-tool-local-system/src/client/Render/SearchFiles/SearchQuery/SearchView.tsx +19 -31
  89. package/packages/builtin-tool-local-system/src/client/Render/SearchFiles/SearchQuery/index.tsx +2 -42
  90. package/packages/builtin-tool-local-system/src/client/Render/index.ts +0 -2
  91. package/packages/builtin-tool-local-system/src/client/components/FilePathDisplay.tsx +56 -0
  92. package/packages/builtin-tool-local-system/src/client/components/index.ts +2 -0
  93. package/packages/builtin-tool-local-system/src/executor/index.ts +435 -0
  94. package/packages/builtin-tool-web-browsing/src/client/Inspector/Search/index.tsx +32 -5
  95. package/packages/model-runtime/src/core/contextBuilders/google.test.ts +84 -0
  96. package/packages/model-runtime/src/core/contextBuilders/google.ts +37 -1
  97. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/List/Item/Actions.tsx +4 -13
  98. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/List/Item/index.tsx +23 -29
  99. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/List/Item/useDropdownMenu.tsx +3 -3
  100. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/Actions.tsx +4 -13
  101. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/index.tsx +10 -18
  102. package/src/app/[variants]/(main)/chat/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/useDropdownMenu.tsx +3 -3
  103. package/src/app/[variants]/(main)/community/(detail)/assistant/features/Sidebar/ActionButton/AddAgent.tsx +47 -27
  104. package/src/app/[variants]/(main)/community/(detail)/user/features/UserAgentCard.tsx +4 -3
  105. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/List/Item/Actions.tsx +4 -13
  106. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/List/Item/index.tsx +23 -29
  107. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/List/Item/useDropdownMenu.tsx +3 -3
  108. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/Actions.tsx +4 -13
  109. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/index.tsx +10 -18
  110. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/useDropdownMenu.tsx +3 -3
  111. package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/TopicSelector.tsx +18 -20
  112. package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/AgentGroupItem/index.tsx +19 -25
  113. package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/AgentItem/index.tsx +21 -26
  114. package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/Item/Actions.tsx +4 -13
  115. package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/Item/useDropdownMenu.tsx +3 -3
  116. package/src/app/[variants]/(main)/home/_layout/Body/Project/List/Actions.tsx +4 -13
  117. package/src/app/[variants]/(main)/home/_layout/Body/Project/List/Item.tsx +8 -15
  118. package/src/app/[variants]/(main)/home/_layout/Body/Project/List/useDropdownMenu.tsx +3 -3
  119. package/src/app/[variants]/(main)/home/_layout/Header/components/AddButton.tsx +3 -4
  120. package/src/app/[variants]/(main)/page/_layout/Body/List/Item/Actions.tsx +4 -13
  121. package/src/app/[variants]/(main)/page/_layout/Body/List/Item/index.tsx +13 -20
  122. package/src/app/[variants]/(main)/page/_layout/Body/List/Item/useDropdownMenu.tsx +3 -3
  123. package/src/app/[variants]/(main)/resource/(home)/_layout/Body/LibraryList/List/Item/Actions.tsx +4 -13
  124. package/src/app/[variants]/(main)/resource/(home)/_layout/Body/LibraryList/List/Item/index.tsx +16 -23
  125. package/src/app/[variants]/(main)/resource/(home)/_layout/Body/LibraryList/List/Item/useDropdownMenu.tsx +3 -3
  126. package/src/app/[variants]/(main)/resource/library/_layout/Header/LibraryHead.tsx +4 -6
  127. package/src/features/AgentBuilder/TopicSelector.tsx +18 -17
  128. package/src/features/Conversation/ChatItem/style.ts +7 -0
  129. package/src/features/Conversation/Messages/Assistant/Actions/Error.tsx +1 -3
  130. package/src/features/Conversation/Messages/Assistant/Actions/index.tsx +37 -16
  131. package/src/features/Conversation/Messages/AssistantGroup/Actions/index.tsx +36 -17
  132. package/src/features/Conversation/Messages/Supervisor/Actions/index.tsx +36 -17
  133. package/src/features/Conversation/Messages/Task/Actions/Error.tsx +1 -3
  134. package/src/features/Conversation/Messages/Task/Actions/index.tsx +31 -15
  135. package/src/features/Conversation/Messages/User/Actions/index.tsx +1 -1
  136. package/src/features/Conversation/Messages/index.tsx +8 -59
  137. package/src/features/Conversation/components/ShareMessageModal/index.tsx +1 -1
  138. package/src/features/Conversation/hooks/useChatItemContextMenu.tsx +313 -83
  139. package/src/features/NavPanel/components/NavItem.tsx +33 -3
  140. package/src/features/PageEditor/Copilot/TopicSelector/Actions.tsx +6 -14
  141. package/src/features/PageEditor/Copilot/TopicSelector/TopicItem.tsx +1 -0
  142. package/src/features/PageEditor/Copilot/TopicSelector/useDropdownMenu.tsx +6 -3
  143. package/src/features/ResourceManager/components/Explorer/ItemDropdown/DropdownMenu.tsx +12 -35
  144. package/src/features/ResourceManager/components/Explorer/ItemDropdown/useFileItemDropdown.tsx +4 -8
  145. package/src/features/ResourceManager/components/Explorer/ListView/ListItem/index.tsx +162 -160
  146. package/src/features/ResourceManager/components/Explorer/MasonryView/MasonryFileItem/index.tsx +16 -8
  147. package/src/features/ResourceManager/components/Explorer/ToolBar/ActionIconWithChevron.tsx +4 -3
  148. package/src/features/ResourceManager/components/Explorer/ToolBar/BatchActionsDropdown.tsx +6 -12
  149. package/src/features/ResourceManager/components/Explorer/ToolBar/SortDropdown.tsx +8 -8
  150. package/src/features/ResourceManager/components/Explorer/ToolBar/ViewSwitcher.tsx +8 -11
  151. package/src/features/ResourceManager/components/Tree/index.tsx +121 -122
  152. package/src/helpers/toolEngineering/index.ts +1 -1
  153. package/src/layout/GlobalProvider/index.tsx +5 -2
  154. package/src/locales/default/plugin.ts +6 -0
  155. package/src/server/modules/Mecha/AgentToolsEngine/__tests__/index.test.ts +1 -1
  156. package/src/server/modules/Mecha/AgentToolsEngine/index.ts +1 -1
  157. package/src/store/chat/slices/builtinTool/actions/index.ts +1 -11
  158. package/src/store/tool/slices/builtin/executors/index.ts +4 -0
  159. package/src/styles/global.ts +6 -0
  160. package/src/styles/text.ts +1 -1
  161. package/src/tools/executionRuntimes.ts +3 -8
  162. package/src/tools/identifiers.ts +1 -1
  163. package/src/tools/index.ts +1 -1
  164. package/src/tools/inspectors.ts +5 -0
  165. package/src/tools/renders.ts +6 -12
  166. package/packages/builtin-tool-local-system/src/client/Render/RenameLocalFile/index.tsx +0 -37
  167. package/src/features/Conversation/components/ContextMenu.tsx +0 -418
  168. package/src/store/chat/slices/builtinTool/actions/__tests__/localSystem.test.ts +0 -201
  169. package/src/store/chat/slices/builtinTool/actions/knowledgeBase.ts +0 -163
  170. package/src/store/chat/slices/builtinTool/actions/localSystem.ts +0 -241
  171. package/src/tools/knowledge-base/ExecutionRuntime/index.ts +0 -25
  172. package/src/tools/knowledge-base/Render/ReadKnowledge/index.tsx +0 -29
  173. package/src/tools/knowledge-base/Render/SearchKnowledgeBase/index.tsx +0 -29
  174. package/src/tools/knowledge-base/Render/index.ts +0 -7
  175. package/src/tools/knowledge-base/index.ts +0 -12
  176. package/src/tools/local-system/ExecutionRuntime/index.ts +0 -9
  177. package/src/tools/local-system/systemRole.ts +0 -1
@@ -1,6 +1,6 @@
1
1
  import { SESSION_CHAT_URL } from '@lobechat/const';
2
2
  import type { SidebarAgentItem } from '@lobechat/types';
3
- import { ActionIcon, Dropdown, Icon, type MenuProps } from '@lobehub/ui';
3
+ import { ActionIcon, Icon } from '@lobehub/ui';
4
4
  import { cssVar } from 'antd-style';
5
5
  import { Loader2, PinIcon } from 'lucide-react';
6
6
  import { type CSSProperties, type DragEvent, memo, useCallback, useMemo } from 'react';
@@ -96,7 +96,7 @@ const AgentItem = memo<AgentItemProps>(({ item, style, className }) => {
96
96
  return <Avatar avatar={typeof avatar === 'string' ? avatar : undefined} />;
97
97
  }, [isUpdating, avatar]);
98
98
 
99
- const dropdownMenu: MenuProps['items'] = useDropdownMenu({
99
+ const dropdownMenu = useDropdownMenu({
100
100
  group: undefined, // TODO: pass group from parent if needed
101
101
  id,
102
102
  openCreateGroupModal: handleOpenCreateGroupModal,
@@ -108,30 +108,25 @@ const AgentItem = memo<AgentItemProps>(({ item, style, className }) => {
108
108
 
109
109
  return (
110
110
  <>
111
- <Dropdown
112
- menu={{
113
- items: dropdownMenu,
114
- }}
115
- trigger={['contextMenu']}
116
- >
117
- <Link aria-label={id} to={agentUrl}>
118
- <NavItem
119
- actions={<Actions dropdownMenu={dropdownMenu} />}
120
- className={className}
121
- disabled={editing || isUpdating}
122
- draggable={!editing && !isUpdating}
123
- extra={pinIcon}
124
- icon={avatarIcon}
125
- key={id}
126
- loading={isLoading}
127
- onDoubleClick={handleDoubleClick}
128
- onDragEnd={handleDragEnd}
129
- onDragStart={handleDragStart}
130
- style={style}
131
- title={displayTitle}
132
- />
133
- </Link>
134
- </Dropdown>
111
+ <Link aria-label={id} to={agentUrl}>
112
+ <NavItem
113
+ actions={<Actions dropdownMenu={dropdownMenu} />}
114
+ className={className}
115
+ contextMenuItems={dropdownMenu}
116
+ disabled={editing || isUpdating}
117
+ draggable={!editing && !isUpdating}
118
+ extra={pinIcon}
119
+ icon={avatarIcon}
120
+ key={id}
121
+ loading={isLoading}
122
+ onDoubleClick={handleDoubleClick}
123
+ onDragEnd={handleDragEnd}
124
+ onDragStart={handleDragStart}
125
+ style={style}
126
+ title={displayTitle}
127
+ />
128
+ </Link>
129
+
135
130
  <Editing
136
131
  avatar={typeof avatar === 'string' ? avatar : undefined}
137
132
  id={id}
@@ -1,25 +1,16 @@
1
- import { ActionIcon, Dropdown, type MenuProps } from '@lobehub/ui';
1
+ import { ActionIcon, type DropdownItem, DropdownMenu } from '@lobehub/ui';
2
2
  import { MoreHorizontalIcon } from 'lucide-react';
3
3
  import { memo } from 'react';
4
4
 
5
5
  interface ActionProps {
6
- dropdownMenu: MenuProps['items'];
6
+ dropdownMenu: DropdownItem[] | (() => DropdownItem[]);
7
7
  }
8
8
 
9
9
  const Actions = memo<ActionProps>(({ dropdownMenu }) => {
10
10
  return (
11
- <Dropdown
12
- arrow={false}
13
- menu={{
14
- items: dropdownMenu,
15
- onClick: ({ domEvent }) => {
16
- domEvent.stopPropagation();
17
- },
18
- }}
19
- trigger={['click']}
20
- >
11
+ <DropdownMenu items={dropdownMenu}>
21
12
  <ActionIcon icon={MoreHorizontalIcon} size={'small'} />
22
- </Dropdown>
13
+ </DropdownMenu>
23
14
  );
24
15
  });
25
16
 
@@ -1,5 +1,5 @@
1
1
  import { type MenuProps } from '@lobehub/ui';
2
- import { useMemo } from 'react';
2
+ import { useCallback } from 'react';
3
3
 
4
4
  import { useSessionItemMenuItems } from '../../../../hooks';
5
5
 
@@ -21,7 +21,7 @@ export const useDropdownMenu = ({
21
21
  pinned,
22
22
  sessionType,
23
23
  toggleEditing,
24
- }: ActionProps): MenuProps['items'] => {
24
+ }: ActionProps): (() => MenuProps['items']) => {
25
25
  const {
26
26
  pinMenuItem,
27
27
  renameMenuItem,
@@ -31,7 +31,7 @@ export const useDropdownMenu = ({
31
31
  deleteMenuItem,
32
32
  } = useSessionItemMenuItems();
33
33
 
34
- return useMemo(
34
+ return useCallback(
35
35
  () =>
36
36
  [
37
37
  pinMenuItem(id, pinned, parentType),
@@ -1,25 +1,16 @@
1
- import { ActionIcon, Dropdown, type MenuProps } from '@lobehub/ui';
1
+ import { ActionIcon, type DropdownItem, DropdownMenu } from '@lobehub/ui';
2
2
  import { MoreHorizontalIcon } from 'lucide-react';
3
3
  import { memo } from 'react';
4
4
 
5
5
  interface ActionsProps {
6
- dropdownMenu: MenuProps['items'];
6
+ dropdownMenu: DropdownItem[] | (() => DropdownItem[]);
7
7
  }
8
8
 
9
9
  const Actions = memo<ActionsProps>(({ dropdownMenu }) => {
10
10
  return (
11
- <Dropdown
12
- arrow={false}
13
- menu={{
14
- items: dropdownMenu,
15
- onClick: ({ domEvent }) => {
16
- domEvent.stopPropagation();
17
- },
18
- }}
19
- trigger={['click']}
20
- >
11
+ <DropdownMenu items={dropdownMenu}>
21
12
  <ActionIcon icon={MoreHorizontalIcon} size={'small'} />
22
- </Dropdown>
13
+ </DropdownMenu>
23
14
  );
24
15
  });
25
16
 
@@ -1,4 +1,3 @@
1
- import { Dropdown } from '@lobehub/ui';
2
1
  import { BoxIcon } from 'lucide-react';
3
2
  import { memo, useCallback } from 'react';
4
3
 
@@ -39,20 +38,14 @@ const ProjectItem = memo<ProjectItemProps>(({ id, name }) => {
39
38
 
40
39
  return (
41
40
  <>
42
- <Dropdown
43
- menu={{
44
- items: dropdownMenu,
45
- }}
46
- trigger={['contextMenu']}
47
- >
48
- <NavItem
49
- actions={<Actions dropdownMenu={dropdownMenu} />}
50
- disabled={editing || isUpdating}
51
- icon={BoxIcon}
52
- loading={isLoading || isUpdating}
53
- title={name}
54
- />
55
- </Dropdown>
41
+ <NavItem
42
+ actions={<Actions dropdownMenu={dropdownMenu} />}
43
+ contextMenuItems={dropdownMenu}
44
+ disabled={editing || isUpdating}
45
+ icon={BoxIcon}
46
+ loading={isLoading || isUpdating}
47
+ title={name}
48
+ />
56
49
  <Editing id={id} name={name} toggleEditing={toggleEditing} />
57
50
  </>
58
51
  );
@@ -1,7 +1,7 @@
1
1
  import { Icon, type MenuProps } from '@lobehub/ui';
2
2
  import { App } from 'antd';
3
3
  import { PencilLine, Trash } from 'lucide-react';
4
- import { useMemo } from 'react';
4
+ import { useCallback } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
7
  import { useKnowledgeBaseStore } from '@/store/knowledgeBase';
@@ -14,12 +14,12 @@ interface ProjectItemDropdownMenuProps {
14
14
  export const useProjectItemDropdownMenu = ({
15
15
  id,
16
16
  toggleEditing,
17
- }: ProjectItemDropdownMenuProps): MenuProps['items'] => {
17
+ }: ProjectItemDropdownMenuProps): (() => MenuProps['items']) => {
18
18
  const { t } = useTranslation(['home', 'common']);
19
19
  const [removeKnowledgeBase] = useKnowledgeBaseStore((s) => [s.removeKnowledgeBase]);
20
20
  const { modal } = App.useApp();
21
21
 
22
- return useMemo<MenuProps['items']>(
22
+ return useCallback(
23
23
  () => [
24
24
  {
25
25
  icon: <Icon icon={PencilLine} />,
@@ -1,6 +1,5 @@
1
- import { ActionIcon, Flexbox } from '@lobehub/ui';
1
+ import { ActionIcon, DropdownMenu, Flexbox } from '@lobehub/ui';
2
2
  import { CreateBotIcon } from '@lobehub/ui/icons';
3
- import { Dropdown } from 'antd';
4
3
  import { cssVar } from 'antd-style';
5
4
  import { ChevronDownIcon } from 'lucide-react';
6
5
  import React, { memo, useCallback, useMemo } from 'react';
@@ -45,7 +44,7 @@ const AddButton = memo(() => {
45
44
  size={DESKTOP_HEADER_ICON_SIZE}
46
45
  title={tChat('newAgent')}
47
46
  />
48
- <Dropdown menu={{ items: dropdownItems || [] }}>
47
+ <DropdownMenu items={dropdownItems}>
49
48
  <ActionIcon
50
49
  color={cssVar.colorTextQuaternary}
51
50
  icon={ChevronDownIcon}
@@ -54,7 +53,7 @@ const AddButton = memo(() => {
54
53
  width: 16,
55
54
  }}
56
55
  />
57
- </Dropdown>
56
+ </DropdownMenu>
58
57
  </Flexbox>
59
58
  );
60
59
  });
@@ -1,25 +1,16 @@
1
- import { ActionIcon, Dropdown, type MenuProps } from '@lobehub/ui';
1
+ import { ActionIcon, type DropdownItem, DropdownMenu } from '@lobehub/ui';
2
2
  import { MoreHorizontalIcon } from 'lucide-react';
3
3
  import { memo } from 'react';
4
4
 
5
5
  interface ActionProps {
6
- dropdownMenu: MenuProps['items'];
6
+ dropdownMenu: DropdownItem[] | (() => DropdownItem[]);
7
7
  }
8
8
 
9
9
  const Actions = memo<ActionProps>(({ dropdownMenu }) => {
10
10
  return (
11
- <Dropdown
12
- arrow={false}
13
- menu={{
14
- items: dropdownMenu,
15
- onClick: ({ domEvent }) => {
16
- domEvent.stopPropagation();
17
- },
18
- }}
19
- trigger={['click']}
20
- >
11
+ <DropdownMenu items={dropdownMenu}>
21
12
  <ActionIcon icon={MoreHorizontalIcon} size={'small'} />
22
- </Dropdown>
13
+ </DropdownMenu>
23
14
  );
24
15
  });
25
16
 
@@ -1,5 +1,4 @@
1
- import { Avatar, type MenuProps } from '@lobehub/ui';
2
- import { Dropdown } from '@lobehub/ui';
1
+ import { Avatar } from '@lobehub/ui';
3
2
  import { FileTextIcon } from 'lucide-react';
4
3
  import { memo, useCallback, useMemo } from 'react';
5
4
  import { useTranslation } from 'react-i18next';
@@ -56,7 +55,7 @@ const PageListItem = memo<DocumentItemProps>(({ pageId, className }) => {
56
55
  return FileTextIcon;
57
56
  }, [emoji]);
58
57
 
59
- const dropdownMenu: MenuProps['items'] = useDropdownMenu({
58
+ const dropdownMenu = useDropdownMenu({
60
59
  documentContent: document?.content || undefined,
61
60
  pageId,
62
61
  toggleEditing,
@@ -64,23 +63,17 @@ const PageListItem = memo<DocumentItemProps>(({ pageId, className }) => {
64
63
 
65
64
  return (
66
65
  <>
67
- <Dropdown
68
- menu={{
69
- items: dropdownMenu,
70
- }}
71
- trigger={['contextMenu']}
72
- >
73
- <NavItem
74
- actions={<Actions dropdownMenu={dropdownMenu} />}
75
- active={active}
76
- className={className}
77
- disabled={editing}
78
- icon={icon}
79
- key={pageId}
80
- onClick={handleClick}
81
- title={title}
82
- />
83
- </Dropdown>
66
+ <NavItem
67
+ actions={<Actions dropdownMenu={dropdownMenu} />}
68
+ active={active}
69
+ className={className}
70
+ contextMenuItems={dropdownMenu}
71
+ disabled={editing}
72
+ icon={icon}
73
+ key={pageId}
74
+ onClick={handleClick}
75
+ title={title}
76
+ />
84
77
  <Editing
85
78
  currentEmoji={emoji}
86
79
  documentId={pageId}
@@ -1,7 +1,7 @@
1
1
  import { Icon, type MenuProps } from '@lobehub/ui';
2
2
  import { App } from 'antd';
3
3
  import { Copy, CopyPlus, Pencil, Trash2 } from 'lucide-react';
4
- import { useMemo } from 'react';
4
+ import { useCallback } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
7
  import { useFileStore } from '@/store/file';
@@ -16,7 +16,7 @@ export const useDropdownMenu = ({
16
16
  documentContent,
17
17
  pageId,
18
18
  toggleEditing,
19
- }: ActionProps): MenuProps['items'] => {
19
+ }: ActionProps): (() => MenuProps['items']) => {
20
20
  const { t } = useTranslation(['common', 'file']);
21
21
  const { message, modal } = App.useApp();
22
22
  const removeDocument = useFileStore((s) => s.removeDocument);
@@ -59,7 +59,7 @@ export const useDropdownMenu = ({
59
59
  }
60
60
  };
61
61
 
62
- return useMemo(
62
+ return useCallback(
63
63
  () =>
64
64
  [
65
65
  {
@@ -1,25 +1,16 @@
1
- import { ActionIcon, Dropdown, type MenuProps } from '@lobehub/ui';
1
+ import { ActionIcon, type DropdownItem, DropdownMenu } from '@lobehub/ui';
2
2
  import { MoreHorizontalIcon } from 'lucide-react';
3
3
  import { memo } from 'react';
4
4
 
5
5
  interface ActionProps {
6
- dropdownMenu: MenuProps['items'];
6
+ dropdownMenu: DropdownItem[] | (() => DropdownItem[]);
7
7
  }
8
8
 
9
9
  const Actions = memo<ActionProps>(({ dropdownMenu }) => {
10
10
  return (
11
- <Dropdown
12
- arrow={false}
13
- menu={{
14
- items: dropdownMenu,
15
- onClick: ({ domEvent }) => {
16
- domEvent.stopPropagation();
17
- },
18
- }}
19
- trigger={['click']}
20
- >
11
+ <DropdownMenu items={dropdownMenu}>
21
12
  <ActionIcon icon={MoreHorizontalIcon} size={'small'} />
22
- </Dropdown>
13
+ </DropdownMenu>
23
14
  );
24
15
  });
25
16
 
@@ -1,5 +1,4 @@
1
- import { Icon, type MenuProps } from '@lobehub/ui';
2
- import { Dropdown } from '@lobehub/ui';
1
+ import { Icon } from '@lobehub/ui';
3
2
  import { cssVar } from 'antd-style';
4
3
  import { Loader2Icon } from 'lucide-react';
5
4
  import React, { type CSSProperties, memo, useCallback, useMemo } from 'react';
@@ -66,33 +65,27 @@ const KnowledgeBaseItem = memo<KnowledgeBaseItemProps>(({ id, name, active, styl
66
65
  return <RepoIcon size={18} />;
67
66
  }, [isLoading]);
68
67
 
69
- const dropdownMenu: MenuProps['items'] = useDropdownMenu({
68
+ const dropdownMenu = useDropdownMenu({
70
69
  id,
71
70
  toggleEditing,
72
71
  });
73
72
 
74
73
  return (
75
74
  <>
76
- <Dropdown
77
- menu={{
78
- items: dropdownMenu,
79
- }}
80
- trigger={['contextMenu']}
81
- >
82
- <NavItem
83
- actions={<Actions dropdownMenu={dropdownMenu} />}
84
- active={active}
85
- className={className}
86
- disabled={editing}
87
- icon={icon}
88
- key={id}
89
- loading={isLoading}
90
- onClick={handleClick}
91
- onDoubleClick={handleDoubleClick}
92
- style={style}
93
- title={name}
94
- />
95
- </Dropdown>
75
+ <NavItem
76
+ actions={<Actions dropdownMenu={dropdownMenu} />}
77
+ active={active}
78
+ className={className}
79
+ contextMenuItems={dropdownMenu}
80
+ disabled={editing}
81
+ icon={icon}
82
+ key={id}
83
+ loading={isLoading}
84
+ onClick={handleClick}
85
+ onDoubleClick={handleDoubleClick}
86
+ style={style}
87
+ title={name}
88
+ />
96
89
  <Editing id={id} name={name} toggleEditing={toggleEditing} />
97
90
  </>
98
91
  );
@@ -1,7 +1,7 @@
1
1
  import { Icon, type MenuProps } from '@lobehub/ui';
2
2
  import { App } from 'antd';
3
3
  import { PencilLine, Trash } from 'lucide-react';
4
- import { useMemo } from 'react';
4
+ import { useCallback } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
7
7
  import { useKnowledgeBaseStore } from '@/store/knowledgeBase';
@@ -11,7 +11,7 @@ interface ActionProps {
11
11
  toggleEditing: (visible?: boolean) => void;
12
12
  }
13
13
 
14
- export const useDropdownMenu = ({ id, toggleEditing }: ActionProps): MenuProps['items'] => {
14
+ export const useDropdownMenu = ({ id, toggleEditing }: ActionProps): (() => MenuProps['items']) => {
15
15
  const { t } = useTranslation(['file', 'common']);
16
16
  const { modal } = App.useApp();
17
17
  const removeKnowledgeBase = useKnowledgeBaseStore((s) => s.removeKnowledgeBase);
@@ -29,7 +29,7 @@ export const useDropdownMenu = ({ id, toggleEditing }: ActionProps): MenuProps['
29
29
  });
30
30
  };
31
31
 
32
- return useMemo(
32
+ return useCallback(
33
33
  () =>
34
34
  [
35
35
  {
@@ -1,9 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { useDroppable } from '@dnd-kit/core';
4
- import { Center, Flexbox, Skeleton, Text } from '@lobehub/ui';
5
- import { Dropdown } from 'antd';
6
- import type { MenuProps } from 'antd';
4
+ import { Center, type DropdownItem, DropdownMenu, Flexbox, Skeleton, Text } from '@lobehub/ui';
7
5
  import { createStaticStyles, cx } from 'antd-style';
8
6
  import { ChevronsUpDown } from 'lucide-react';
9
7
  import { memo, useCallback, useMemo } from 'react';
@@ -81,7 +79,7 @@ const Head = memo<{ id: string }>(({ id }) => {
81
79
  [navigate, setMode],
82
80
  );
83
81
 
84
- const menuItems: MenuProps['items'] = useMemo(() => {
82
+ const menuItems = useMemo<DropdownItem[]>(() => {
85
83
  if (!libraries) return [];
86
84
 
87
85
  return libraries.map((library) => ({
@@ -120,14 +118,14 @@ const Head = memo<{ id: string }>(({ id }) => {
120
118
  </Flexbox>
121
119
  )}
122
120
  {name && (
123
- <Dropdown menu={{ items: menuItems }} placement="bottomRight" trigger={['click']}>
121
+ <DropdownMenu items={menuItems} placement="bottomRight">
124
122
  <ChevronsUpDown
125
123
  className={styles.icon}
126
124
  onClick={(e) => e.stopPropagation()}
127
125
  size={16}
128
126
  style={{ cursor: 'pointer', flex: 'none' }}
129
127
  />
130
- </Dropdown>
128
+ </DropdownMenu>
131
129
  )}
132
130
  </Flexbox>
133
131
  );
@@ -1,7 +1,5 @@
1
- import { ActionIcon, Flexbox } from '@lobehub/ui';
2
- import { Dropdown } from 'antd';
1
+ import { ActionIcon, DropdownMenu, type DropdownMenuCheckboxItem, Flexbox } from '@lobehub/ui';
3
2
  import { createStaticStyles } from 'antd-style';
4
- import type { ItemType } from 'antd/es/menu/interface';
5
3
  import dayjs from 'dayjs';
6
4
  import relativeTime from 'dayjs/plugin/relativeTime';
7
5
  import { Clock3Icon, PlusIcon } from 'lucide-react';
@@ -53,7 +51,7 @@ const TopicSelector = memo<TopicSelectorProps>(({ agentId }) => {
53
51
  [topics, activeTopicId],
54
52
  );
55
53
 
56
- const items = useMemo<ItemType[]>(
54
+ const items = useMemo<DropdownMenuCheckboxItem[]>(
57
55
  () =>
58
56
  (topics || []).map((topic) => {
59
57
  const displayTime =
@@ -62,6 +60,8 @@ const TopicSelector = memo<TopicSelectorProps>(({ agentId }) => {
62
60
  : dayjs(topic.updatedAt).format('YYYY-MM-DD');
63
61
 
64
62
  return {
63
+ checked: topic.id === activeTopicId,
64
+ closeOnClick: true,
65
65
  key: topic.id,
66
66
  label: (
67
67
  <Flexbox align="center" gap={4} horizontal justify="space-between" width="100%">
@@ -69,11 +69,17 @@ const TopicSelector = memo<TopicSelectorProps>(({ agentId }) => {
69
69
  <span className={styles.time}>{displayTime}</span>
70
70
  </Flexbox>
71
71
  ),
72
- onClick: () => switchTopic(topic.id),
72
+ onCheckedChange: (checked) => {
73
+ if (checked) {
74
+ switchTopic(topic.id);
75
+ }
76
+ },
77
+ type: 'checkbox',
73
78
  };
74
79
  }),
75
- [topics, switchTopic, styles],
80
+ [topics, switchTopic, styles, activeTopicId],
76
81
  );
82
+ const isEmpty = !topics || topics.length === 0;
77
83
 
78
84
  return (
79
85
  <NavHeader
@@ -88,19 +94,14 @@ const TopicSelector = memo<TopicSelectorProps>(({ agentId }) => {
88
94
  size={DESKTOP_HEADER_ICON_SIZE}
89
95
  title={t('actions.addNewTopic')}
90
96
  />
91
- <Dropdown
92
- disabled={!topics || topics.length === 0}
93
- menu={{
94
- items,
95
- selectedKeys: activeTopicId ? [activeTopicId] : [],
96
- style: { maxHeight: 400, overflowY: 'auto' },
97
- }}
98
- overlayStyle={{ minWidth: 280 }}
97
+ <DropdownMenu
98
+ items={items}
99
99
  placement="bottomRight"
100
- trigger={['click']}
100
+ popupProps={{ style: { maxHeight: 400, minWidth: 280, overflowY: 'auto' } }}
101
+ triggerProps={{ disabled: isEmpty }}
101
102
  >
102
- <ActionIcon disabled={!topics || topics.length === 0} icon={Clock3Icon} />
103
- </Dropdown>
103
+ <ActionIcon disabled={isEmpty} icon={Clock3Icon} />
104
+ </DropdownMenu>
104
105
  </>
105
106
  }
106
107
  showTogglePanelButton={false}
@@ -22,6 +22,13 @@ export const styles = createStaticStyles(({ css, cssVar }) => {
22
22
  display: flex;
23
23
  }
24
24
 
25
+ &:has([data-popup-open]) {
26
+ div[role='menubar'] {
27
+ pointer-events: unset;
28
+ opacity: 1;
29
+ }
30
+ }
31
+
25
32
  &:hover {
26
33
  time,
27
34
  div[role='menubar'] {
@@ -15,9 +15,7 @@ export const ErrorActionsBar = memo<ErrorActionsBarProps>(({ actions, onActionCl
15
15
  return (
16
16
  <ActionIconGroup
17
17
  items={[regenerate, del]}
18
- menu={{
19
- items: [edit, copy, divider, del],
20
- }}
18
+ menu={[edit, copy, divider, del]}
21
19
  onActionClick={onActionClick}
22
20
  />
23
21
  );