@lobehub/lobehub 2.0.0-next.298 → 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.
- package/CHANGELOG.md +33 -0
- package/changelog/v1.json +9 -0
- package/package.json +2 -2
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/Actions.tsx +4 -13
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/Actions.tsx +4 -13
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/index.tsx +2 -9
- package/src/app/[variants]/(main)/agent/features/Conversation/ConversationArea.tsx +2 -2
- package/src/app/[variants]/(main)/agent/features/Conversation/Header/Tags/KnowledgeTag.tsx +3 -4
- package/src/app/[variants]/(main)/agent/profile/features/ProfileEditor/MentionList/types.ts +4 -2
- package/src/app/[variants]/(main)/community/(detail)/model/features/Sidebar/ActionButton/ChatWithModel.tsx +3 -8
- package/src/app/[variants]/(main)/community/(list)/assistant/features/MarketSourceSwitch.tsx +44 -23
- package/src/app/[variants]/(main)/community/(list)/features/SortButton/index.tsx +40 -19
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/Actions.tsx +4 -13
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/index.tsx +2 -9
- package/src/app/[variants]/(main)/group/features/Conversation/ConversationArea.tsx +2 -2
- package/src/app/[variants]/(main)/group/features/Conversation/Header/Tags/KnowledgeTag.tsx +3 -4
- package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/AgentBuilderProvider.tsx +2 -2
- package/src/app/[variants]/(main)/group/profile/features/MemberProfile/MentionList/types.ts +4 -2
- package/src/app/[variants]/(main)/home/_layout/Body/Agent/Actions.tsx +3 -11
- package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/Group/Actions.tsx +3 -12
- package/src/app/[variants]/(main)/home/_layout/Body/Agent/List/Group/Item.tsx +2 -9
- package/src/app/[variants]/(main)/home/_layout/Body/Agent/index.tsx +2 -9
- package/src/app/[variants]/(main)/home/_layout/Body/Project/index.tsx +2 -9
- package/src/app/[variants]/(main)/home/features/CommunityAgents/index.tsx +11 -13
- package/src/app/[variants]/(main)/home/features/FeaturedPlugins/index.tsx +11 -13
- package/src/app/[variants]/(main)/home/features/RecentPage/index.tsx +12 -14
- package/src/app/[variants]/(main)/home/features/RecentResource/index.tsx +12 -14
- package/src/app/[variants]/(main)/memory/contexts/features/ContextDropdown.tsx +5 -3
- package/src/app/[variants]/(main)/memory/experiences/features/ExperienceDropdown.tsx +5 -3
- package/src/app/[variants]/(main)/memory/identities/features/IdentityDropdown.tsx +5 -3
- package/src/app/[variants]/(main)/memory/preferences/features/PreferenceDropdown.tsx +5 -3
- package/src/app/[variants]/(main)/page/_layout/Body/Actions.tsx +3 -13
- package/src/app/[variants]/(main)/page/_layout/Body/index.tsx +2 -9
- package/src/app/[variants]/(main)/resource/features/DndContextWrapper.tsx +1 -1
- package/src/app/[variants]/(main)/settings/profile/features/SSOProvidersList/index.tsx +3 -3
- package/src/app/[variants]/(main)/settings/provider/ProviderMenu/Actions.tsx +3 -11
- package/src/app/[variants]/(main)/settings/provider/ProviderMenu/List.tsx +12 -28
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/DisabledModels.tsx +7 -8
- package/src/app/[variants]/(main)/settings/provider/features/ModelList/ModelTitle/index.tsx +18 -20
- package/src/app/[variants]/(mobile)/(home)/features/SessionListContent/CollapseGroup/Actions.tsx +10 -14
- package/src/app/[variants]/(mobile)/(home)/features/SessionListContent/List/Item/Actions.tsx +3 -13
- package/src/app/[variants]/share/t/[id]/SharedMessageList.tsx +2 -2
- package/src/business/server/lambda-routers/file.ts +1 -1
- package/src/features/AgentBuilder/AgentBuilderProvider.tsx +2 -2
- package/src/features/ChatInput/ActionBar/History/index.tsx +1 -1
- package/src/features/ChatInput/ActionBar/STT/common.tsx +1 -1
- package/src/features/ChatInput/ActionBar/Search/index.tsx +1 -1
- package/src/features/ChatInput/ActionBar/Upload/ServerMode.tsx +1 -0
- package/src/features/ChatInput/ActionBar/components/Action.tsx +4 -8
- package/src/features/ChatInput/ActionBar/components/ActionDropdown.tsx +225 -37
- package/src/features/Conversation/ConversationProvider.tsx +2 -1
- package/src/features/Conversation/Messages/Assistant/Actions/index.tsx +10 -6
- package/src/features/Conversation/Messages/AssistantGroup/Actions/index.tsx +10 -6
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/ApprovalActions.tsx +11 -13
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Detail/Intervention/ModeSelector.tsx +8 -10
- package/src/features/Conversation/Messages/Supervisor/Actions/index.tsx +10 -6
- package/src/features/Conversation/Messages/Task/Actions/index.tsx +10 -6
- package/src/features/Conversation/Messages/User/Actions/index.tsx +10 -6
- package/src/features/Conversation/StoreUpdater.tsx +1 -1
- package/src/features/Conversation/store/initialState.ts +3 -1
- package/src/features/Conversation/store/slices/data/action.ts +6 -5
- package/src/features/LibraryModal/AssignKnowledgeBase/Item/Action.tsx +23 -26
- package/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsx +16 -18
- package/src/features/ModelSwitchPanel/styles.ts +18 -1
- package/src/features/PageEditor/Copilot/AgentSelector/Actions.tsx +6 -13
- package/src/features/PageEditor/PageAgentProvider.tsx +2 -2
- package/src/features/PluginStore/InstalledList/List/Item/Action.tsx +33 -36
- package/src/features/PluginStore/McpList/List/Action.tsx +25 -28
- package/src/features/PluginStore/PluginList/List/Action.tsx +25 -28
- package/src/features/PluginTag/index.tsx +3 -4
- package/src/features/Portal/Artifacts/Body/Renderer/SVG.tsx +14 -11
- package/src/features/Portal/Thread/Chat/index.tsx +2 -2
- package/src/features/ProfileEditor/AgentTool.tsx +1 -1
- package/src/features/ResourceManager/components/Explorer/ToolBar/SortDropdown.tsx +21 -18
- package/src/features/ResourceManager/components/Explorer/ToolBar/ViewSwitcher.tsx +7 -13
- package/src/features/ResourceManager/components/Header/AddButton.tsx +4 -11
- package/src/features/User/UserPanel/LangButton.tsx +56 -44
- package/src/layout/AuthProvider/MarketAuth/MarketAuthProvider.tsx +1 -1
- package/src/services/document/index.ts +11 -1
- package/src/store/page/slices/crud/action.ts +0 -48
- package/src/styles/global.ts +2 -2
- package/src/types/shim-lobe-ui.d.ts +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,39 @@
|
|
|
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
|
+
[](#readme-top)
|
|
35
|
+
|
|
36
|
+
</div>
|
|
37
|
+
|
|
5
38
|
## [Version 2.0.0-next.298](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.297...v2.0.0-next.298)
|
|
6
39
|
|
|
7
40
|
<sup>Released on **2026-01-16**</sup>
|
package/changelog/v1.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/lobehub",
|
|
3
|
-
"version": "2.0.0-next.
|
|
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.
|
|
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,
|
|
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
|
|
13
|
+
const menuItems = useCronJobDropdownMenu(cronJobId, topics);
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
|
-
<
|
|
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
|
-
</
|
|
18
|
+
</DropdownMenu>
|
|
28
19
|
);
|
|
29
20
|
});
|
|
30
21
|
|
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
import { ActionIcon,
|
|
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
|
|
8
|
+
const menuItems = useTopicActionsDropdownMenu();
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
|
-
<
|
|
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
|
-
</
|
|
13
|
+
</DropdownMenu>
|
|
23
14
|
);
|
|
24
15
|
});
|
|
25
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { AccordionItem,
|
|
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
|
-
<
|
|
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 {
|
|
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
|
-
<
|
|
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
|
-
</
|
|
37
|
+
</DropdownMenu>
|
|
39
38
|
);
|
|
40
39
|
});
|
|
41
40
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { API } from '@lobechat/prompts';
|
|
2
|
-
import type {
|
|
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
|
-
|
|
17
|
+
type MentionMenuItem = Extract<DropdownItem, { type?: 'item' }>;
|
|
18
|
+
|
|
19
|
+
export type MentionListOption = MentionMenuItem & {
|
|
18
20
|
description?: string;
|
|
19
21
|
metadata?: MentionMetadata;
|
|
20
22
|
};
|
|
@@ -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
|
-
<
|
|
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
|
-
</
|
|
81
|
+
</DropdownMenu>
|
|
87
82
|
);
|
|
88
83
|
});
|
|
89
84
|
|
package/src/app/[variants]/(main)/community/(list)/assistant/features/MarketSourceSwitch.tsx
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
<
|
|
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
|
-
</
|
|
78
|
+
</DropdownMenu>
|
|
58
79
|
);
|
|
59
80
|
});
|
|
60
81
|
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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
|
-
|
|
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
|
|
177
|
+
const activeItem = useMemo<SortItem | undefined>(() => {
|
|
168
178
|
if (sort) {
|
|
169
|
-
const findItem = items
|
|
179
|
+
const findItem = items.find((item) => String(item.key) === sort);
|
|
170
180
|
if (findItem) return findItem;
|
|
171
181
|
}
|
|
172
|
-
return items
|
|
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
|
-
|
|
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
|
-
<
|
|
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
|
|
224
|
+
{activeItem?.label ?? menuItems[0]?.label}
|
|
204
225
|
<Icon icon={ChevronDown} />
|
|
205
226
|
</Button>
|
|
206
|
-
</
|
|
227
|
+
</DropdownMenu>
|
|
207
228
|
);
|
|
208
229
|
});
|
|
209
230
|
|
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
import { ActionIcon,
|
|
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
|
|
8
|
+
const menuItems = useTopicActionsDropdownMenu();
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
|
-
<
|
|
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
|
-
</
|
|
13
|
+
</DropdownMenu>
|
|
23
14
|
);
|
|
24
15
|
});
|
|
25
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { AccordionItem,
|
|
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
|
-
<
|
|
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 {
|
|
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
|
-
<
|
|
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
|
-
</
|
|
37
|
+
</DropdownMenu>
|
|
39
38
|
);
|
|
40
39
|
});
|
|
41
40
|
|
package/src/app/[variants]/(main)/group/profile/features/AgentBuilder/AgentBuilderProvider.tsx
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
17
|
+
type MentionMenuItem = Extract<DropdownItem, { type?: 'item' }>;
|
|
18
|
+
|
|
19
|
+
export type MentionListOption = MentionMenuItem & {
|
|
18
20
|
description?: string;
|
|
19
21
|
metadata?: MentionMetadata;
|
|
20
22
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionIcon,
|
|
1
|
+
import { ActionIcon, DropdownMenu, type MenuProps } from '@lobehub/ui';
|
|
2
2
|
import { MoreHorizontalIcon } from 'lucide-react';
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
|
|
@@ -9,22 +9,14 @@ interface ActionsProps {
|
|
|
9
9
|
|
|
10
10
|
const Actions = memo<ActionsProps>(({ dropdownMenu, isLoading }) => {
|
|
11
11
|
return (
|
|
12
|
-
<
|
|
13
|
-
menu={{
|
|
14
|
-
items: dropdownMenu,
|
|
15
|
-
onClick: ({ domEvent }) => {
|
|
16
|
-
domEvent.stopPropagation();
|
|
17
|
-
},
|
|
18
|
-
}}
|
|
19
|
-
trigger={['click']}
|
|
20
|
-
>
|
|
12
|
+
<DropdownMenu items={dropdownMenu}>
|
|
21
13
|
<ActionIcon
|
|
22
14
|
icon={MoreHorizontalIcon}
|
|
23
15
|
loading={isLoading}
|
|
24
16
|
size={'small'}
|
|
25
17
|
style={{ flex: 'none' }}
|
|
26
18
|
/>
|
|
27
|
-
</
|
|
19
|
+
</DropdownMenu>
|
|
28
20
|
);
|
|
29
21
|
});
|
|
30
22
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionIcon,
|
|
1
|
+
import { ActionIcon, DropdownMenu, type MenuProps } from '@lobehub/ui';
|
|
2
2
|
import { MoreHorizontalIcon } from 'lucide-react';
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
|
|
@@ -9,16 +9,7 @@ interface ActionsProps {
|
|
|
9
9
|
|
|
10
10
|
const Actions = memo<ActionsProps>(({ dropdownMenu, isLoading }) => {
|
|
11
11
|
return (
|
|
12
|
-
<
|
|
13
|
-
arrow={false}
|
|
14
|
-
menu={{
|
|
15
|
-
items: dropdownMenu,
|
|
16
|
-
onClick: ({ domEvent }) => {
|
|
17
|
-
domEvent.stopPropagation();
|
|
18
|
-
},
|
|
19
|
-
}}
|
|
20
|
-
trigger={['click']}
|
|
21
|
-
>
|
|
12
|
+
<DropdownMenu items={dropdownMenu}>
|
|
22
13
|
<ActionIcon
|
|
23
14
|
icon={MoreHorizontalIcon}
|
|
24
15
|
loading={isLoading}
|
|
@@ -27,7 +18,7 @@ const Actions = memo<ActionsProps>(({ dropdownMenu, isLoading }) => {
|
|
|
27
18
|
}}
|
|
28
19
|
size={'small'}
|
|
29
20
|
/>
|
|
30
|
-
</
|
|
21
|
+
</DropdownMenu>
|
|
31
22
|
);
|
|
32
23
|
});
|
|
33
24
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SidebarGroup } from '@lobechat/types';
|
|
2
|
-
import { AccordionItem,
|
|
2
|
+
import { AccordionItem, ContextMenuTrigger, Flexbox, Icon, Text } from '@lobehub/ui';
|
|
3
3
|
import { createStaticStyles } from 'antd-style';
|
|
4
4
|
import { HashIcon, Loader2 } from 'lucide-react';
|
|
5
5
|
import React, { memo, useCallback, useMemo } from 'react';
|
|
@@ -61,14 +61,7 @@ const GroupItem = memo<SidebarGroup>(({ items, id, name }) => {
|
|
|
61
61
|
action={<Actions dropdownMenu={dropdownMenu} isLoading={isLoading} />}
|
|
62
62
|
disabled={editing || isUpdating}
|
|
63
63
|
headerWrapper={(header) => (
|
|
64
|
-
<
|
|
65
|
-
menu={{
|
|
66
|
-
items: dropdownMenu,
|
|
67
|
-
}}
|
|
68
|
-
trigger={['contextMenu']}
|
|
69
|
-
>
|
|
70
|
-
{header}
|
|
71
|
-
</Dropdown>
|
|
64
|
+
<ContextMenuTrigger items={dropdownMenu}>{header}</ContextMenuTrigger>
|
|
72
65
|
)}
|
|
73
66
|
itemKey={id}
|
|
74
67
|
key={id}
|