@lobehub/lobehub 2.0.0-next.53 → 2.0.0-next.55
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 +52 -0
- package/changelog/v1.json +18 -0
- package/locales/ar/common.json +1 -0
- package/locales/ar/file.json +85 -2
- package/locales/bg-BG/common.json +1 -0
- package/locales/bg-BG/file.json +85 -2
- package/locales/de-DE/common.json +1 -0
- package/locales/de-DE/file.json +85 -2
- package/locales/en-US/common.json +1 -0
- package/locales/en-US/file.json +85 -2
- package/locales/es-ES/common.json +1 -0
- package/locales/es-ES/file.json +85 -2
- package/locales/fa-IR/common.json +1 -0
- package/locales/fa-IR/file.json +85 -2
- package/locales/fr-FR/common.json +1 -0
- package/locales/fr-FR/file.json +85 -2
- package/locales/it-IT/common.json +1 -0
- package/locales/it-IT/file.json +85 -2
- package/locales/ja-JP/common.json +1 -0
- package/locales/ja-JP/file.json +85 -2
- package/locales/ko-KR/common.json +1 -0
- package/locales/ko-KR/file.json +85 -2
- package/locales/nl-NL/common.json +1 -0
- package/locales/nl-NL/file.json +85 -2
- package/locales/pl-PL/common.json +1 -0
- package/locales/pl-PL/file.json +85 -2
- package/locales/pt-BR/common.json +1 -0
- package/locales/pt-BR/file.json +85 -2
- package/locales/ru-RU/common.json +1 -0
- package/locales/ru-RU/file.json +85 -2
- package/locales/tr-TR/common.json +1 -0
- package/locales/tr-TR/file.json +85 -2
- package/locales/vi-VN/common.json +1 -0
- package/locales/vi-VN/file.json +85 -2
- package/locales/zh-CN/common.json +1 -0
- package/locales/zh-CN/file.json +85 -2
- package/locales/zh-TW/common.json +1 -0
- package/locales/zh-TW/file.json +85 -2
- package/package.json +1 -1
- package/packages/database/src/models/__tests__/file.test.ts +94 -29
- package/packages/database/src/models/file.ts +15 -4
- package/packages/database/src/repositories/knowledge/index.test.ts +300 -0
- package/packages/database/src/repositories/knowledge/index.ts +420 -0
- package/packages/model-bank/src/aiModels/aihubmix.ts +1 -0
- package/packages/model-bank/src/aiModels/google.ts +9 -5
- package/packages/model-bank/src/aiModels/openai.ts +2 -35
- package/packages/model-bank/src/aiModels/openrouter.ts +1 -0
- package/packages/model-bank/src/aiModels/vertexai.ts +2 -0
- package/packages/model-bank/src/types/aiModel.ts +15 -2
- package/packages/model-runtime/src/core/usageConverters/index.ts +1 -0
- package/packages/model-runtime/src/core/usageConverters/utils/resolveImageSinglePrice.ts +34 -0
- package/packages/types/src/document/index.ts +14 -2
- package/packages/types/src/files/index.ts +2 -0
- package/packages/types/src/files/list.ts +10 -0
- package/packages/types/src/llm.ts +1 -1
- package/src/app/[variants]/(main)/image/@menu/features/ConfigPanel/components/ModelSelect/ImageModelItem.tsx +93 -0
- package/src/app/[variants]/(main)/image/@menu/features/ConfigPanel/components/{ModelSelect.tsx → ModelSelect/index.tsx} +17 -2
- package/src/app/[variants]/(main)/knowledge/KnowledgeRouter.tsx +2 -1
- package/src/app/[variants]/(main)/knowledge/components/KnowledgeBaseItem/index.tsx +0 -2
- package/src/app/[variants]/(main)/knowledge/hooks/useFileCategory.ts +6 -3
- package/src/app/[variants]/(main)/knowledge/routes/KnowledgeBaseDetail/index.tsx +2 -2
- package/src/app/[variants]/(main)/knowledge/routes/KnowledgeBaseDetail/menu/{MenuItems.tsx → CategoryMenu.tsx} +3 -3
- package/src/app/[variants]/(main)/knowledge/routes/KnowledgeBaseDetail/menu/Menu.tsx +2 -2
- package/src/app/[variants]/(main)/knowledge/routes/KnowledgeHome/index.tsx +40 -18
- package/src/app/[variants]/(main)/knowledge/routes/KnowledgeHome/layout/Container.tsx +1 -1
- package/src/app/[variants]/(main)/knowledge/routes/KnowledgeHome/menu/CategoryMenu.tsx +148 -0
- package/src/app/[variants]/(main)/knowledge/routes/KnowledgeHome/menu/KnowledgeBase.tsx +20 -7
- package/src/components/FileIcon/index.tsx +3 -1
- package/src/features/ChatInput/ActionBar/Knowledge/index.tsx +2 -2
- package/src/features/Conversation/Messages/Assistant/index.tsx +7 -1
- package/src/features/FileSidePanel/index.tsx +1 -1
- package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/Item/MasonryItem.tsx +80 -0
- package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/Item/MasonryItemWrapper.tsx +27 -0
- package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/List.tsx +104 -23
- package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/MasonrySkeleton.tsx +62 -0
- package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/index.tsx +3 -2
- package/src/features/KnowledgeBaseModal/CreateNew/CreateForm.tsx +1 -1
- package/src/features/KnowledgeManager/DocumentExplorer/DocumentActions.tsx +111 -0
- package/src/features/KnowledgeManager/DocumentExplorer/DocumentEditor.tsx +723 -0
- package/src/features/KnowledgeManager/DocumentExplorer/DocumentEditorPlaceholder.tsx +169 -0
- package/src/features/KnowledgeManager/DocumentExplorer/DocumentListItem.tsx +148 -0
- package/src/features/KnowledgeManager/DocumentExplorer/DocumentListSkeleton.tsx +39 -0
- package/src/features/KnowledgeManager/DocumentExplorer/NoteEditorModal.tsx +348 -0
- package/src/features/KnowledgeManager/DocumentExplorer/RenamePopover.tsx +163 -0
- package/src/features/KnowledgeManager/DocumentExplorer/index.tsx +318 -0
- package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/FileListItem/index.tsx +48 -9
- package/src/features/KnowledgeManager/FileExplorer/MasonryFileItem/DefaultFileItem.tsx +149 -0
- package/src/features/KnowledgeManager/FileExplorer/MasonryFileItem/ImageFileItem.tsx +245 -0
- package/src/features/KnowledgeManager/FileExplorer/MasonryFileItem/MarkdownFileItem.tsx +232 -0
- package/src/features/KnowledgeManager/FileExplorer/MasonryFileItem/NoteFileItem.tsx +230 -0
- package/src/features/KnowledgeManager/FileExplorer/MasonryFileItem/index.tsx +398 -0
- package/src/features/KnowledgeManager/FileExplorer/ToolBar/ViewSwitcher.tsx +45 -0
- package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/index.tsx +68 -16
- package/src/features/KnowledgeManager/Header/AddButton.tsx +107 -0
- package/src/features/KnowledgeManager/Header/NewNoteButton.tsx +33 -0
- package/src/features/{FileManager → KnowledgeManager}/Header/index.tsx +3 -9
- package/src/features/KnowledgeManager/Home/RecentDocumentCard.tsx +116 -0
- package/src/features/KnowledgeManager/Home/RecentDocuments.tsx +77 -0
- package/src/features/KnowledgeManager/Home/RecentFileCard.tsx +121 -0
- package/src/features/KnowledgeManager/Home/RecentFiles.tsx +73 -0
- package/src/features/KnowledgeManager/Home/RecentFilesSkeleton.tsx +83 -0
- package/src/features/KnowledgeManager/Home/UploadEntries.tsx +208 -0
- package/src/features/KnowledgeManager/Home/index.tsx +221 -0
- package/src/features/KnowledgeManager/index.tsx +75 -0
- package/src/features/Portal/FilePreview/Body/index.tsx +1 -1
- package/src/features/Portal/FilePreview/Header.tsx +1 -1
- package/src/locales/default/common.ts +1 -0
- package/src/locales/default/file.ts +85 -2
- package/src/locales/default/tool.ts +8 -0
- package/src/server/routers/lambda/__tests__/file.test.ts +85 -6
- package/src/server/routers/lambda/document.ts +57 -0
- package/src/server/routers/lambda/file.ts +72 -0
- package/src/server/routers/lambda/knowledge.ts +94 -0
- package/src/server/services/document/index.ts +103 -0
- package/src/services/document/index.ts +44 -0
- package/src/services/file/index.ts +5 -3
- package/src/store/aiInfra/slices/aiProvider/__tests__/action.test.ts +125 -229
- package/src/store/aiInfra/slices/aiProvider/action.ts +113 -33
- package/src/store/chat/slices/builtinTool/actions/localSystem.ts +1 -1
- package/src/store/file/initialState.ts +6 -1
- package/src/store/file/slices/chat/action.ts +3 -3
- package/src/store/file/slices/document/action.ts +359 -0
- package/src/store/file/slices/document/index.ts +3 -0
- package/src/store/file/slices/document/initialState.ts +22 -0
- package/src/store/file/slices/document/selectors.ts +25 -0
- package/src/store/file/slices/fileManager/action.test.ts +16 -9
- package/src/store/file/slices/fileManager/action.ts +11 -11
- package/src/store/file/store.ts +3 -0
- package/src/store/global/initialState.ts +3 -1
- package/src/tools/interventions.ts +3 -5
- package/src/tools/local-system/Intervention/MoveLocalFiles/MoveFileItem.tsx +56 -0
- package/src/tools/local-system/Intervention/MoveLocalFiles/index.tsx +26 -0
- package/src/tools/local-system/Intervention/RunCommand/index.tsx +1 -2
- package/src/tools/local-system/Intervention/index.ts +11 -0
- package/src/tools/local-system/Render/MoveLocalFiles/MoveFileItem.tsx +56 -0
- package/src/tools/local-system/Render/MoveLocalFiles/index.tsx +26 -0
- package/src/tools/local-system/Render/index.ts +21 -0
- package/src/tools/renders.ts +6 -24
- package/src/tools/web-browsing/Render/index.ts +13 -0
- package/src/app/[variants]/(main)/knowledge/routes/KnowledgeHome/menu/FileMenu.tsx +0 -75
- package/src/features/FileManager/FileList/MasonryFileItem/index.tsx +0 -582
- package/src/features/FileManager/index.tsx +0 -36
- /package/src/features/{FileManager/FileList/ToolBar → KnowledgeBaseModal/AssignKnowledgeBase}/ViewSwitcher.tsx +0 -0
- /package/src/features/{FileManager → KnowledgeManager}/ChunkDrawer/ChunkList/ChunkItem.tsx +0 -0
- /package/src/features/{FileManager → KnowledgeManager}/ChunkDrawer/ChunkList/index.tsx +0 -0
- /package/src/features/{FileManager → KnowledgeManager}/ChunkDrawer/Content.tsx +0 -0
- /package/src/features/{FileManager → KnowledgeManager}/ChunkDrawer/Loading/index.tsx +0 -0
- /package/src/features/{FileManager → KnowledgeManager}/ChunkDrawer/SimilaritySearchList/Item.tsx +0 -0
- /package/src/features/{FileManager → KnowledgeManager}/ChunkDrawer/SimilaritySearchList/index.tsx +0 -0
- /package/src/features/{FileManager → KnowledgeManager}/ChunkDrawer/index.tsx +0 -0
- /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/EmptyStatus.tsx +0 -0
- /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/FileListItem/ChunkTag.tsx +0 -0
- /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/FileListItem/DropdownMenu.tsx +0 -0
- /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/FileSkeleton.tsx +0 -0
- /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/MasonryFileItem/MasonryItemWrapper.tsx +0 -0
- /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/MasonrySkeleton.tsx +0 -0
- /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/ToolBar/Config.tsx +0 -0
- /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/ToolBar/MultiSelectActions.tsx +0 -0
- /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/ToolBar/index.tsx +0 -0
- /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/useCheckTaskStatus.ts +0 -0
- /package/src/features/{FileManager → KnowledgeManager}/Header/FilesSearchBar.tsx +0 -0
- /package/src/features/{FileManager → KnowledgeManager}/Header/TogglePanelButton.tsx +0 -0
- /package/src/features/{FileManager → KnowledgeManager}/Header/UploadFileButton.tsx +0 -0
- /package/src/features/{FileManager → KnowledgeManager}/UploadDock/Item.tsx +0 -0
- /package/src/features/{FileManager → KnowledgeManager}/UploadDock/index.tsx +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BuiltinIntervention } from '@lobechat/types';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { LocalSystemManifest } from './local-system';
|
|
4
|
+
import { LocalSystemInterventions } from './local-system/Intervention';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Builtin tools interventions registry
|
|
@@ -9,9 +9,7 @@ import RunCommand from './local-system/Intervention/RunCommand';
|
|
|
9
9
|
* Only register APIs that have custom intervention UI
|
|
10
10
|
*/
|
|
11
11
|
export const BuiltinToolInterventions: Record<string, Record<string, any>> = {
|
|
12
|
-
[LocalSystemManifest.identifier]:
|
|
13
|
-
[LocalSystemApiName.runCommand]: RunCommand,
|
|
14
|
-
},
|
|
12
|
+
[LocalSystemManifest.identifier]: LocalSystemInterventions,
|
|
15
13
|
};
|
|
16
14
|
|
|
17
15
|
/**
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Icon, Text } from '@lobehub/ui';
|
|
2
|
+
import { createStyles } from 'antd-style';
|
|
3
|
+
import { ArrowRight } from 'lucide-react';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { Flexbox } from 'react-layout-kit';
|
|
6
|
+
|
|
7
|
+
import { useElectronStore } from '@/store/electron';
|
|
8
|
+
import { desktopStateSelectors } from '@/store/electron/selectors';
|
|
9
|
+
|
|
10
|
+
const useStyles = createStyles(({ css, token }) => ({
|
|
11
|
+
icon: css`
|
|
12
|
+
color: ${token.colorTextQuaternary};
|
|
13
|
+
`,
|
|
14
|
+
item: css`
|
|
15
|
+
padding-block: 4px;
|
|
16
|
+
padding-inline: 12px;
|
|
17
|
+
border-radius: ${token.borderRadius}px;
|
|
18
|
+
transition: all 0.2s ease;
|
|
19
|
+
|
|
20
|
+
&:hover {
|
|
21
|
+
background: ${token.colorFillQuaternary};
|
|
22
|
+
}
|
|
23
|
+
`,
|
|
24
|
+
path: css`
|
|
25
|
+
font-family: ${token.fontFamilyCode};
|
|
26
|
+
font-size: 12px;
|
|
27
|
+
word-break: break-all;
|
|
28
|
+
`,
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
interface MoveFileItemProps {
|
|
32
|
+
newPath: string;
|
|
33
|
+
oldPath: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const MoveFileItem = memo<MoveFileItemProps>(({ oldPath, newPath }) => {
|
|
37
|
+
const { styles } = useStyles();
|
|
38
|
+
const displayOldPath = useElectronStore(desktopStateSelectors.displayRelativePath(oldPath));
|
|
39
|
+
const displayNewPath = useElectronStore(desktopStateSelectors.displayRelativePath(newPath));
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Flexbox align="center" className={styles.item} gap={8} horizontal width="100%">
|
|
43
|
+
<Flexbox flex={1}>
|
|
44
|
+
<Text className={styles.path} type="secondary">
|
|
45
|
+
{displayOldPath}
|
|
46
|
+
</Text>
|
|
47
|
+
</Flexbox>
|
|
48
|
+
<Icon className={styles.icon} icon={ArrowRight} />
|
|
49
|
+
<Flexbox flex={2}>
|
|
50
|
+
<Text className={styles.path}>{displayNewPath}</Text>
|
|
51
|
+
</Flexbox>
|
|
52
|
+
</Flexbox>
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export default MoveFileItem;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MoveLocalFilesParams } from '@lobechat/electron-client-ipc';
|
|
2
|
+
import { BuiltinInterventionProps } from '@lobechat/types';
|
|
3
|
+
import { Text } from '@lobehub/ui';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { Flexbox } from 'react-layout-kit';
|
|
7
|
+
|
|
8
|
+
import MoveFileItem from './MoveFileItem';
|
|
9
|
+
|
|
10
|
+
const MoveLocalFiles = memo<BuiltinInterventionProps<MoveLocalFilesParams>>(({ args }) => {
|
|
11
|
+
const { items } = args;
|
|
12
|
+
const { t } = useTranslation('tool');
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Flexbox gap={8}>
|
|
16
|
+
<Text type="secondary">{t('localFiles.moveFiles.itemsToMove', { count: items.length })}</Text>
|
|
17
|
+
<Flexbox gap={6}>
|
|
18
|
+
{items.map((item, index) => (
|
|
19
|
+
<MoveFileItem key={index} newPath={item.newPath} oldPath={item.oldPath} />
|
|
20
|
+
))}
|
|
21
|
+
</Flexbox>
|
|
22
|
+
</Flexbox>
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export default MoveLocalFiles;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { RunCommandParams } from '@lobechat/electron-client-ipc';
|
|
2
|
+
import { BuiltinInterventionProps } from '@lobechat/types';
|
|
2
3
|
import { Highlighter, Text } from '@lobehub/ui';
|
|
3
4
|
import { memo } from 'react';
|
|
4
5
|
import { Flexbox } from 'react-layout-kit';
|
|
5
6
|
|
|
6
|
-
import { BuiltinInterventionProps } from '@/types/tool';
|
|
7
|
-
|
|
8
7
|
const formatTimeout = (ms?: number) => {
|
|
9
8
|
if (!ms) return null;
|
|
10
9
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LocalSystemApiName } from '../index';
|
|
2
|
+
import MoveLocalFiles from './MoveLocalFiles';
|
|
3
|
+
import RunCommand from './RunCommand';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Local System Intervention Components Registry
|
|
7
|
+
*/
|
|
8
|
+
export const LocalSystemInterventions = {
|
|
9
|
+
[LocalSystemApiName.moveLocalFiles]: MoveLocalFiles,
|
|
10
|
+
[LocalSystemApiName.runCommand]: RunCommand,
|
|
11
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Icon, Text } from '@lobehub/ui';
|
|
2
|
+
import { createStyles } from 'antd-style';
|
|
3
|
+
import { ArrowRight } from 'lucide-react';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { Flexbox } from 'react-layout-kit';
|
|
6
|
+
|
|
7
|
+
import { useElectronStore } from '@/store/electron';
|
|
8
|
+
import { desktopStateSelectors } from '@/store/electron/selectors';
|
|
9
|
+
|
|
10
|
+
const useStyles = createStyles(({ css, token }) => ({
|
|
11
|
+
icon: css`
|
|
12
|
+
color: ${token.colorTextQuaternary};
|
|
13
|
+
`,
|
|
14
|
+
item: css`
|
|
15
|
+
padding-block: 4px;
|
|
16
|
+
padding-inline: 12px;
|
|
17
|
+
border-radius: ${token.borderRadius}px;
|
|
18
|
+
transition: all 0.2s ease;
|
|
19
|
+
|
|
20
|
+
&:hover {
|
|
21
|
+
background: ${token.colorFillQuaternary};
|
|
22
|
+
}
|
|
23
|
+
`,
|
|
24
|
+
path: css`
|
|
25
|
+
font-family: ${token.fontFamilyCode};
|
|
26
|
+
font-size: 12px;
|
|
27
|
+
word-break: break-all;
|
|
28
|
+
`,
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
interface MoveFileItemProps {
|
|
32
|
+
newPath: string;
|
|
33
|
+
oldPath: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const MoveFileItem = memo<MoveFileItemProps>(({ oldPath, newPath }) => {
|
|
37
|
+
const { styles } = useStyles();
|
|
38
|
+
const displayOldPath = useElectronStore(desktopStateSelectors.displayRelativePath(oldPath));
|
|
39
|
+
const displayNewPath = useElectronStore(desktopStateSelectors.displayRelativePath(newPath));
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Flexbox align="center" className={styles.item} gap={8} horizontal width="100%">
|
|
43
|
+
<Flexbox flex={1}>
|
|
44
|
+
<Text className={styles.path} type="secondary">
|
|
45
|
+
{displayOldPath}
|
|
46
|
+
</Text>
|
|
47
|
+
</Flexbox>
|
|
48
|
+
<Icon className={styles.icon} icon={ArrowRight} />
|
|
49
|
+
<Flexbox flex={2}>
|
|
50
|
+
<Text className={styles.path}>{displayNewPath}</Text>
|
|
51
|
+
</Flexbox>
|
|
52
|
+
</Flexbox>
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export default MoveFileItem;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MoveLocalFilesParams } from '@lobechat/electron-client-ipc';
|
|
2
|
+
import { BuiltinRenderProps } from '@lobechat/types';
|
|
3
|
+
import { Text } from '@lobehub/ui';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { Flexbox } from 'react-layout-kit';
|
|
7
|
+
|
|
8
|
+
import MoveFileItem from './MoveFileItem';
|
|
9
|
+
|
|
10
|
+
const MoveLocalFiles = memo<BuiltinRenderProps<MoveLocalFilesParams>>(({ args }) => {
|
|
11
|
+
const { items } = args;
|
|
12
|
+
const { t } = useTranslation('tool');
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Flexbox gap={8}>
|
|
16
|
+
<Text type="secondary">{t('localFiles.moveFiles.itemsMoved', { count: items.length })}</Text>
|
|
17
|
+
<Flexbox gap={6}>
|
|
18
|
+
{items.map((item, index) => (
|
|
19
|
+
<MoveFileItem key={index} newPath={item.newPath} oldPath={item.oldPath} />
|
|
20
|
+
))}
|
|
21
|
+
</Flexbox>
|
|
22
|
+
</Flexbox>
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export default MoveLocalFiles;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LocalSystemApiName } from '../index';
|
|
2
|
+
import ListFiles from './ListFiles';
|
|
3
|
+
import MoveLocalFiles from './MoveLocalFiles';
|
|
4
|
+
import ReadLocalFile from './ReadLocalFile';
|
|
5
|
+
import RenameLocalFile from './RenameLocalFile';
|
|
6
|
+
import RunCommand from './RunCommand';
|
|
7
|
+
import SearchFiles from './SearchFiles';
|
|
8
|
+
import WriteFile from './WriteFile';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Local System Render Components Registry
|
|
12
|
+
*/
|
|
13
|
+
export const LocalSystemRenders = {
|
|
14
|
+
[LocalSystemApiName.listLocalFiles]: ListFiles,
|
|
15
|
+
[LocalSystemApiName.moveLocalFiles]: MoveLocalFiles,
|
|
16
|
+
[LocalSystemApiName.readLocalFile]: ReadLocalFile,
|
|
17
|
+
[LocalSystemApiName.renameLocalFile]: RenameLocalFile,
|
|
18
|
+
[LocalSystemApiName.runCommand]: RunCommand,
|
|
19
|
+
[LocalSystemApiName.searchLocalFiles]: SearchFiles,
|
|
20
|
+
[LocalSystemApiName.writeLocalFile]: WriteFile,
|
|
21
|
+
};
|
package/src/tools/renders.ts
CHANGED
|
@@ -3,37 +3,19 @@ import { BuiltinRender } from '@lobechat/types';
|
|
|
3
3
|
import { CodeInterpreterManifest } from './code-interpreter';
|
|
4
4
|
import CodeInterpreterRender from './code-interpreter/Render';
|
|
5
5
|
// local-system
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import ReadLocalFile from './local-system/Render/ReadLocalFile';
|
|
9
|
-
import RenameLocalFile from './local-system/Render/RenameLocalFile';
|
|
10
|
-
import RunCommand from './local-system/Render/RunCommand';
|
|
11
|
-
import SearchFiles from './local-system/Render/SearchFiles';
|
|
12
|
-
import WriteFile from './local-system/Render/WriteFile';
|
|
6
|
+
import { LocalSystemManifest } from './local-system';
|
|
7
|
+
import { LocalSystemRenders } from './local-system/Render';
|
|
13
8
|
// web-browsing
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import CrawlSinglePage from './web-browsing/Render/CrawlSinglePage';
|
|
17
|
-
import Search from './web-browsing/Render/Search';
|
|
9
|
+
import { WebBrowsingManifest } from './web-browsing';
|
|
10
|
+
import { WebBrowsingRenders } from './web-browsing/Render';
|
|
18
11
|
|
|
19
12
|
/**
|
|
20
13
|
* Builtin tools renders registry
|
|
21
14
|
* Organized by toolset (identifier) -> API name
|
|
22
15
|
*/
|
|
23
16
|
const BuiltinToolsRenders: Record<string, Record<string, BuiltinRender>> = {
|
|
24
|
-
[LocalSystemManifest.identifier]:
|
|
25
|
-
|
|
26
|
-
[LocalSystemApiName.listLocalFiles]: ListFiles as BuiltinRender,
|
|
27
|
-
[LocalSystemApiName.readLocalFile]: ReadLocalFile as BuiltinRender,
|
|
28
|
-
[LocalSystemApiName.renameLocalFile]: RenameLocalFile as BuiltinRender,
|
|
29
|
-
[LocalSystemApiName.writeLocalFile]: WriteFile as BuiltinRender,
|
|
30
|
-
[LocalSystemApiName.runCommand]: RunCommand as BuiltinRender,
|
|
31
|
-
},
|
|
32
|
-
[WebBrowsingManifest.identifier]: {
|
|
33
|
-
[WebBrowsingApiName.search]: Search as BuiltinRender,
|
|
34
|
-
[WebBrowsingApiName.crawlSinglePage]: CrawlSinglePage as BuiltinRender,
|
|
35
|
-
[WebBrowsingApiName.crawlMultiPages]: CrawlMultiPages as BuiltinRender,
|
|
36
|
-
},
|
|
17
|
+
[LocalSystemManifest.identifier]: LocalSystemRenders as Record<string, BuiltinRender>,
|
|
18
|
+
[WebBrowsingManifest.identifier]: WebBrowsingRenders as Record<string, BuiltinRender>,
|
|
37
19
|
[CodeInterpreterManifest.identifier]: {
|
|
38
20
|
python: CodeInterpreterRender as BuiltinRender,
|
|
39
21
|
},
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { WebBrowsingApiName } from '../index';
|
|
2
|
+
import CrawlMultiPages from './CrawlMultiPages';
|
|
3
|
+
import CrawlSinglePage from './CrawlSinglePage';
|
|
4
|
+
import Search from './Search';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Web Browsing Render Components Registry
|
|
8
|
+
*/
|
|
9
|
+
export const WebBrowsingRenders = {
|
|
10
|
+
[WebBrowsingApiName.crawlMultiPages]: CrawlMultiPages,
|
|
11
|
+
[WebBrowsingApiName.crawlSinglePage]: CrawlSinglePage,
|
|
12
|
+
[WebBrowsingApiName.search]: Search,
|
|
13
|
+
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { Icon } from '@lobehub/ui';
|
|
4
|
-
import { FileText, Globe, ImageIcon, LayoutGrid, Mic2, SquarePlay } from 'lucide-react';
|
|
5
|
-
import { memo, useMemo } from 'react';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import { Flexbox } from 'react-layout-kit';
|
|
8
|
-
|
|
9
|
-
import Menu from '@/components/Menu';
|
|
10
|
-
import type { MenuProps } from '@/components/Menu';
|
|
11
|
-
import { FilesTabs } from '@/types/files';
|
|
12
|
-
|
|
13
|
-
import { useFileCategory } from '../../../hooks/useFileCategory';
|
|
14
|
-
|
|
15
|
-
const FileMenu = memo(() => {
|
|
16
|
-
const { t } = useTranslation('file');
|
|
17
|
-
const [activeKey, setActiveKey] = useFileCategory();
|
|
18
|
-
|
|
19
|
-
const items: MenuProps['items'] = useMemo(
|
|
20
|
-
() =>
|
|
21
|
-
[
|
|
22
|
-
{
|
|
23
|
-
icon: <Icon icon={LayoutGrid} />,
|
|
24
|
-
key: FilesTabs.All,
|
|
25
|
-
label: t('tab.all'),
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
icon: <Icon icon={FileText} />,
|
|
29
|
-
key: FilesTabs.Documents,
|
|
30
|
-
label: t('tab.documents'),
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
icon: <Icon icon={ImageIcon} />,
|
|
34
|
-
key: FilesTabs.Images,
|
|
35
|
-
label: t('tab.images'),
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
icon: <Icon icon={Mic2} />,
|
|
39
|
-
key: FilesTabs.Audios,
|
|
40
|
-
label: t('tab.audios'),
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
icon: <Icon icon={SquarePlay} />,
|
|
44
|
-
key: FilesTabs.Videos,
|
|
45
|
-
label: t('tab.videos'),
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
icon: <Icon icon={Globe} />,
|
|
49
|
-
key: FilesTabs.Websites,
|
|
50
|
-
label: t('tab.websites'),
|
|
51
|
-
},
|
|
52
|
-
]
|
|
53
|
-
.filter(Boolean)
|
|
54
|
-
.slice(0, 5) as MenuProps['items'],
|
|
55
|
-
[t],
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<Flexbox>
|
|
60
|
-
<Menu
|
|
61
|
-
compact
|
|
62
|
-
items={items}
|
|
63
|
-
onClick={({ key }) => {
|
|
64
|
-
setActiveKey(key);
|
|
65
|
-
}}
|
|
66
|
-
selectable
|
|
67
|
-
selectedKeys={[activeKey]}
|
|
68
|
-
/>
|
|
69
|
-
</Flexbox>
|
|
70
|
-
);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
FileMenu.displayName = 'FileMenu';
|
|
74
|
-
|
|
75
|
-
export default FileMenu;
|