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

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 (88) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/changelog/v1.json +18 -0
  3. package/package.json +2 -2
  4. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/Actions.tsx +4 -13
  5. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/Actions.tsx +4 -13
  6. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/index.tsx +2 -9
  7. package/src/app/[variants]/(main)/agent/features/Conversation/ConversationArea.tsx +2 -2
  8. package/src/app/[variants]/(main)/agent/features/Conversation/Header/Tags/KnowledgeTag.tsx +3 -4
  9. package/src/app/[variants]/(main)/agent/profile/features/ProfileEditor/MentionList/types.ts +4 -2
  10. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Details/Nav.tsx +0 -1
  11. package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Details/Related/index.tsx +9 -5
  12. package/src/app/[variants]/(main)/community/(detail)/model/features/Sidebar/ActionButton/ChatWithModel.tsx +3 -8
  13. package/src/app/[variants]/(main)/community/(list)/assistant/features/MarketSourceSwitch.tsx +44 -23
  14. package/src/app/[variants]/(main)/community/(list)/features/SortButton/index.tsx +40 -19
  15. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/Actions.tsx +4 -13
  16. package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/index.tsx +2 -9
  17. package/src/app/[variants]/(main)/group/features/Conversation/ConversationArea.tsx +2 -2
  18. package/src/app/[variants]/(main)/group/features/Conversation/Header/Tags/KnowledgeTag.tsx +3 -4
  19. package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/AgentBuilderProvider.tsx +2 -2
  20. package/src/app/[variants]/(main)/group/profile/features/MemberProfile/MentionList/types.ts +4 -2
  21. package/src/app/[variants]/(main)/home/_layout/Body/Agent/Actions.tsx +3 -11
  22. package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/Group/Actions.tsx +3 -12
  23. package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/Group/Item.tsx +2 -9
  24. package/src/app/[variants]/(main)/home/_layout/Body/Agent/index.tsx +2 -9
  25. package/src/app/[variants]/(main)/home/_layout/Body/Project/index.tsx +2 -9
  26. package/src/app/[variants]/(main)/home/_layout/HomeAgentIdSync.tsx +23 -0
  27. package/src/app/[variants]/(main)/home/_layout/index.tsx +2 -0
  28. package/src/app/[variants]/(main)/home/features/CommunityAgents/index.tsx +11 -13
  29. package/src/app/[variants]/(main)/home/features/FeaturedPlugins/index.tsx +11 -13
  30. package/src/app/[variants]/(main)/home/features/RecentPage/index.tsx +12 -14
  31. package/src/app/[variants]/(main)/home/features/RecentResource/index.tsx +12 -14
  32. package/src/app/[variants]/(main)/memory/contexts/features/ContextDropdown.tsx +5 -3
  33. package/src/app/[variants]/(main)/memory/experiences/features/ExperienceDropdown.tsx +5 -3
  34. package/src/app/[variants]/(main)/memory/identities/features/IdentityDropdown.tsx +5 -3
  35. package/src/app/[variants]/(main)/memory/preferences/features/PreferenceDropdown.tsx +5 -3
  36. package/src/app/[variants]/(main)/page/_layout/Body/Actions.tsx +3 -13
  37. package/src/app/[variants]/(main)/page/_layout/Body/index.tsx +2 -9
  38. package/src/app/[variants]/(main)/resource/features/DndContextWrapper.tsx +1 -1
  39. package/src/app/[variants]/(main)/settings/profile/features/SSOProvidersList/index.tsx +3 -3
  40. package/src/app/[variants]/(main)/settings/provider/ProviderMenu/Actions.tsx +3 -11
  41. package/src/app/[variants]/(main)/settings/provider/ProviderMenu/List.tsx +12 -28
  42. package/src/app/[variants]/(main)/settings/provider/features/ModelList/DisabledModels.tsx +7 -8
  43. package/src/app/[variants]/(main)/settings/provider/features/ModelList/ModelTitle/index.tsx +18 -20
  44. package/src/app/[variants]/(mobile)/(home)/features/SessionListContent/CollapseGroup/Actions.tsx +10 -14
  45. package/src/app/[variants]/(mobile)/(home)/features/SessionListContent/List/Item/Actions.tsx +3 -13
  46. package/src/app/[variants]/share/t/[id]/SharedMessageList.tsx +2 -2
  47. package/src/business/server/lambda-routers/file.ts +1 -1
  48. package/src/features/AgentBuilder/AgentBuilderProvider.tsx +2 -2
  49. package/src/features/ChatInput/ActionBar/History/index.tsx +1 -1
  50. package/src/features/ChatInput/ActionBar/STT/common.tsx +1 -1
  51. package/src/features/ChatInput/ActionBar/Search/index.tsx +1 -1
  52. package/src/features/ChatInput/ActionBar/Upload/ServerMode.tsx +1 -0
  53. package/src/features/ChatInput/ActionBar/components/Action.tsx +4 -8
  54. package/src/features/ChatInput/ActionBar/components/ActionDropdown.tsx +225 -37
  55. package/src/features/Conversation/ConversationProvider.tsx +2 -1
  56. package/src/features/Conversation/Messages/Assistant/Actions/index.tsx +10 -6
  57. package/src/features/Conversation/Messages/AssistantGroup/Actions/index.tsx +10 -6
  58. package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/ApprovalActions.tsx +11 -13
  59. package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/ModeSelector.tsx +8 -10
  60. package/src/features/Conversation/Messages/Supervisor/Actions/index.tsx +10 -6
  61. package/src/features/Conversation/Messages/Task/Actions/index.tsx +10 -6
  62. package/src/features/Conversation/Messages/User/Actions/index.tsx +10 -6
  63. package/src/features/Conversation/StoreUpdater.tsx +1 -1
  64. package/src/features/Conversation/store/initialState.ts +3 -1
  65. package/src/features/Conversation/store/slices/data/action.ts +6 -5
  66. package/src/features/LibraryModal/AssignKnowledgeBase/Item/Action.tsx +23 -26
  67. package/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsx +16 -18
  68. package/src/features/ModelSwitchPanel/styles.ts +18 -1
  69. package/src/features/PageEditor/Copilot/AgentSelector/Actions.tsx +6 -13
  70. package/src/features/PageEditor/PageAgentProvider.tsx +2 -2
  71. package/src/features/PluginStore/InstalledList/List/Item/Action.tsx +33 -36
  72. package/src/features/PluginStore/McpList/List/Action.tsx +25 -28
  73. package/src/features/PluginStore/PluginList/List/Action.tsx +25 -28
  74. package/src/features/PluginTag/index.tsx +3 -4
  75. package/src/features/Portal/Artifacts/Body/Renderer/SVG.tsx +14 -11
  76. package/src/features/Portal/Thread/Chat/index.tsx +2 -2
  77. package/src/features/ProfileEditor/AgentTool.tsx +1 -1
  78. package/src/features/ResourceManager/components/Explorer/ToolBar/SortDropdown.tsx +21 -18
  79. package/src/features/ResourceManager/components/Explorer/ToolBar/ViewSwitcher.tsx +7 -13
  80. package/src/features/ResourceManager/components/Header/AddButton.tsx +4 -11
  81. package/src/features/User/UserPanel/LangButton.tsx +56 -44
  82. package/src/layout/AuthProvider/MarketAuth/MarketAuthProvider.tsx +1 -1
  83. package/src/services/discover.ts +6 -4
  84. package/src/services/document/index.ts +11 -1
  85. package/src/store/page/slices/crud/action.ts +0 -48
  86. package/src/store/tool/slices/lobehubSkillStore/action.ts +1 -2
  87. package/src/styles/global.ts +2 -2
  88. package/src/types/shim-lobe-ui.d.ts +7 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,64 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 2.0.0-next.299](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.298...v2.0.0-next.299)
6
+
7
+ <sup>Released on **2026-01-17**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **ui**: Migrate from Dropdown to DropdownMenu/ContextMenuTrigger components.
12
+
13
+ #### 🐛 Bug Fixes
14
+
15
+ - **misc**: Fix topic messages display error when switch topic quickly.
16
+
17
+ <br/>
18
+
19
+ <details>
20
+ <summary><kbd>Improvements and Fixes</kbd></summary>
21
+
22
+ #### Code refactoring
23
+
24
+ - **ui**: Migrate from Dropdown to DropdownMenu/ContextMenuTrigger components, closes [#11539](https://github.com/lobehub/lobe-chat/issues/11539) ([9c9d4b1](https://github.com/lobehub/lobe-chat/commit/9c9d4b1))
25
+
26
+ #### What's fixed
27
+
28
+ - **misc**: Fix topic messages display error when switch topic quickly, closes [#11542](https://github.com/lobehub/lobe-chat/issues/11542) ([371d91e](https://github.com/lobehub/lobe-chat/commit/371d91e))
29
+
30
+ </details>
31
+
32
+ <div align="right">
33
+
34
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
35
+
36
+ </div>
37
+
38
+ ## [Version 2.0.0-next.298](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.297...v2.0.0-next.298)
39
+
40
+ <sup>Released on **2026-01-16**</sup>
41
+
42
+ #### 🐛 Bug Fixes
43
+
44
+ - **misc**: Fix switch skill in home.
45
+
46
+ <br/>
47
+
48
+ <details>
49
+ <summary><kbd>Improvements and Fixes</kbd></summary>
50
+
51
+ #### What's fixed
52
+
53
+ - **misc**: Fix switch skill in home, closes [#11537](https://github.com/lobehub/lobe-chat/issues/11537) ([d5561f3](https://github.com/lobehub/lobe-chat/commit/d5561f3))
54
+
55
+ </details>
56
+
57
+ <div align="right">
58
+
59
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
60
+
61
+ </div>
62
+
5
63
  ## [Version 2.0.0-next.297](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.296...v2.0.0-next.297)
6
64
 
7
65
  <sup>Released on **2026-01-16**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,22 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "fixes": [
5
+ "Fix topic messages display error when switch topic quickly."
6
+ ]
7
+ },
8
+ "date": "2026-01-17",
9
+ "version": "2.0.0-next.299"
10
+ },
11
+ {
12
+ "children": {
13
+ "fixes": [
14
+ "Fix switch skill in home."
15
+ ]
16
+ },
17
+ "date": "2026-01-16",
18
+ "version": "2.0.0-next.298"
19
+ },
2
20
  {
3
21
  "children": {
4
22
  "features": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/lobehub",
3
- "version": "2.0.0-next.297",
3
+ "version": "2.0.0-next.299",
4
4
  "description": "LobeHub - an open-source,comprehensive AI Agent framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -206,7 +206,7 @@
206
206
  "@lobehub/icons": "^4.0.2",
207
207
  "@lobehub/market-sdk": "0.29.0",
208
208
  "@lobehub/tts": "^4.0.2",
209
- "@lobehub/ui": "^4.19.0",
209
+ "@lobehub/ui": "^4.21.0",
210
210
  "@modelcontextprotocol/sdk": "^1.25.1",
211
211
  "@neondatabase/serverless": "^1.0.2",
212
212
  "@next/third-parties": "^16.1.1",
@@ -1,4 +1,4 @@
1
- import { ActionIcon, Dropdown } from '@lobehub/ui';
1
+ import { ActionIcon, DropdownMenu } from '@lobehub/ui';
2
2
  import { MoreHorizontal } from 'lucide-react';
3
3
  import { memo } from 'react';
4
4
 
@@ -10,21 +10,12 @@ interface ActionsProps {
10
10
  }
11
11
 
12
12
  const Actions = memo<ActionsProps>(({ cronJobId, topics }) => {
13
- const dropdownMenu = useCronJobDropdownMenu(cronJobId, topics);
13
+ const menuItems = useCronJobDropdownMenu(cronJobId, topics);
14
14
 
15
15
  return (
16
- <Dropdown
17
- arrow={false}
18
- menu={{
19
- items: dropdownMenu,
20
- onClick: ({ domEvent }) => {
21
- domEvent.stopPropagation();
22
- },
23
- }}
24
- trigger={['click']}
25
- >
16
+ <DropdownMenu items={menuItems}>
26
17
  <ActionIcon icon={MoreHorizontal} size={'small'} />
27
- </Dropdown>
18
+ </DropdownMenu>
28
19
  );
29
20
  });
30
21
 
@@ -1,25 +1,16 @@
1
- import { ActionIcon, Dropdown } from '@lobehub/ui';
1
+ import { ActionIcon, DropdownMenu } from '@lobehub/ui';
2
2
  import { MoreHorizontal } from 'lucide-react';
3
3
  import { memo } from 'react';
4
4
 
5
5
  import { useTopicActionsDropdownMenu } from './useDropdownMenu';
6
6
 
7
7
  const Actions = memo(() => {
8
- const dropdownMenu = useTopicActionsDropdownMenu();
8
+ const menuItems = useTopicActionsDropdownMenu();
9
9
 
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={menuItems}>
21
12
  <ActionIcon icon={MoreHorizontal} size={'small'} />
22
- </Dropdown>
13
+ </DropdownMenu>
23
14
  );
24
15
  });
25
16
 
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { AccordionItem, Dropdown, Flexbox, Text } from '@lobehub/ui';
3
+ import { AccordionItem, ContextMenuTrigger, Flexbox, Text } from '@lobehub/ui';
4
4
  import React, { Suspense, memo } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
@@ -28,14 +28,7 @@ const Topic = memo<TopicProps>(({ itemKey }) => {
28
28
  <AccordionItem
29
29
  action={<Actions />}
30
30
  headerWrapper={(header) => (
31
- <Dropdown
32
- menu={{
33
- items: dropdownMenu,
34
- }}
35
- trigger={['contextMenu']}
36
- >
37
- {header}
38
- </Dropdown>
31
+ <ContextMenuTrigger items={dropdownMenu}>{header}</ContextMenuTrigger>
39
32
  )}
40
33
  itemKey={itemKey}
41
34
  paddingBlock={4}
@@ -48,8 +48,8 @@ const Conversation = memo(() => {
48
48
  context={context}
49
49
  hasInitMessages={!!messages}
50
50
  messages={messages}
51
- onMessagesChange={(messages) => {
52
- replaceMessages(messages, { context });
51
+ onMessagesChange={(messages, ctx) => {
52
+ replaceMessages(messages, { context: ctx });
53
53
  }}
54
54
  operationState={operationState}
55
55
  >
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { Dropdown, Icon, type MenuProps, Tag } from '@lobehub/ui';
4
- import { Flexbox } from '@lobehub/ui';
3
+ import { DropdownMenu, Flexbox, Icon, type MenuProps, Tag } from '@lobehub/ui';
5
4
  import { LibraryBig } from 'lucide-react';
6
5
  import { memo } from 'react';
7
6
 
@@ -25,7 +24,7 @@ const PluginTag = memo<PluginTagProps>(({ data }) => {
25
24
  const count = data.length;
26
25
 
27
26
  return (
28
- <Dropdown menu={{ items }}>
27
+ <DropdownMenu items={items}>
29
28
  <div>
30
29
  <Tag>
31
30
  {<Icon icon={LibraryBig} />}
@@ -35,7 +34,7 @@ const PluginTag = memo<PluginTagProps>(({ data }) => {
35
34
  {count > 1 && <div>({data.length - 1}+)</div>}
36
35
  </Tag>
37
36
  </div>
38
- </Dropdown>
37
+ </DropdownMenu>
39
38
  );
40
39
  });
41
40
 
@@ -1,5 +1,5 @@
1
1
  import type { API } from '@lobechat/prompts';
2
- import type { DropdownMenuItemType } from '@lobehub/ui';
2
+ import type { DropdownItem } from '@lobehub/ui';
3
3
 
4
4
  export type MentionEntityType = 'collection' | 'api';
5
5
 
@@ -14,7 +14,9 @@ export interface MentionMetadata {
14
14
  type?: MentionEntityType;
15
15
  }
16
16
 
17
- export type MentionListOption = DropdownMenuItemType & {
17
+ type MentionMenuItem = Extract<DropdownItem, { type?: 'item' }>;
18
+
19
+ export type MentionListOption = MentionMenuItem & {
18
20
  description?: string;
19
21
  metadata?: MentionMetadata;
20
22
  };
@@ -7,7 +7,6 @@ import { BookOpenIcon, HistoryIcon, SquareUserIcon } from 'lucide-react';
7
7
  import { memo } from 'react';
8
8
  import { useTranslation } from 'react-i18next';
9
9
 
10
-
11
10
  const styles = createStaticStyles(({ css, cssVar }) => {
12
11
  return {
13
12
  link: css`
@@ -1,4 +1,4 @@
1
- import { Avatar, Flexbox, Text , Grid } from '@lobehub/ui';
1
+ import { Avatar, Flexbox, Grid, Text } from '@lobehub/ui';
2
2
  import qs from 'query-string';
3
3
  import { memo } from 'react';
4
4
  import { useTranslation } from 'react-i18next';
@@ -15,9 +15,11 @@ const GroupAgentCard = memo<DiscoverGroupAgentItem>((item) => {
15
15
 
16
16
  const handleClick = () => {
17
17
  if (!item.identifier) return;
18
- navigate(qs.stringifyUrl({
19
- url: urlJoin('/community/group_agent', item.identifier),
20
- }));
18
+ navigate(
19
+ qs.stringifyUrl({
20
+ url: urlJoin('/community/group_agent', item.identifier),
21
+ }),
22
+ );
21
23
  };
22
24
 
23
25
  return (
@@ -75,7 +77,9 @@ const Related = memo(() => {
75
77
  </Grid>
76
78
  ) : (
77
79
  <Flexbox align="center" padding={32} style={{ color: '#999' }}>
78
- {t('groupAgents.details.related.empty', { defaultValue: 'No related group agents found' })}
80
+ {t('groupAgents.details.related.empty', {
81
+ defaultValue: 'No related group agents found',
82
+ })}
79
83
  </Flexbox>
80
84
  )}
81
85
  </Flexbox>
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  import { ProviderIcon } from '@lobehub/icons';
4
- import { Button, Icon } from '@lobehub/ui';
4
+ import { Button, DropdownMenu, Icon } from '@lobehub/ui';
5
5
  import { Dropdown } from 'antd';
6
6
  import { createStaticStyles } from 'antd-style';
7
7
  import { ChevronDownIcon } from 'lucide-react';
@@ -69,12 +69,7 @@ const ChatWithModel = memo(() => {
69
69
  );
70
70
 
71
71
  return (
72
- <Dropdown
73
- menu={{
74
- items,
75
- }}
76
- trigger={['click']}
77
- >
72
+ <DropdownMenu data-no-highlight items={items}>
78
73
  <Button
79
74
  className={styles.button}
80
75
  size={'large'}
@@ -83,7 +78,7 @@ const ChatWithModel = memo(() => {
83
78
  >
84
79
  {t('models.guide')}
85
80
  </Button>
86
- </Dropdown>
81
+ </DropdownMenu>
87
82
  );
88
83
  });
89
84
 
@@ -1,6 +1,12 @@
1
1
  'use client';
2
2
 
3
- import { Dropdown, type DropdownMenuItemType, Icon , Button } from '@lobehub/ui';
3
+ import {
4
+ Button,
5
+ type DropdownItem,
6
+ DropdownMenu,
7
+ type DropdownMenuCheckboxItem,
8
+ Icon,
9
+ } from '@lobehub/ui';
4
10
  import { ChevronDown, Store } from 'lucide-react';
5
11
  import { memo, useMemo } from 'react';
6
12
  import { useTranslation } from 'react-i18next';
@@ -15,18 +21,22 @@ const MarketSourceSwitch = memo(() => {
15
21
  const query = useQuery() as { source?: AssistantMarketSource };
16
22
  const currentSource = (query.source as AssistantMarketSource) ?? 'new';
17
23
 
18
- const items = useMemo(
19
- () =>
20
- [
21
- {
22
- key: 'new',
23
- label: t('assistants.marketSource.new'),
24
- },
25
- {
26
- key: 'legacy',
27
- label: t('assistants.marketSource.legacy'),
28
- },
29
- ] satisfies DropdownMenuItemType[],
24
+ type MarketSourceItem = Extract<DropdownItem, { type?: 'item' }> & {
25
+ key: AssistantMarketSource;
26
+ label: string;
27
+ };
28
+
29
+ const items = useMemo<MarketSourceItem[]>(
30
+ () => [
31
+ {
32
+ key: 'new',
33
+ label: t('assistants.marketSource.new'),
34
+ },
35
+ {
36
+ key: 'legacy',
37
+ label: t('assistants.marketSource.legacy'),
38
+ },
39
+ ],
30
40
  [t],
31
41
  );
32
42
 
@@ -39,22 +49,33 @@ const MarketSourceSwitch = memo(() => {
39
49
  });
40
50
  };
41
51
 
52
+ const menuItems = useMemo<DropdownMenuCheckboxItem[]>(
53
+ () =>
54
+ items.map(
55
+ (item): DropdownMenuCheckboxItem => ({
56
+ checked: item.key === currentSource,
57
+ closeOnClick: true,
58
+ key: item.key,
59
+ label: item.label,
60
+ onCheckedChange: (checked: boolean) => {
61
+ if (checked) {
62
+ handleChange(item.key);
63
+ }
64
+ },
65
+ type: 'checkbox',
66
+ }),
67
+ ),
68
+ [currentSource, handleChange, items],
69
+ );
70
+
42
71
  return (
43
- <Dropdown
44
- menu={{
45
- // @ts-expect-error 等待 antd 修复
46
- activeKey: currentSource,
47
- items,
48
- onClick: ({ key }) => handleChange(key as AssistantMarketSource),
49
- }}
50
- trigger={['click', 'hover']}
51
- >
72
+ <DropdownMenu items={menuItems} trigger="both">
52
73
  <Button icon={<Icon icon={Store} />} type={'text'}>
53
74
  {t('assistants.marketSource.label')}:{' '}
54
75
  {items.find((item) => item.key === currentSource)?.label}
55
76
  <Icon icon={ChevronDown} />
56
77
  </Button>
57
- </Dropdown>
78
+ </DropdownMenu>
58
79
  );
59
80
  });
60
81
 
@@ -1,11 +1,17 @@
1
- import { Button, Dropdown, type DropdownMenuItemType, Icon } from '@lobehub/ui';
1
+ import {
2
+ Button,
3
+ type DropdownItem,
4
+ DropdownMenu,
5
+ type DropdownMenuCheckboxItem,
6
+ Icon,
7
+ } from '@lobehub/ui';
2
8
  import { ArrowDownWideNarrow, ChevronDown } from 'lucide-react';
3
9
  import { memo, useMemo } from 'react';
4
10
  import { useTranslation } from 'react-i18next';
5
11
 
6
12
  import { useQueryRoute } from '@/hooks/useQueryRoute';
7
13
  import { useMarketAuth } from '@/layout/AuthProvider/MarketAuth';
8
- import { usePathname , useQuery } from '@/libs/router/navigation';
14
+ import { usePathname, useQuery } from '@/libs/router/navigation';
9
15
  import {
10
16
  AssistantSorts,
11
17
  DiscoverTab,
@@ -22,7 +28,11 @@ const SortButton = memo(() => {
22
28
  const router = useQueryRoute();
23
29
  const { isAuthenticated, getCurrentUserInfo } = useMarketAuth();
24
30
  const activeTab = useMemo(() => pathname.split('community/')[1] as DiscoverTab, [pathname]);
25
- const items = useMemo(() => {
31
+ type SortItem = Extract<DropdownItem, { type?: 'item' }> & {
32
+ key: string;
33
+ };
34
+
35
+ const items = useMemo<SortItem[]>(() => {
26
36
  switch (activeTab) {
27
37
  case DiscoverTab.Assistants: {
28
38
  const baseItems = [
@@ -153,8 +163,8 @@ const SortButton = memo(() => {
153
163
  label: t('mcp.sorts.updatedAt'),
154
164
  },
155
165
  {
166
+ key: McpSorts.CreatedAt,
156
167
  label: t('mcp.sorts.createdAt'),
157
- value: McpSorts.CreatedAt,
158
168
  },
159
169
  ];
160
170
  }
@@ -164,12 +174,12 @@ const SortButton = memo(() => {
164
174
  }
165
175
  }, [t, activeTab, isAuthenticated]);
166
176
 
167
- const activeItem: any = useMemo(() => {
177
+ const activeItem = useMemo<SortItem | undefined>(() => {
168
178
  if (sort) {
169
- const findItem = items?.find((item: any) => item.key === sort);
179
+ const findItem = items.find((item) => String(item.key) === sort);
170
180
  if (findItem) return findItem;
171
181
  }
172
- return items?.[0];
182
+ return items[0];
173
183
  }, [items, sort]);
174
184
 
175
185
  const handleSort = (config: string) => {
@@ -187,23 +197,34 @@ const SortButton = memo(() => {
187
197
  router.push(pathname, { query });
188
198
  };
189
199
 
190
- if (items?.length === 0) return null;
200
+ const menuItems = useMemo<DropdownMenuCheckboxItem[]>(
201
+ () =>
202
+ items.map(
203
+ (item): DropdownMenuCheckboxItem => ({
204
+ checked: item.key === activeItem?.key,
205
+ closeOnClick: true,
206
+ key: item.key,
207
+ label: item.label,
208
+ onCheckedChange: (checked: boolean) => {
209
+ if (checked) {
210
+ handleSort(String(item.key));
211
+ }
212
+ },
213
+ type: 'checkbox',
214
+ }),
215
+ ),
216
+ [activeItem?.key, handleSort, items],
217
+ );
218
+
219
+ if (menuItems.length === 0) return null;
191
220
 
192
221
  return (
193
- <Dropdown
194
- menu={{
195
- // @ts-expect-error 等待 antd 修复
196
- activeKey: activeItem.key,
197
- items: items as DropdownMenuItemType[],
198
- onClick: ({ key }) => handleSort(key),
199
- }}
200
- trigger={['click', 'hover']}
201
- >
222
+ <DropdownMenu items={menuItems} trigger="both">
202
223
  <Button data-testid="sort-dropdown" icon={<Icon icon={ArrowDownWideNarrow} />} type={'text'}>
203
- {activeItem.label}
224
+ {activeItem?.label ?? menuItems[0]?.label}
204
225
  <Icon icon={ChevronDown} />
205
226
  </Button>
206
- </Dropdown>
227
+ </DropdownMenu>
207
228
  );
208
229
  });
209
230
 
@@ -1,25 +1,16 @@
1
- import { ActionIcon, Dropdown } from '@lobehub/ui';
1
+ import { ActionIcon, DropdownMenu } from '@lobehub/ui';
2
2
  import { MoreHorizontal } from 'lucide-react';
3
3
  import { memo } from 'react';
4
4
 
5
5
  import { useTopicActionsDropdownMenu } from './useDropdownMenu';
6
6
 
7
7
  const Actions = memo(() => {
8
- const dropdownMenu = useTopicActionsDropdownMenu();
8
+ const menuItems = useTopicActionsDropdownMenu();
9
9
 
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={menuItems}>
21
12
  <ActionIcon icon={MoreHorizontal} size={'small'} />
22
- </Dropdown>
13
+ </DropdownMenu>
23
14
  );
24
15
  });
25
16
 
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { AccordionItem, Dropdown, Flexbox, Text } from '@lobehub/ui';
3
+ import { AccordionItem, ContextMenuTrigger, Flexbox, Text } from '@lobehub/ui';
4
4
  import React, { Suspense, memo } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
 
@@ -28,14 +28,7 @@ const Topic = memo<TopicProps>(({ itemKey }) => {
28
28
  <AccordionItem
29
29
  action={<Actions />}
30
30
  headerWrapper={(header) => (
31
- <Dropdown
32
- menu={{
33
- items: dropdownMenu,
34
- }}
35
- trigger={['contextMenu']}
36
- >
37
- {header}
38
- </Dropdown>
31
+ <ContextMenuTrigger items={dropdownMenu}>{header}</ContextMenuTrigger>
39
32
  )}
40
33
  itemKey={itemKey}
41
34
  paddingBlock={4}
@@ -58,8 +58,8 @@ const Conversation = memo<ConversationAreaProps>(({ mobile = false }) => {
58
58
  hasInitMessages={!!messages}
59
59
  // hooks={groupHooks}
60
60
  messages={messages}
61
- onMessagesChange={(messages) => {
62
- replaceMessages(messages, { context });
61
+ onMessagesChange={(messages, ctx) => {
62
+ replaceMessages(messages, { context: ctx });
63
63
  }}
64
64
  operationState={operationState}
65
65
  >
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { Dropdown, Icon, type MenuProps, Tag } from '@lobehub/ui';
4
- import { Flexbox } from '@lobehub/ui';
3
+ import { DropdownMenu, Flexbox, Icon, type MenuProps, Tag } from '@lobehub/ui';
5
4
  import { LibraryBig } from 'lucide-react';
6
5
  import { memo } from 'react';
7
6
 
@@ -25,7 +24,7 @@ const PluginTag = memo<PluginTagProps>(({ data }) => {
25
24
  const count = data.length;
26
25
 
27
26
  return (
28
- <Dropdown menu={{ items }}>
27
+ <DropdownMenu items={items}>
29
28
  <div>
30
29
  <Tag>
31
30
  {<Icon icon={LibraryBig} />}
@@ -35,7 +34,7 @@ const PluginTag = memo<PluginTagProps>(({ data }) => {
35
34
  {count > 1 && <div>({data.length - 1}+)</div>}
36
35
  </Tag>
37
36
  </div>
38
- </Dropdown>
37
+ </DropdownMenu>
39
38
  );
40
39
  });
41
40
 
@@ -47,8 +47,8 @@ const AgentBuilderProvider = memo<AgentBuilderProviderProps>(({ agentId, childre
47
47
  context={context}
48
48
  hasInitMessages={!!messages}
49
49
  messages={messages}
50
- onMessagesChange={(msgs) => {
51
- replaceMessages(msgs, { context });
50
+ onMessagesChange={(msgs, ctx) => {
51
+ replaceMessages(msgs, { context: ctx });
52
52
  }}
53
53
  operationState={operationState}
54
54
  >
@@ -1,5 +1,5 @@
1
1
  import type { API } from '@lobechat/prompts';
2
- import type { DropdownMenuItemType } from '@lobehub/ui';
2
+ import type { DropdownItem } from '@lobehub/ui';
3
3
 
4
4
  export type MentionEntityType = 'collection' | 'api';
5
5
 
@@ -14,7 +14,9 @@ export interface MentionMetadata {
14
14
  type?: MentionEntityType;
15
15
  }
16
16
 
17
- export type MentionListOption = DropdownMenuItemType & {
17
+ type MentionMenuItem = Extract<DropdownItem, { type?: 'item' }>;
18
+
19
+ export type MentionListOption = MentionMenuItem & {
18
20
  description?: string;
19
21
  metadata?: MentionMetadata;
20
22
  };