@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
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { formatRenameResult } from './formatRenameResult';
|
|
4
|
+
|
|
5
|
+
describe('formatRenameResult', () => {
|
|
6
|
+
it('should format successful rename', () => {
|
|
7
|
+
const result = formatRenameResult({
|
|
8
|
+
newName: 'newFile.ts',
|
|
9
|
+
oldPath: '/src/oldFile.ts',
|
|
10
|
+
success: true,
|
|
11
|
+
});
|
|
12
|
+
expect(result).toMatchInlineSnapshot(
|
|
13
|
+
`"Successfully renamed file /src/oldFile.ts to newFile.ts"`,
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should format failed rename', () => {
|
|
18
|
+
const result = formatRenameResult({
|
|
19
|
+
error: 'File already exists',
|
|
20
|
+
newName: 'existing.ts',
|
|
21
|
+
oldPath: '/src/file.ts',
|
|
22
|
+
success: false,
|
|
23
|
+
});
|
|
24
|
+
expect(result).toMatchInlineSnapshot(`"Failed to rename file: File already exists"`);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should format failed rename without error message', () => {
|
|
28
|
+
const result = formatRenameResult({
|
|
29
|
+
newName: 'newName.ts',
|
|
30
|
+
oldPath: '/src/file.ts',
|
|
31
|
+
success: false,
|
|
32
|
+
});
|
|
33
|
+
expect(result).toMatchInlineSnapshot(`"Failed to rename file: undefined"`);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface FormatRenameResultParams {
|
|
2
|
+
error?: string;
|
|
3
|
+
newName: string;
|
|
4
|
+
oldPath: string;
|
|
5
|
+
success: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const formatRenameResult = ({
|
|
9
|
+
success,
|
|
10
|
+
oldPath,
|
|
11
|
+
newName,
|
|
12
|
+
error,
|
|
13
|
+
}: FormatRenameResultParams): string => {
|
|
14
|
+
return success
|
|
15
|
+
? `Successfully renamed file ${oldPath} to ${newName}`
|
|
16
|
+
: `Failed to rename file: ${error}`;
|
|
17
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { formatWriteResult } from './formatWriteResult';
|
|
4
|
+
|
|
5
|
+
describe('formatWriteResult', () => {
|
|
6
|
+
it('should format successful write', () => {
|
|
7
|
+
const result = formatWriteResult({
|
|
8
|
+
path: '/src/newFile.ts',
|
|
9
|
+
success: true,
|
|
10
|
+
});
|
|
11
|
+
expect(result).toMatchInlineSnapshot(`"Successfully wrote to /src/newFile.ts"`);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should format failed write with error', () => {
|
|
15
|
+
const result = formatWriteResult({
|
|
16
|
+
error: 'Permission denied',
|
|
17
|
+
path: '/protected/file.ts',
|
|
18
|
+
success: false,
|
|
19
|
+
});
|
|
20
|
+
expect(result).toMatchInlineSnapshot(`"Failed to write file: Permission denied"`);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should format failed write without error message', () => {
|
|
24
|
+
const result = formatWriteResult({
|
|
25
|
+
path: '/some/path.ts',
|
|
26
|
+
success: false,
|
|
27
|
+
});
|
|
28
|
+
expect(result).toMatchInlineSnapshot(`"Failed to write file: Unknown error"`);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface FormatWriteResultParams {
|
|
2
|
+
error?: string;
|
|
3
|
+
path: string;
|
|
4
|
+
success: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const formatWriteResult = ({ success, path, error }: FormatWriteResultParams): string => {
|
|
8
|
+
return success
|
|
9
|
+
? `Successfully wrote to ${path}`
|
|
10
|
+
: `Failed to write file: ${error || 'Unknown error'}`;
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './formatCommandOutput';
|
|
2
|
+
export * from './formatCommandResult';
|
|
3
|
+
export * from './formatEditResult';
|
|
4
|
+
export * from './formatFileContent';
|
|
5
|
+
export * from './formatFileList';
|
|
6
|
+
export * from './formatFileSearchResults';
|
|
7
|
+
export * from './formatGlobResults';
|
|
8
|
+
export * from './formatGrepResults';
|
|
9
|
+
export * from './formatKillResult';
|
|
10
|
+
export * from './formatMoveResults';
|
|
11
|
+
export * from './formatMultipleFiles';
|
|
12
|
+
export * from './formatRenameResult';
|
|
13
|
+
export * from './formatWriteResult';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SignIn } from '@clerk/nextjs';
|
|
2
2
|
import { BRANDING_NAME } from '@lobechat/business-const';
|
|
3
|
-
import { notFound } from '@/libs/next/navigation';
|
|
4
3
|
|
|
5
4
|
import { enableClerk } from '@/envs/auth';
|
|
5
|
+
import { notFound } from '@/libs/next/navigation';
|
|
6
6
|
import { metadataModule } from '@/server/metadata';
|
|
7
7
|
import { translation } from '@/server/translation';
|
|
8
8
|
import { type DynamicLayoutProps } from '@/types/next';
|
|
@@ -24,6 +24,4 @@ const Page = () => {
|
|
|
24
24
|
return <SignIn path="/login" />;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
Page.displayName = 'Login';
|
|
28
|
-
|
|
29
27
|
export default Page;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SignUp } from '@clerk/nextjs';
|
|
2
|
-
import { notFound } from '@/libs/next/navigation';
|
|
3
2
|
|
|
4
3
|
import { enableBetterAuth, enableClerk } from '@/envs/auth';
|
|
4
|
+
import { notFound } from '@/libs/next/navigation';
|
|
5
5
|
import { metadataModule } from '@/server/metadata';
|
|
6
6
|
import { translation } from '@/server/translation';
|
|
7
7
|
import { type DynamicLayoutProps } from '@/types/next';
|
|
@@ -48,6 +48,4 @@ const Page = () => {
|
|
|
48
48
|
return notFound();
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
Page.displayName = 'SignUp';
|
|
52
|
-
|
|
53
51
|
export default Page;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { ActionIcon, DropdownMenu } from '@lobehub/ui';
|
|
2
2
|
import { MoreHorizontal } from 'lucide-react';
|
|
3
|
-
import { memo } from 'react';
|
|
3
|
+
import { memo, useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import { useTopicActionsDropdownMenu } from './useDropdownMenu';
|
|
6
6
|
|
|
7
7
|
const Actions = memo(() => {
|
|
8
|
-
const
|
|
8
|
+
const [open, setOpen] = useState(false);
|
|
9
|
+
const menuItems = useTopicActionsDropdownMenu({ onUploadClose: () => setOpen(false) });
|
|
9
10
|
|
|
10
11
|
return (
|
|
11
|
-
<DropdownMenu items={menuItems}>
|
|
12
|
+
<DropdownMenu items={menuItems} onOpenChange={setOpen} open={open}>
|
|
12
13
|
<ActionIcon icon={MoreHorizontal} size={'small'} />
|
|
13
14
|
</DropdownMenu>
|
|
14
15
|
);
|
|
@@ -21,9 +21,16 @@ const hotArea = css`
|
|
|
21
21
|
}
|
|
22
22
|
`;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
interface UseTopicActionsDropdownMenuOptions {
|
|
25
|
+
onUploadClose?: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const useTopicActionsDropdownMenu = (
|
|
29
|
+
options: UseTopicActionsDropdownMenuOptions = {},
|
|
30
|
+
): MenuProps['items'] => {
|
|
25
31
|
const { t } = useTranslation(['topic', 'common']);
|
|
26
32
|
const { modal } = App.useApp();
|
|
33
|
+
const { onUploadClose } = options;
|
|
27
34
|
|
|
28
35
|
const [removeUnstarredTopic, removeAllTopic, importTopic] = useChatStore((s) => [
|
|
29
36
|
s.removeUnstarredTopic,
|
|
@@ -33,6 +40,7 @@ export const useTopicActionsDropdownMenu = (): MenuProps['items'] => {
|
|
|
33
40
|
|
|
34
41
|
const handleImport = useCallback(
|
|
35
42
|
async (file: File) => {
|
|
43
|
+
onUploadClose?.();
|
|
36
44
|
try {
|
|
37
45
|
const text = await file.text();
|
|
38
46
|
// Validate JSON format
|
|
@@ -46,7 +54,7 @@ export const useTopicActionsDropdownMenu = (): MenuProps['items'] => {
|
|
|
46
54
|
}
|
|
47
55
|
return false; // Prevent default upload behavior
|
|
48
56
|
},
|
|
49
|
-
[importTopic, modal, t],
|
|
57
|
+
[importTopic, modal, onUploadClose, t],
|
|
50
58
|
);
|
|
51
59
|
|
|
52
60
|
const [topicDisplayMode, updatePreference] = useUserStore((s) => [
|
|
@@ -101,6 +109,7 @@ export const useTopicActionsDropdownMenu = (): MenuProps['items'] => {
|
|
|
101
109
|
<div className={cx(hotArea)}>{t('actions.import')}</div>
|
|
102
110
|
</Upload>
|
|
103
111
|
),
|
|
112
|
+
...(onUploadClose ? { closeOnClick: false } : null),
|
|
104
113
|
},
|
|
105
114
|
{
|
|
106
115
|
type: 'divider' as const,
|
|
@@ -143,6 +152,7 @@ export const useTopicActionsDropdownMenu = (): MenuProps['items'] => {
|
|
|
143
152
|
updatePreference,
|
|
144
153
|
updateSystemStatus,
|
|
145
154
|
handleImport,
|
|
155
|
+
onUploadClose,
|
|
146
156
|
removeUnstarredTopic,
|
|
147
157
|
removeAllTopic,
|
|
148
158
|
t,
|
|
@@ -87,6 +87,42 @@ const AddGroupAgent = memo<{ mobile?: boolean }>(() => {
|
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
// Find supervisor from memberAgents
|
|
91
|
+
const supervisorMember = memberAgents.find((member: any) => {
|
|
92
|
+
const agent = member.agent || member;
|
|
93
|
+
const role = member.role || agent.role;
|
|
94
|
+
return role === 'supervisor';
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Prepare supervisor config
|
|
98
|
+
let supervisorConfig;
|
|
99
|
+
if (supervisorMember) {
|
|
100
|
+
// Type assertion needed because actual API data structure differs from type definition
|
|
101
|
+
const member = supervisorMember as any;
|
|
102
|
+
const agent = member.agent || member;
|
|
103
|
+
const currentVersion = member.currentVersion || member;
|
|
104
|
+
const rawConfig = {
|
|
105
|
+
avatar: currentVersion.avatar,
|
|
106
|
+
backgroundColor: currentVersion.backgroundColor,
|
|
107
|
+
description: currentVersion.description,
|
|
108
|
+
model: currentVersion.config?.model || currentVersion.model,
|
|
109
|
+
params: currentVersion.config?.params || currentVersion.params,
|
|
110
|
+
provider: currentVersion.config?.provider || currentVersion.provider,
|
|
111
|
+
systemRole:
|
|
112
|
+
currentVersion.config?.systemRole ||
|
|
113
|
+
currentVersion.config?.systemPrompt ||
|
|
114
|
+
currentVersion.systemRole ||
|
|
115
|
+
currentVersion.content,
|
|
116
|
+
tags: currentVersion.tags,
|
|
117
|
+
title: currentVersion.name || agent.name || 'Supervisor',
|
|
118
|
+
};
|
|
119
|
+
// Filter out null/undefined values
|
|
120
|
+
supervisorConfig = Object.fromEntries(
|
|
121
|
+
// eslint-disable-next-line eqeqeq, @typescript-eslint/no-unused-vars
|
|
122
|
+
Object.entries(rawConfig).filter(([_, v]) => v != null),
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
90
126
|
// Prepare group config
|
|
91
127
|
const groupConfig = {
|
|
92
128
|
config: {
|
|
@@ -95,30 +131,46 @@ const AddGroupAgent = memo<{ mobile?: boolean }>(() => {
|
|
|
95
131
|
openingQuestions: config.openingQuestions,
|
|
96
132
|
revealDM: config.revealDM,
|
|
97
133
|
},
|
|
98
|
-
content
|
|
134
|
+
// Group content is the supervisor's systemRole (for backward compatibility)
|
|
135
|
+
content: supervisorConfig?.systemRole || config.systemRole,
|
|
99
136
|
...meta,
|
|
100
137
|
};
|
|
101
138
|
|
|
102
139
|
// Prepare member agents from market data
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
140
|
+
// Filter out supervisor role as it will be created separately using supervisorConfig
|
|
141
|
+
const members = memberAgents
|
|
142
|
+
.filter((member: any) => {
|
|
143
|
+
const agent = member.agent || member;
|
|
144
|
+
const role = member.role || agent.role;
|
|
145
|
+
return role !== 'supervisor';
|
|
146
|
+
})
|
|
147
|
+
.map((member: any) => {
|
|
148
|
+
const agent = member.agent || member;
|
|
149
|
+
const currentVersion = member.currentVersion || member;
|
|
150
|
+
return {
|
|
151
|
+
avatar: currentVersion.avatar,
|
|
152
|
+
backgroundColor: currentVersion.backgroundColor,
|
|
153
|
+
description: currentVersion.description,
|
|
154
|
+
model: currentVersion.config?.model || currentVersion.model,
|
|
155
|
+
plugins: currentVersion.plugins,
|
|
156
|
+
provider: currentVersion.config?.provider || currentVersion.provider,
|
|
157
|
+
systemRole:
|
|
158
|
+
currentVersion.config?.systemRole ||
|
|
159
|
+
currentVersion.config?.systemPrompt ||
|
|
160
|
+
currentVersion.systemRole ||
|
|
161
|
+
currentVersion.content,
|
|
162
|
+
tags: currentVersion.tags,
|
|
163
|
+
title: currentVersion.name || agent.name,
|
|
164
|
+
};
|
|
165
|
+
});
|
|
118
166
|
|
|
119
167
|
try {
|
|
120
168
|
// Create group with all members in one request
|
|
121
|
-
const result = await chatGroupService.createGroupWithMembers(
|
|
169
|
+
const result = await chatGroupService.createGroupWithMembers(
|
|
170
|
+
groupConfig,
|
|
171
|
+
members,
|
|
172
|
+
supervisorConfig,
|
|
173
|
+
);
|
|
122
174
|
|
|
123
175
|
// Refresh group list
|
|
124
176
|
await loadGroups();
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { ActionIcon, DropdownMenu } from '@lobehub/ui';
|
|
2
2
|
import { MoreHorizontal } from 'lucide-react';
|
|
3
|
-
import { memo } from 'react';
|
|
3
|
+
import { memo, useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import { useTopicActionsDropdownMenu } from './useDropdownMenu';
|
|
6
6
|
|
|
7
7
|
const Actions = memo(() => {
|
|
8
|
-
const
|
|
8
|
+
const [open, setOpen] = useState(false);
|
|
9
|
+
const menuItems = useTopicActionsDropdownMenu({ onUploadClose: () => setOpen(false) });
|
|
9
10
|
|
|
10
11
|
return (
|
|
11
|
-
<DropdownMenu items={menuItems}>
|
|
12
|
+
<DropdownMenu items={menuItems} onOpenChange={setOpen} open={open}>
|
|
12
13
|
<ActionIcon icon={MoreHorizontal} size={'small'} />
|
|
13
14
|
</DropdownMenu>
|
|
14
15
|
);
|
|
@@ -21,9 +21,16 @@ const hotArea = css`
|
|
|
21
21
|
}
|
|
22
22
|
`;
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
interface UseTopicActionsDropdownMenuOptions {
|
|
25
|
+
onUploadClose?: () => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const useTopicActionsDropdownMenu = (
|
|
29
|
+
options: UseTopicActionsDropdownMenuOptions = {},
|
|
30
|
+
): MenuProps['items'] => {
|
|
25
31
|
const { t } = useTranslation(['topic', 'common']);
|
|
26
32
|
const { modal } = App.useApp();
|
|
33
|
+
const { onUploadClose } = options;
|
|
27
34
|
|
|
28
35
|
const [removeUnstarredTopic, removeAllTopic, importTopic] = useChatStore((s) => [
|
|
29
36
|
s.removeUnstarredTopic,
|
|
@@ -33,6 +40,7 @@ export const useTopicActionsDropdownMenu = (): MenuProps['items'] => {
|
|
|
33
40
|
|
|
34
41
|
const handleImport = useCallback(
|
|
35
42
|
async (file: File) => {
|
|
43
|
+
onUploadClose?.();
|
|
36
44
|
try {
|
|
37
45
|
const text = await file.text();
|
|
38
46
|
// Validate JSON format
|
|
@@ -46,7 +54,7 @@ export const useTopicActionsDropdownMenu = (): MenuProps['items'] => {
|
|
|
46
54
|
}
|
|
47
55
|
return false; // Prevent default upload behavior
|
|
48
56
|
},
|
|
49
|
-
[importTopic, modal, t],
|
|
57
|
+
[importTopic, modal, onUploadClose, t],
|
|
50
58
|
);
|
|
51
59
|
|
|
52
60
|
const [topicDisplayMode, updatePreference] = useUserStore((s) => [
|
|
@@ -101,6 +109,7 @@ export const useTopicActionsDropdownMenu = (): MenuProps['items'] => {
|
|
|
101
109
|
<div className={cx(hotArea)}>{t('actions.import')}</div>
|
|
102
110
|
</Upload>
|
|
103
111
|
),
|
|
112
|
+
...(onUploadClose ? { closeOnClick: false } : null),
|
|
104
113
|
},
|
|
105
114
|
{
|
|
106
115
|
type: 'divider' as const,
|
|
@@ -143,6 +152,7 @@ export const useTopicActionsDropdownMenu = (): MenuProps['items'] => {
|
|
|
143
152
|
updatePreference,
|
|
144
153
|
updateSystemStatus,
|
|
145
154
|
handleImport,
|
|
155
|
+
onUploadClose,
|
|
146
156
|
removeUnstarredTopic,
|
|
147
157
|
removeAllTopic,
|
|
148
158
|
t,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Flexbox } from '@lobehub/ui';
|
|
4
4
|
import { cssVar } from 'antd-style';
|
|
5
|
-
import { memo } from 'react';
|
|
5
|
+
import { Suspense, memo } from 'react';
|
|
6
6
|
|
|
7
7
|
import NavHeader from '@/features/NavHeader';
|
|
8
8
|
import WideScreenButton from '@/features/WideScreenContainer/WideScreenButton';
|
|
@@ -15,7 +15,9 @@ const Header = memo(() => {
|
|
|
15
15
|
right={
|
|
16
16
|
<Flexbox horizontal style={{ backgroundColor: cssVar.colorBgContainer }}>
|
|
17
17
|
<WideScreenButton />
|
|
18
|
-
<
|
|
18
|
+
<Suspense>
|
|
19
|
+
<ShareButton />
|
|
20
|
+
</Suspense>
|
|
19
21
|
</Flexbox>
|
|
20
22
|
}
|
|
21
23
|
/>
|