@lobehub/lobehub 2.0.0-next.306 → 2.0.0-next.308
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/.vscode/settings.json +18 -3
- package/CHANGELOG.md +61 -0
- package/changelog/v1.json +21 -0
- package/locales/ar/agentGroup.json +5 -0
- package/locales/ar/chat.json +26 -0
- package/locales/ar/models.json +43 -5
- package/locales/ar/plugin.json +4 -5
- package/locales/ar/setting.json +11 -0
- package/locales/ar/subscription.json +2 -0
- package/locales/ar/tool.json +2 -0
- package/locales/bg-BG/agentGroup.json +5 -0
- package/locales/bg-BG/chat.json +26 -0
- package/locales/bg-BG/models.json +49 -3
- package/locales/bg-BG/plugin.json +4 -5
- package/locales/bg-BG/setting.json +11 -0
- package/locales/bg-BG/subscription.json +2 -0
- package/locales/bg-BG/tool.json +2 -0
- package/locales/de-DE/agentGroup.json +5 -0
- package/locales/de-DE/chat.json +26 -0
- package/locales/de-DE/models.json +48 -5
- package/locales/de-DE/plugin.json +4 -5
- package/locales/de-DE/setting.json +11 -0
- package/locales/de-DE/subscription.json +2 -0
- package/locales/de-DE/tool.json +2 -0
- package/locales/en-US/models.json +8 -6
- package/locales/en-US/plugin.json +2 -4
- package/locales/en-US/setting.json +10 -11
- package/locales/en-US/tool.json +2 -0
- package/locales/es-ES/agentGroup.json +5 -0
- package/locales/es-ES/chat.json +26 -0
- package/locales/es-ES/models.json +43 -5
- package/locales/es-ES/plugin.json +4 -5
- package/locales/es-ES/setting.json +11 -0
- package/locales/es-ES/subscription.json +2 -0
- package/locales/es-ES/tool.json +2 -0
- package/locales/fa-IR/agentGroup.json +5 -0
- package/locales/fa-IR/chat.json +26 -0
- package/locales/fa-IR/models.json +42 -5
- package/locales/fa-IR/plugin.json +4 -5
- package/locales/fa-IR/setting.json +11 -0
- package/locales/fa-IR/subscription.json +2 -0
- package/locales/fa-IR/tool.json +2 -0
- package/locales/fr-FR/agentGroup.json +5 -0
- package/locales/fr-FR/chat.json +26 -0
- package/locales/fr-FR/models.json +5 -5
- package/locales/fr-FR/plugin.json +4 -5
- package/locales/fr-FR/setting.json +11 -0
- package/locales/fr-FR/subscription.json +2 -0
- package/locales/fr-FR/tool.json +2 -0
- package/locales/it-IT/agentGroup.json +5 -0
- package/locales/it-IT/chat.json +26 -0
- package/locales/it-IT/models.json +1 -3
- package/locales/it-IT/plugin.json +4 -5
- package/locales/it-IT/setting.json +11 -0
- package/locales/it-IT/subscription.json +2 -0
- package/locales/it-IT/tool.json +2 -0
- package/locales/ja-JP/agentGroup.json +5 -0
- package/locales/ja-JP/chat.json +26 -0
- package/locales/ja-JP/models.json +1 -5
- package/locales/ja-JP/plugin.json +4 -5
- package/locales/ja-JP/setting.json +11 -0
- package/locales/ja-JP/subscription.json +2 -0
- package/locales/ja-JP/tool.json +2 -0
- package/locales/ko-KR/agentGroup.json +5 -0
- package/locales/ko-KR/chat.json +26 -0
- package/locales/ko-KR/models.json +1 -3
- package/locales/ko-KR/plugin.json +4 -5
- package/locales/ko-KR/setting.json +11 -0
- package/locales/ko-KR/subscription.json +2 -0
- package/locales/ko-KR/tool.json +2 -0
- package/locales/nl-NL/agentGroup.json +5 -0
- package/locales/nl-NL/chat.json +26 -0
- package/locales/nl-NL/models.json +35 -3
- package/locales/nl-NL/plugin.json +4 -5
- package/locales/nl-NL/setting.json +11 -0
- package/locales/nl-NL/subscription.json +2 -0
- package/locales/nl-NL/tool.json +2 -0
- package/locales/pl-PL/agentGroup.json +5 -0
- package/locales/pl-PL/chat.json +26 -0
- package/locales/pl-PL/models.json +1 -3
- package/locales/pl-PL/plugin.json +4 -5
- package/locales/pl-PL/setting.json +11 -0
- package/locales/pl-PL/subscription.json +2 -0
- package/locales/pl-PL/tool.json +2 -0
- package/locales/pt-BR/agentGroup.json +5 -0
- package/locales/pt-BR/chat.json +26 -0
- package/locales/pt-BR/models.json +50 -5
- package/locales/pt-BR/plugin.json +4 -5
- package/locales/pt-BR/setting.json +11 -0
- package/locales/pt-BR/subscription.json +2 -0
- package/locales/pt-BR/tool.json +2 -0
- package/locales/ru-RU/agentGroup.json +5 -0
- package/locales/ru-RU/chat.json +26 -0
- package/locales/ru-RU/models.json +22 -3
- package/locales/ru-RU/plugin.json +4 -5
- package/locales/ru-RU/setting.json +11 -0
- package/locales/ru-RU/subscription.json +2 -0
- package/locales/ru-RU/tool.json +2 -0
- package/locales/tr-TR/agentGroup.json +5 -0
- package/locales/tr-TR/chat.json +26 -0
- package/locales/tr-TR/models.json +36 -3
- package/locales/tr-TR/plugin.json +4 -5
- package/locales/tr-TR/setting.json +11 -0
- package/locales/tr-TR/subscription.json +2 -0
- package/locales/tr-TR/tool.json +2 -0
- package/locales/vi-VN/agentGroup.json +5 -0
- package/locales/vi-VN/chat.json +26 -0
- package/locales/vi-VN/models.json +1 -1
- package/locales/vi-VN/plugin.json +4 -5
- package/locales/vi-VN/setting.json +11 -0
- package/locales/vi-VN/subscription.json +2 -0
- package/locales/vi-VN/tool.json +2 -0
- package/locales/zh-CN/models.json +52 -5
- package/locales/zh-CN/plugin.json +5 -7
- package/locales/zh-CN/setting.json +10 -11
- package/locales/zh-CN/tool.json +2 -2
- package/locales/zh-TW/agentGroup.json +5 -0
- package/locales/zh-TW/chat.json +26 -0
- package/locales/zh-TW/models.json +54 -5
- package/locales/zh-TW/plugin.json +4 -5
- package/locales/zh-TW/setting.json +11 -0
- package/locales/zh-TW/subscription.json +2 -0
- package/locales/zh-TW/tool.json +2 -0
- package/package.json +2 -2
- package/packages/builtin-agents/src/agents/group-supervisor/index.ts +1 -7
- package/packages/builtin-tool-group-agent-builder/src/ExecutionRuntime/index.ts +29 -0
- package/packages/builtin-tool-group-agent-builder/src/executor.ts +18 -0
- package/packages/builtin-tool-group-agent-builder/src/manifest.ts +17 -0
- package/packages/builtin-tool-group-agent-builder/src/types.ts +10 -0
- package/packages/builtin-tool-group-management/src/client/Inspector/ExecuteAgentTask/index.tsx +52 -8
- package/packages/builtin-tool-group-management/src/client/Render/ExecuteTask/index.tsx +2 -21
- package/packages/builtin-tool-group-management/src/executor.test.ts +6 -16
- package/packages/builtin-tool-group-management/src/executor.ts +8 -47
- package/packages/builtin-tool-group-management/src/manifest.ts +5 -18
- package/packages/builtin-tool-group-management/src/systemRole.ts +1 -8
- package/packages/builtin-tool-group-management/src/types.ts +2 -10
- package/packages/builtin-tool-local-system/src/ExecutionRuntime/index.ts +70 -31
- package/packages/builtin-tool-local-system/src/client/Render/WriteFile/index.tsx +48 -5
- package/packages/builtin-tool-local-system/src/client/Streaming/WriteFile/index.tsx +39 -0
- package/packages/builtin-tool-local-system/src/client/Streaming/index.ts +2 -0
- package/packages/builtin-tool-local-system/src/executor/index.ts +94 -60
- package/packages/database/src/repositories/agentGroup/index.ts +23 -0
- package/packages/model-bank/src/aiModels/qiniu.ts +24 -0
- package/packages/prompts/src/prompts/fileSystem/formatCommandOutput.test.ts +61 -0
- package/packages/prompts/src/prompts/fileSystem/formatCommandOutput.ts +21 -0
- package/packages/prompts/src/prompts/fileSystem/formatCommandResult.test.ts +87 -0
- package/packages/prompts/src/prompts/fileSystem/formatCommandResult.ts +35 -0
- package/packages/prompts/src/prompts/fileSystem/formatEditResult.test.ts +57 -0
- package/packages/prompts/src/prompts/fileSystem/formatEditResult.ts +17 -0
- package/packages/prompts/src/prompts/fileSystem/formatFileContent.test.ts +59 -0
- package/packages/prompts/src/prompts/fileSystem/formatFileContent.ts +14 -0
- package/packages/prompts/src/prompts/fileSystem/formatFileList.test.ts +62 -0
- package/packages/prompts/src/prompts/fileSystem/formatFileList.ts +13 -0
- package/packages/prompts/src/prompts/fileSystem/formatFileSearchResults.test.ts +34 -0
- package/packages/prompts/src/prompts/fileSystem/formatFileSearchResults.ts +12 -0
- package/packages/prompts/src/prompts/fileSystem/formatGlobResults.test.ts +64 -0
- package/packages/prompts/src/prompts/fileSystem/formatGlobResults.ts +23 -0
- package/packages/prompts/src/prompts/fileSystem/formatGrepResults.test.ts +85 -0
- package/packages/prompts/src/prompts/fileSystem/formatGrepResults.ts +24 -0
- package/packages/prompts/src/prompts/fileSystem/formatKillResult.test.ts +30 -0
- package/packages/prompts/src/prompts/fileSystem/formatKillResult.ts +9 -0
- package/packages/prompts/src/prompts/fileSystem/formatMoveResults.test.ts +37 -0
- package/packages/prompts/src/prompts/fileSystem/formatMoveResults.ts +20 -0
- package/packages/prompts/src/prompts/fileSystem/formatMultipleFiles.test.ts +54 -0
- package/packages/prompts/src/prompts/fileSystem/formatMultipleFiles.ts +9 -0
- package/packages/prompts/src/prompts/fileSystem/formatRenameResult.test.ts +35 -0
- package/packages/prompts/src/prompts/fileSystem/formatRenameResult.ts +17 -0
- package/packages/prompts/src/prompts/fileSystem/formatWriteResult.test.ts +30 -0
- package/packages/prompts/src/prompts/fileSystem/formatWriteResult.ts +11 -0
- package/packages/prompts/src/prompts/fileSystem/index.ts +13 -0
- package/packages/prompts/src/prompts/index.ts +1 -0
- package/src/app/[variants]/(auth)/_layout/index.tsx +0 -2
- package/src/app/[variants]/(auth)/layout.tsx +0 -2
- package/src/app/[variants]/(auth)/login/[[...login]]/page.tsx +1 -3
- package/src/app/[variants]/(auth)/signup/[[...signup]]/page.tsx +1 -3
- package/src/app/[variants]/(desktop)/desktop-onboarding/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/Actions.tsx +4 -3
- package/src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/useDropdownMenu.tsx +12 -2
- package/src/app/[variants]/(main)/agent/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/agent/features/Portal/index.tsx +0 -2
- package/src/app/[variants]/(main)/community/(detail)/group_agent/features/Sidebar/ActionButton/AddGroupAgent.tsx +69 -17
- package/src/app/[variants]/(main)/community/(list)/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/community/(list)/assistant/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/community/(list)/mcp/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/community/(list)/model/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/community/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/Actions.tsx +4 -3
- package/src/app/[variants]/(main)/group/_layout/Sidebar/Topic/useDropdownMenu.tsx +12 -2
- package/src/app/[variants]/(main)/group/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/group/features/Conversation/Header/index.tsx +4 -2
- package/src/app/[variants]/(main)/group/features/Portal/index.tsx +0 -2
- package/src/app/[variants]/(main)/home/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/home/index.tsx +0 -2
- package/src/app/[variants]/(main)/image/_layout/Topics/TopicUrlSync.tsx +0 -2
- package/src/app/[variants]/(main)/image/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/memory/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/page/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/resource/(home)/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/resource/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/resource/library/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/resource/library/features/Container.tsx +0 -2
- package/src/app/[variants]/(main)/settings/_layout/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/about/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/agent/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/apikey/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/chat-appearance/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/common/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/hotkey/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/image/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/memory/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/provider/(list)/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/proxy/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/security/index.tsx +1 -3
- package/src/app/[variants]/(main)/settings/storage/index.tsx +0 -2
- package/src/app/[variants]/(main)/settings/tts/index.tsx +0 -2
- package/src/app/[variants]/(mobile)/(home)/_layout/index.tsx +0 -2
- package/src/app/[variants]/(mobile)/_layout/index.tsx +1 -3
- package/src/app/[variants]/(mobile)/chat/_layout/index.tsx +0 -2
- package/src/app/[variants]/(mobile)/chat/settings/_layout/index.tsx +0 -2
- package/src/app/[variants]/(mobile)/community/(detail)/_layout/index.tsx +0 -2
- package/src/app/[variants]/(mobile)/community/(list)/_layout/index.tsx +0 -2
- package/src/app/[variants]/(mobile)/community/_layout/index.tsx +0 -2
- package/src/app/[variants]/(mobile)/router/MobileClientRouter.tsx +0 -2
- package/src/app/[variants]/(mobile)/settings/index.tsx +0 -2
- package/src/app/[variants]/onboarding/_layout/index.tsx +0 -2
- package/src/app/[variants]/router/DesktopClientRouter.tsx +0 -2
- package/src/components/ModelSelect/index.tsx +6 -56
- package/src/components/server/MobileNavLayout.tsx +0 -2
- package/src/components/server/ServerLayout.tsx +0 -2
- package/src/features/ChatInput/ActionBar/Upload/ServerMode.tsx +13 -3
- package/src/features/ChatInput/ActionBar/components/ActionDropdown.tsx +26 -3
- package/src/features/ModelSwitchPanel/components/Footer.tsx +0 -2
- package/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsx +0 -1
- package/src/features/ModelSwitchPanel/components/List/SingleProviderModelItem.tsx +0 -1
- package/src/features/ModelSwitchPanel/components/List/VirtualItemRenderer.tsx +0 -1
- package/src/features/ModelSwitchPanel/components/List/index.tsx +15 -13
- package/src/features/ModelSwitchPanel/components/PanelContent.tsx +0 -2
- package/src/features/ModelSwitchPanel/index.tsx +21 -23
- package/src/features/ResourceManager/components/Explorer/MasonryView/index.tsx +0 -2
- package/src/features/ResourceManager/components/Header/AddButton.tsx +20 -3
- package/src/features/User/UserAvatar.tsx +0 -2
- package/src/locales/default/plugin.ts +2 -1
- package/src/server/routers/lambda/__tests__/agentGroup.test.ts +1 -0
- package/src/server/routers/lambda/agentGroup.ts +22 -0
- package/src/services/chat/index.ts +1 -0
- package/src/services/chat/mecha/agentConfigResolver.test.ts +62 -45
- package/src/services/chat/mecha/agentConfigResolver.ts +29 -27
- package/src/services/chatGroup/index.ts +14 -0
- package/src/store/chat/agents/GroupOrchestration/__tests__/call-supervisor.test.ts +305 -0
- package/src/store/chat/agents/GroupOrchestration/createGroupOrchestrationExecutors.ts +2 -1
- package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +6 -2
- package/src/store/chat/slices/plugin/actions/exector.ts +92 -0
- package/src/store/chat/slices/plugin/actions/pluginTypes.ts +82 -177
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { Skeleton } from '@lobehub/ui';
|
|
4
|
-
import dynamic from '@/libs/next/dynamic';
|
|
5
4
|
import { useTranslation } from 'react-i18next';
|
|
6
5
|
import { Navigate } from 'react-router-dom';
|
|
7
6
|
|
|
8
7
|
import SettingHeader from '@/app/[variants]/(main)/settings/features/SettingHeader';
|
|
9
8
|
import { enableClerk } from '@/envs/auth';
|
|
9
|
+
import dynamic from '@/libs/next/dynamic';
|
|
10
10
|
|
|
11
11
|
const ClerkProfile = dynamic(() => import('./features/ClerkProfile'), {
|
|
12
12
|
loading: () => (
|
|
@@ -27,6 +27,4 @@ const Page = () => {
|
|
|
27
27
|
);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
Page.displayName = 'SecuritySetting';
|
|
31
|
-
|
|
32
30
|
export default Page;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import dynamic from '@/libs/next/dynamic';
|
|
4
3
|
import { type FC, Suspense } from 'react';
|
|
5
4
|
import { Outlet, useLocation } from 'react-router-dom';
|
|
6
5
|
|
|
7
6
|
import Loading from '@/components/Loading/BrandTextLoading';
|
|
8
7
|
import { MarketAuthProvider } from '@/layout/AuthProvider/MarketAuth';
|
|
8
|
+
import dynamic from '@/libs/next/dynamic';
|
|
9
9
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
10
10
|
import { NavigatorRegistrar } from '@/utils/router';
|
|
11
11
|
|
|
@@ -42,6 +42,4 @@ const MobileMainLayout: FC = () => {
|
|
|
42
42
|
);
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
MobileMainLayout.displayName = 'MobileMainLayout';
|
|
46
|
-
|
|
47
45
|
export default MobileMainLayout;
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from 'lucide-react';
|
|
15
15
|
import { type ModelAbilities } from 'model-bank';
|
|
16
16
|
import numeral from 'numeral';
|
|
17
|
-
import { CSSProperties, type ComponentProps, type FC, memo
|
|
17
|
+
import { CSSProperties, type ComponentProps, type FC, memo } from 'react';
|
|
18
18
|
import { useTranslation } from 'react-i18next';
|
|
19
19
|
|
|
20
20
|
import { type AiProviderSourceType } from '@/types/aiProvider';
|
|
@@ -65,13 +65,6 @@ interface ModelInfoTagsProps extends ModelAbilities {
|
|
|
65
65
|
isCustom?: boolean;
|
|
66
66
|
placement?: 'top' | 'right';
|
|
67
67
|
style?: CSSProperties;
|
|
68
|
-
/**
|
|
69
|
-
* Whether to render tooltip overlays for each tag.
|
|
70
|
-
* Disable this when rendering a large list (e.g. dropdown menus) to avoid mounting hundreds of Tooltip instances.
|
|
71
|
-
*
|
|
72
|
-
* When `false`, tags are rendered without any tooltip/title fallback by design.
|
|
73
|
-
*/
|
|
74
|
-
withTooltip?: boolean;
|
|
75
68
|
}
|
|
76
69
|
|
|
77
70
|
interface FeatureTagsProps extends Pick<
|
|
@@ -80,7 +73,6 @@ interface FeatureTagsProps extends Pick<
|
|
|
80
73
|
> {
|
|
81
74
|
placement: 'top' | 'right';
|
|
82
75
|
tagClassName: string;
|
|
83
|
-
withTooltip: boolean;
|
|
84
76
|
}
|
|
85
77
|
|
|
86
78
|
interface FeatureTagItemProps {
|
|
@@ -91,11 +83,10 @@ interface FeatureTagItemProps {
|
|
|
91
83
|
placement: 'top' | 'right';
|
|
92
84
|
title: string;
|
|
93
85
|
tooltipStyles?: ComponentProps<typeof Tooltip>['styles'];
|
|
94
|
-
withTooltip: boolean;
|
|
95
86
|
}
|
|
96
87
|
|
|
97
88
|
const FeatureTagItem = memo<FeatureTagItemProps>(
|
|
98
|
-
({ className, color, enabled, icon, placement, title, tooltipStyles
|
|
89
|
+
({ className, color, enabled, icon, placement, title, tooltipStyles }) => {
|
|
99
90
|
if (!enabled) return null;
|
|
100
91
|
|
|
101
92
|
const tag = (
|
|
@@ -104,8 +95,6 @@ const FeatureTagItem = memo<FeatureTagItemProps>(
|
|
|
104
95
|
</Tag>
|
|
105
96
|
);
|
|
106
97
|
|
|
107
|
-
if (!withTooltip) return tag;
|
|
108
|
-
|
|
109
98
|
return (
|
|
110
99
|
<Tooltip placement={placement} styles={tooltipStyles ?? DEFAULT_TOOLTIP_STYLES} title={title}>
|
|
111
100
|
{tag}
|
|
@@ -125,7 +114,6 @@ const FeatureTags = memo<FeatureTagsProps>(
|
|
|
125
114
|
tagClassName,
|
|
126
115
|
video,
|
|
127
116
|
vision,
|
|
128
|
-
withTooltip,
|
|
129
117
|
}) => {
|
|
130
118
|
const { t } = useTranslation('components');
|
|
131
119
|
|
|
@@ -138,7 +126,6 @@ const FeatureTags = memo<FeatureTagsProps>(
|
|
|
138
126
|
icon={LucidePaperclip}
|
|
139
127
|
placement={placement}
|
|
140
128
|
title={t('ModelSelect.featureTag.file')}
|
|
141
|
-
withTooltip={withTooltip}
|
|
142
129
|
/>
|
|
143
130
|
<FeatureTagItem
|
|
144
131
|
className={tagClassName}
|
|
@@ -147,7 +134,6 @@ const FeatureTags = memo<FeatureTagsProps>(
|
|
|
147
134
|
icon={LucideImage}
|
|
148
135
|
placement={placement}
|
|
149
136
|
title={t('ModelSelect.featureTag.imageOutput')}
|
|
150
|
-
withTooltip={withTooltip}
|
|
151
137
|
/>
|
|
152
138
|
<FeatureTagItem
|
|
153
139
|
className={tagClassName}
|
|
@@ -156,7 +142,6 @@ const FeatureTags = memo<FeatureTagsProps>(
|
|
|
156
142
|
icon={LucideEye}
|
|
157
143
|
placement={placement}
|
|
158
144
|
title={t('ModelSelect.featureTag.vision')}
|
|
159
|
-
withTooltip={withTooltip}
|
|
160
145
|
/>
|
|
161
146
|
<FeatureTagItem
|
|
162
147
|
className={tagClassName}
|
|
@@ -165,7 +150,6 @@ const FeatureTags = memo<FeatureTagsProps>(
|
|
|
165
150
|
icon={Video}
|
|
166
151
|
placement={placement}
|
|
167
152
|
title={t('ModelSelect.featureTag.video')}
|
|
168
|
-
withTooltip={withTooltip}
|
|
169
153
|
/>
|
|
170
154
|
<FeatureTagItem
|
|
171
155
|
className={tagClassName}
|
|
@@ -175,7 +159,6 @@ const FeatureTags = memo<FeatureTagsProps>(
|
|
|
175
159
|
placement={placement}
|
|
176
160
|
title={t('ModelSelect.featureTag.functionCall')}
|
|
177
161
|
tooltipStyles={FUNCTION_CALL_TOOLTIP_STYLES}
|
|
178
|
-
withTooltip={withTooltip}
|
|
179
162
|
/>
|
|
180
163
|
<FeatureTagItem
|
|
181
164
|
className={tagClassName}
|
|
@@ -184,7 +167,6 @@ const FeatureTags = memo<FeatureTagsProps>(
|
|
|
184
167
|
icon={AtomIcon}
|
|
185
168
|
placement={placement}
|
|
186
169
|
title={t('ModelSelect.featureTag.reasoning')}
|
|
187
|
-
withTooltip={withTooltip}
|
|
188
170
|
/>
|
|
189
171
|
<FeatureTagItem
|
|
190
172
|
className={tagClassName}
|
|
@@ -193,7 +175,6 @@ const FeatureTags = memo<FeatureTagsProps>(
|
|
|
193
175
|
icon={LucideGlobe}
|
|
194
176
|
placement={placement}
|
|
195
177
|
title={t('ModelSelect.featureTag.search')}
|
|
196
|
-
withTooltip={withTooltip}
|
|
197
178
|
/>
|
|
198
179
|
</>
|
|
199
180
|
);
|
|
@@ -203,14 +184,12 @@ const FeatureTags = memo<FeatureTagsProps>(
|
|
|
203
184
|
const Context = memo(
|
|
204
185
|
({
|
|
205
186
|
contextWindowTokens,
|
|
206
|
-
withTooltip,
|
|
207
187
|
placement,
|
|
208
188
|
styles,
|
|
209
189
|
}: {
|
|
210
190
|
contextWindowTokens: number;
|
|
211
191
|
placement: 'top' | 'right';
|
|
212
192
|
styles: TooltipStyles;
|
|
213
|
-
withTooltip: boolean;
|
|
214
193
|
}) => {
|
|
215
194
|
const { t } = useTranslation('components');
|
|
216
195
|
const tokensText = contextWindowTokens === 0 ? '∞' : formatTokenNumber(contextWindowTokens);
|
|
@@ -221,8 +200,6 @@ const Context = memo(
|
|
|
221
200
|
</Tag>
|
|
222
201
|
);
|
|
223
202
|
|
|
224
|
-
if (!withTooltip) return tag;
|
|
225
|
-
|
|
226
203
|
return (
|
|
227
204
|
<Tooltip
|
|
228
205
|
placement={placement}
|
|
@@ -238,7 +215,7 @@ const Context = memo(
|
|
|
238
215
|
);
|
|
239
216
|
|
|
240
217
|
export const ModelInfoTags = memo<ModelInfoTagsProps>(
|
|
241
|
-
({ directionReverse, placement = 'top',
|
|
218
|
+
({ directionReverse, placement = 'top', style, ...model }) => {
|
|
242
219
|
return (
|
|
243
220
|
<Flexbox
|
|
244
221
|
className={TAG_CLASSNAME}
|
|
@@ -257,14 +234,12 @@ export const ModelInfoTags = memo<ModelInfoTagsProps>(
|
|
|
257
234
|
tagClassName={styles.tag}
|
|
258
235
|
video={model.video}
|
|
259
236
|
vision={model.vision}
|
|
260
|
-
withTooltip={withTooltip}
|
|
261
237
|
/>
|
|
262
238
|
{typeof model.contextWindowTokens === 'number' && (
|
|
263
239
|
<Context
|
|
264
240
|
contextWindowTokens={model.contextWindowTokens}
|
|
265
241
|
placement={placement}
|
|
266
242
|
styles={styles}
|
|
267
|
-
withTooltip={withTooltip}
|
|
268
243
|
/>
|
|
269
244
|
)}
|
|
270
245
|
</Flexbox>
|
|
@@ -274,15 +249,6 @@ export const ModelInfoTags = memo<ModelInfoTagsProps>(
|
|
|
274
249
|
|
|
275
250
|
interface ModelItemRenderProps extends ChatModelCard, Partial<Omit<FlexboxProps, 'id' | 'title'>> {
|
|
276
251
|
abilities?: ModelAbilities;
|
|
277
|
-
infoTagTooltip?: boolean;
|
|
278
|
-
/**
|
|
279
|
-
* Only mounts Tooltip components while hovering the item, to reduce initial render cost in large dropdown lists.
|
|
280
|
-
*
|
|
281
|
-
* Note: hover is not available on mobile, so this will be ignored on mobile.
|
|
282
|
-
* Also note: since tooltips are mounted lazily, the very first hover may require a tiny pointer movement
|
|
283
|
-
* before the tooltip system detects the hover target (depends on the underlying tooltip implementation).
|
|
284
|
-
*/
|
|
285
|
-
infoTagTooltipOnHover?: boolean;
|
|
286
252
|
newBadgeLabel?: string;
|
|
287
253
|
showInfoTag?: boolean;
|
|
288
254
|
}
|
|
@@ -291,8 +257,6 @@ export const ModelItemRender = memo<ModelItemRenderProps>(
|
|
|
291
257
|
({
|
|
292
258
|
showInfoTag = true,
|
|
293
259
|
abilities,
|
|
294
|
-
infoTagTooltip = true,
|
|
295
|
-
infoTagTooltipOnHover = false,
|
|
296
260
|
contextWindowTokens,
|
|
297
261
|
files,
|
|
298
262
|
functionCall,
|
|
@@ -308,14 +272,6 @@ export const ModelItemRender = memo<ModelItemRenderProps>(
|
|
|
308
272
|
...rest
|
|
309
273
|
}) => {
|
|
310
274
|
const { mobile } = useResponsive();
|
|
311
|
-
const [hovered, setHovered] = useState(false);
|
|
312
|
-
|
|
313
|
-
const shouldLazyMountTooltip = infoTagTooltipOnHover && !mobile;
|
|
314
|
-
/**
|
|
315
|
-
* When `infoTagTooltipOnHover` is enabled, we don't mount Tooltip components until the row is hovered.
|
|
316
|
-
* This avoids creating many overlays on dropdown open, while keeping the tooltip UX on demand.
|
|
317
|
-
*/
|
|
318
|
-
const withTooltip = infoTagTooltip && (!shouldLazyMountTooltip || hovered);
|
|
319
275
|
const displayNameOrId = displayName || id;
|
|
320
276
|
|
|
321
277
|
return (
|
|
@@ -324,7 +280,6 @@ export const ModelItemRender = memo<ModelItemRenderProps>(
|
|
|
324
280
|
gap={32}
|
|
325
281
|
horizontal
|
|
326
282
|
justify={'space-between'}
|
|
327
|
-
onMouseEnter={shouldLazyMountTooltip && !hovered ? () => setHovered(true) : undefined}
|
|
328
283
|
{...rest}
|
|
329
284
|
style={{
|
|
330
285
|
overflow: 'hidden',
|
|
@@ -341,13 +296,9 @@ export const ModelItemRender = memo<ModelItemRenderProps>(
|
|
|
341
296
|
>
|
|
342
297
|
<ModelIcon model={id} size={20} />
|
|
343
298
|
<Text
|
|
344
|
-
ellipsis={
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
tooltip: displayNameOrId,
|
|
348
|
-
}
|
|
349
|
-
: true
|
|
350
|
-
}
|
|
299
|
+
ellipsis={{
|
|
300
|
+
tooltip: displayNameOrId,
|
|
301
|
+
}}
|
|
351
302
|
style={mobile ? { maxWidth: '60vw' } : { minWidth: 0, overflow: 'hidden' }}
|
|
352
303
|
>
|
|
353
304
|
{displayNameOrId}
|
|
@@ -369,7 +320,6 @@ export const ModelItemRender = memo<ModelItemRenderProps>(
|
|
|
369
320
|
style={{ zoom: 0.9 }}
|
|
370
321
|
video={video ?? abilities?.video}
|
|
371
322
|
vision={vision ?? abilities?.vision}
|
|
372
|
-
withTooltip={withTooltip}
|
|
373
323
|
/>
|
|
374
324
|
)}
|
|
375
325
|
</Flexbox>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { validateVideoFileSize } from '@lobechat/utils/client';
|
|
2
|
-
import { Icon, type ItemType,
|
|
2
|
+
import { Icon, type ItemType, Tooltip } from '@lobehub/ui';
|
|
3
3
|
import { Upload } from 'antd';
|
|
4
4
|
import { css, cx } from 'antd-style';
|
|
5
5
|
import isEqual from 'fast-deep-equal';
|
|
@@ -21,6 +21,7 @@ import { preferenceSelectors } from '@/store/user/selectors';
|
|
|
21
21
|
|
|
22
22
|
import { useAgentId } from '../../hooks/useAgentId';
|
|
23
23
|
import Action from '../components/Action';
|
|
24
|
+
import type { ActionDropdownMenuItems } from '../components/ActionDropdown';
|
|
24
25
|
import CheckboxItem from '../components/CheckboxWithLoading';
|
|
25
26
|
|
|
26
27
|
const hotArea = css`
|
|
@@ -48,6 +49,7 @@ const FileUpload = memo(() => {
|
|
|
48
49
|
s.updateGuideState,
|
|
49
50
|
]);
|
|
50
51
|
const [modalOpen, setModalOpen] = useState(false);
|
|
52
|
+
const [dropdownOpen, setDropdownOpen] = useState(false);
|
|
51
53
|
const [updating, setUpdating] = useState(false);
|
|
52
54
|
|
|
53
55
|
const files = useAgentStore((s) => agentByIdSelectors.getAgentFilesById(agentId)(s), isEqual);
|
|
@@ -61,8 +63,9 @@ const FileUpload = memo(() => {
|
|
|
61
63
|
s.toggleKnowledgeBase,
|
|
62
64
|
]);
|
|
63
65
|
|
|
64
|
-
const uploadItems:
|
|
66
|
+
const uploadItems: ActionDropdownMenuItems = [
|
|
65
67
|
{
|
|
68
|
+
closeOnClick: false,
|
|
66
69
|
disabled: !canUploadImage,
|
|
67
70
|
icon: ImageUp,
|
|
68
71
|
key: 'upload-image',
|
|
@@ -70,6 +73,7 @@ const FileUpload = memo(() => {
|
|
|
70
73
|
<Upload
|
|
71
74
|
accept={'image/*'}
|
|
72
75
|
beforeUpload={async (file) => {
|
|
76
|
+
setDropdownOpen(false);
|
|
73
77
|
await upload([file]);
|
|
74
78
|
|
|
75
79
|
return false;
|
|
@@ -86,6 +90,7 @@ const FileUpload = memo(() => {
|
|
|
86
90
|
),
|
|
87
91
|
},
|
|
88
92
|
{
|
|
93
|
+
closeOnClick: false,
|
|
89
94
|
icon: FileUp,
|
|
90
95
|
key: 'upload-file',
|
|
91
96
|
label: (
|
|
@@ -105,6 +110,7 @@ const FileUpload = memo(() => {
|
|
|
105
110
|
return false;
|
|
106
111
|
}
|
|
107
112
|
|
|
113
|
+
setDropdownOpen(false);
|
|
108
114
|
await upload([file]);
|
|
109
115
|
|
|
110
116
|
return false;
|
|
@@ -117,6 +123,7 @@ const FileUpload = memo(() => {
|
|
|
117
123
|
),
|
|
118
124
|
},
|
|
119
125
|
{
|
|
126
|
+
closeOnClick: false,
|
|
120
127
|
icon: FolderUp,
|
|
121
128
|
key: 'upload-folder',
|
|
122
129
|
label: (
|
|
@@ -136,6 +143,7 @@ const FileUpload = memo(() => {
|
|
|
136
143
|
return false;
|
|
137
144
|
}
|
|
138
145
|
|
|
146
|
+
setDropdownOpen(false);
|
|
139
147
|
await upload([file]);
|
|
140
148
|
|
|
141
149
|
return false;
|
|
@@ -214,7 +222,7 @@ const FileUpload = memo(() => {
|
|
|
214
222
|
},
|
|
215
223
|
);
|
|
216
224
|
|
|
217
|
-
const items:
|
|
225
|
+
const items: ActionDropdownMenuItems = [
|
|
218
226
|
...uploadItems,
|
|
219
227
|
...(knowledgeItems.length > 0 ? knowledgeItems : []),
|
|
220
228
|
];
|
|
@@ -229,6 +237,8 @@ const FileUpload = memo(() => {
|
|
|
229
237
|
}}
|
|
230
238
|
icon={Paperclip}
|
|
231
239
|
loading={updating}
|
|
240
|
+
onOpenChange={setDropdownOpen}
|
|
241
|
+
open={dropdownOpen}
|
|
232
242
|
showTooltip={false}
|
|
233
243
|
title={t('upload.action.tooltip')}
|
|
234
244
|
trigger={'both'}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
type DropdownMenuProps,
|
|
9
9
|
DropdownMenuRoot,
|
|
10
10
|
DropdownMenuTrigger,
|
|
11
|
+
type MenuItemType,
|
|
11
12
|
type MenuProps,
|
|
12
13
|
type PopoverTrigger,
|
|
13
14
|
renderDropdownMenuItems,
|
|
@@ -16,6 +17,7 @@ import { createStaticStyles, cx } from 'antd-style';
|
|
|
16
17
|
import {
|
|
17
18
|
type CSSProperties,
|
|
18
19
|
type ReactNode,
|
|
20
|
+
isValidElement,
|
|
19
21
|
memo,
|
|
20
22
|
useCallback,
|
|
21
23
|
useEffect,
|
|
@@ -34,8 +36,15 @@ const styles = createStaticStyles(({ css }) => ({
|
|
|
34
36
|
`,
|
|
35
37
|
}));
|
|
36
38
|
|
|
37
|
-
type
|
|
38
|
-
|
|
39
|
+
export type ActionDropdownMenuItem = MenuItemType;
|
|
40
|
+
|
|
41
|
+
export type ActionDropdownMenuItems = MenuProps<ActionDropdownMenuItem>['items'];
|
|
42
|
+
|
|
43
|
+
type ActionDropdownMenu = Omit<
|
|
44
|
+
Pick<MenuProps<ActionDropdownMenuItem>, 'className' | 'onClick' | 'style'>,
|
|
45
|
+
'items'
|
|
46
|
+
> & {
|
|
47
|
+
items: ActionDropdownMenuItems | (() => ActionDropdownMenuItems);
|
|
39
48
|
};
|
|
40
49
|
|
|
41
50
|
export interface ActionDropdownProps extends Omit<DropdownMenuProps, 'items'> {
|
|
@@ -116,7 +125,7 @@ const ActionDropdown = memo<ActionDropdownProps>(
|
|
|
116
125
|
}, [openOnHover, triggerProps]);
|
|
117
126
|
|
|
118
127
|
const decorateMenuItems = useCallback(
|
|
119
|
-
(items:
|
|
128
|
+
(items: ActionDropdownMenuItems): ActionDropdownMenuItems => {
|
|
120
129
|
if (!items) return items;
|
|
121
130
|
|
|
122
131
|
return items.map((item) => {
|
|
@@ -136,10 +145,24 @@ const ActionDropdown = memo<ActionDropdownProps>(
|
|
|
136
145
|
};
|
|
137
146
|
}
|
|
138
147
|
const itemOnClick = 'onClick' in item ? item.onClick : undefined;
|
|
148
|
+
const closeOnClick = 'closeOnClick' in item ? item.closeOnClick : undefined;
|
|
149
|
+
const keepOpenOnClick = closeOnClick === false;
|
|
150
|
+
const itemLabel = 'label' in item ? item.label : undefined;
|
|
151
|
+
const shouldKeepOpen = isValidElement(itemLabel);
|
|
152
|
+
|
|
153
|
+
const resolvedCloseOnClick = closeOnClick ?? (shouldKeepOpen ? false : undefined);
|
|
139
154
|
|
|
140
155
|
return {
|
|
141
156
|
...item,
|
|
157
|
+
...(resolvedCloseOnClick !== undefined ? { closeOnClick: resolvedCloseOnClick } : null),
|
|
142
158
|
onClick: (info) => {
|
|
159
|
+
if (keepOpenOnClick) {
|
|
160
|
+
info.domEvent.stopPropagation();
|
|
161
|
+
menu.onClick?.(info);
|
|
162
|
+
itemOnClick?.(info);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
143
166
|
info.domEvent.preventDefault();
|
|
144
167
|
menu.onClick?.(info);
|
|
145
168
|
itemOnClick?.(info);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Flexbox } from '@lobehub/ui';
|
|
1
|
+
import { Flexbox, TooltipGroup } from '@lobehub/ui';
|
|
2
2
|
import type { FC } from 'react';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
@@ -82,18 +82,20 @@ export const List: FC<ListProps> = ({
|
|
|
82
82
|
paddingBlock: groupMode === 'byModel' ? 8 : 0,
|
|
83
83
|
}}
|
|
84
84
|
>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
item
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
85
|
+
<TooltipGroup>
|
|
86
|
+
{virtualItems
|
|
87
|
+
.slice(0, renderAll ? virtualItems.length : INITIAL_RENDER_COUNT)
|
|
88
|
+
.map((item) => (
|
|
89
|
+
<VirtualItemRenderer
|
|
90
|
+
activeKey={activeKey}
|
|
91
|
+
item={item}
|
|
92
|
+
key={getVirtualItemKey(item)}
|
|
93
|
+
newLabel={newLabel}
|
|
94
|
+
onClose={handleClose}
|
|
95
|
+
onModelChange={handleModelChange}
|
|
96
|
+
/>
|
|
97
|
+
))}
|
|
98
|
+
</TooltipGroup>
|
|
95
99
|
</Flexbox>
|
|
96
100
|
);
|
|
97
101
|
};
|
|
98
|
-
|
|
99
|
-
List.displayName = 'List';
|