@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.
Files changed (165) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/changelog/v1.json +18 -0
  3. package/locales/ar/common.json +1 -0
  4. package/locales/ar/file.json +85 -2
  5. package/locales/bg-BG/common.json +1 -0
  6. package/locales/bg-BG/file.json +85 -2
  7. package/locales/de-DE/common.json +1 -0
  8. package/locales/de-DE/file.json +85 -2
  9. package/locales/en-US/common.json +1 -0
  10. package/locales/en-US/file.json +85 -2
  11. package/locales/es-ES/common.json +1 -0
  12. package/locales/es-ES/file.json +85 -2
  13. package/locales/fa-IR/common.json +1 -0
  14. package/locales/fa-IR/file.json +85 -2
  15. package/locales/fr-FR/common.json +1 -0
  16. package/locales/fr-FR/file.json +85 -2
  17. package/locales/it-IT/common.json +1 -0
  18. package/locales/it-IT/file.json +85 -2
  19. package/locales/ja-JP/common.json +1 -0
  20. package/locales/ja-JP/file.json +85 -2
  21. package/locales/ko-KR/common.json +1 -0
  22. package/locales/ko-KR/file.json +85 -2
  23. package/locales/nl-NL/common.json +1 -0
  24. package/locales/nl-NL/file.json +85 -2
  25. package/locales/pl-PL/common.json +1 -0
  26. package/locales/pl-PL/file.json +85 -2
  27. package/locales/pt-BR/common.json +1 -0
  28. package/locales/pt-BR/file.json +85 -2
  29. package/locales/ru-RU/common.json +1 -0
  30. package/locales/ru-RU/file.json +85 -2
  31. package/locales/tr-TR/common.json +1 -0
  32. package/locales/tr-TR/file.json +85 -2
  33. package/locales/vi-VN/common.json +1 -0
  34. package/locales/vi-VN/file.json +85 -2
  35. package/locales/zh-CN/common.json +1 -0
  36. package/locales/zh-CN/file.json +85 -2
  37. package/locales/zh-TW/common.json +1 -0
  38. package/locales/zh-TW/file.json +85 -2
  39. package/package.json +1 -1
  40. package/packages/database/src/models/__tests__/file.test.ts +94 -29
  41. package/packages/database/src/models/file.ts +15 -4
  42. package/packages/database/src/repositories/knowledge/index.test.ts +300 -0
  43. package/packages/database/src/repositories/knowledge/index.ts +420 -0
  44. package/packages/model-bank/src/aiModels/aihubmix.ts +1 -0
  45. package/packages/model-bank/src/aiModels/google.ts +9 -5
  46. package/packages/model-bank/src/aiModels/openai.ts +2 -35
  47. package/packages/model-bank/src/aiModels/openrouter.ts +1 -0
  48. package/packages/model-bank/src/aiModels/vertexai.ts +2 -0
  49. package/packages/model-bank/src/types/aiModel.ts +15 -2
  50. package/packages/model-runtime/src/core/usageConverters/index.ts +1 -0
  51. package/packages/model-runtime/src/core/usageConverters/utils/resolveImageSinglePrice.ts +34 -0
  52. package/packages/types/src/document/index.ts +14 -2
  53. package/packages/types/src/files/index.ts +2 -0
  54. package/packages/types/src/files/list.ts +10 -0
  55. package/packages/types/src/llm.ts +1 -1
  56. package/src/app/[variants]/(main)/image/@menu/features/ConfigPanel/components/ModelSelect/ImageModelItem.tsx +93 -0
  57. package/src/app/[variants]/(main)/image/@menu/features/ConfigPanel/components/{ModelSelect.tsx → ModelSelect/index.tsx} +17 -2
  58. package/src/app/[variants]/(main)/knowledge/KnowledgeRouter.tsx +2 -1
  59. package/src/app/[variants]/(main)/knowledge/components/KnowledgeBaseItem/index.tsx +0 -2
  60. package/src/app/[variants]/(main)/knowledge/hooks/useFileCategory.ts +6 -3
  61. package/src/app/[variants]/(main)/knowledge/routes/KnowledgeBaseDetail/index.tsx +2 -2
  62. package/src/app/[variants]/(main)/knowledge/routes/KnowledgeBaseDetail/menu/{MenuItems.tsx → CategoryMenu.tsx} +3 -3
  63. package/src/app/[variants]/(main)/knowledge/routes/KnowledgeBaseDetail/menu/Menu.tsx +2 -2
  64. package/src/app/[variants]/(main)/knowledge/routes/KnowledgeHome/index.tsx +40 -18
  65. package/src/app/[variants]/(main)/knowledge/routes/KnowledgeHome/layout/Container.tsx +1 -1
  66. package/src/app/[variants]/(main)/knowledge/routes/KnowledgeHome/menu/CategoryMenu.tsx +148 -0
  67. package/src/app/[variants]/(main)/knowledge/routes/KnowledgeHome/menu/KnowledgeBase.tsx +20 -7
  68. package/src/components/FileIcon/index.tsx +3 -1
  69. package/src/features/ChatInput/ActionBar/Knowledge/index.tsx +2 -2
  70. package/src/features/Conversation/Messages/Assistant/index.tsx +7 -1
  71. package/src/features/FileSidePanel/index.tsx +1 -1
  72. package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/Item/MasonryItem.tsx +80 -0
  73. package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/Item/MasonryItemWrapper.tsx +27 -0
  74. package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/List.tsx +104 -23
  75. package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/MasonrySkeleton.tsx +62 -0
  76. package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/index.tsx +3 -2
  77. package/src/features/KnowledgeBaseModal/CreateNew/CreateForm.tsx +1 -1
  78. package/src/features/KnowledgeManager/DocumentExplorer/DocumentActions.tsx +111 -0
  79. package/src/features/KnowledgeManager/DocumentExplorer/DocumentEditor.tsx +723 -0
  80. package/src/features/KnowledgeManager/DocumentExplorer/DocumentEditorPlaceholder.tsx +169 -0
  81. package/src/features/KnowledgeManager/DocumentExplorer/DocumentListItem.tsx +148 -0
  82. package/src/features/KnowledgeManager/DocumentExplorer/DocumentListSkeleton.tsx +39 -0
  83. package/src/features/KnowledgeManager/DocumentExplorer/NoteEditorModal.tsx +348 -0
  84. package/src/features/KnowledgeManager/DocumentExplorer/RenamePopover.tsx +163 -0
  85. package/src/features/KnowledgeManager/DocumentExplorer/index.tsx +318 -0
  86. package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/FileListItem/index.tsx +48 -9
  87. package/src/features/KnowledgeManager/FileExplorer/MasonryFileItem/DefaultFileItem.tsx +149 -0
  88. package/src/features/KnowledgeManager/FileExplorer/MasonryFileItem/ImageFileItem.tsx +245 -0
  89. package/src/features/KnowledgeManager/FileExplorer/MasonryFileItem/MarkdownFileItem.tsx +232 -0
  90. package/src/features/KnowledgeManager/FileExplorer/MasonryFileItem/NoteFileItem.tsx +230 -0
  91. package/src/features/KnowledgeManager/FileExplorer/MasonryFileItem/index.tsx +398 -0
  92. package/src/features/KnowledgeManager/FileExplorer/ToolBar/ViewSwitcher.tsx +45 -0
  93. package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/index.tsx +68 -16
  94. package/src/features/KnowledgeManager/Header/AddButton.tsx +107 -0
  95. package/src/features/KnowledgeManager/Header/NewNoteButton.tsx +33 -0
  96. package/src/features/{FileManager → KnowledgeManager}/Header/index.tsx +3 -9
  97. package/src/features/KnowledgeManager/Home/RecentDocumentCard.tsx +116 -0
  98. package/src/features/KnowledgeManager/Home/RecentDocuments.tsx +77 -0
  99. package/src/features/KnowledgeManager/Home/RecentFileCard.tsx +121 -0
  100. package/src/features/KnowledgeManager/Home/RecentFiles.tsx +73 -0
  101. package/src/features/KnowledgeManager/Home/RecentFilesSkeleton.tsx +83 -0
  102. package/src/features/KnowledgeManager/Home/UploadEntries.tsx +208 -0
  103. package/src/features/KnowledgeManager/Home/index.tsx +221 -0
  104. package/src/features/KnowledgeManager/index.tsx +75 -0
  105. package/src/features/Portal/FilePreview/Body/index.tsx +1 -1
  106. package/src/features/Portal/FilePreview/Header.tsx +1 -1
  107. package/src/locales/default/common.ts +1 -0
  108. package/src/locales/default/file.ts +85 -2
  109. package/src/locales/default/tool.ts +8 -0
  110. package/src/server/routers/lambda/__tests__/file.test.ts +85 -6
  111. package/src/server/routers/lambda/document.ts +57 -0
  112. package/src/server/routers/lambda/file.ts +72 -0
  113. package/src/server/routers/lambda/knowledge.ts +94 -0
  114. package/src/server/services/document/index.ts +103 -0
  115. package/src/services/document/index.ts +44 -0
  116. package/src/services/file/index.ts +5 -3
  117. package/src/store/aiInfra/slices/aiProvider/__tests__/action.test.ts +125 -229
  118. package/src/store/aiInfra/slices/aiProvider/action.ts +113 -33
  119. package/src/store/chat/slices/builtinTool/actions/localSystem.ts +1 -1
  120. package/src/store/file/initialState.ts +6 -1
  121. package/src/store/file/slices/chat/action.ts +3 -3
  122. package/src/store/file/slices/document/action.ts +359 -0
  123. package/src/store/file/slices/document/index.ts +3 -0
  124. package/src/store/file/slices/document/initialState.ts +22 -0
  125. package/src/store/file/slices/document/selectors.ts +25 -0
  126. package/src/store/file/slices/fileManager/action.test.ts +16 -9
  127. package/src/store/file/slices/fileManager/action.ts +11 -11
  128. package/src/store/file/store.ts +3 -0
  129. package/src/store/global/initialState.ts +3 -1
  130. package/src/tools/interventions.ts +3 -5
  131. package/src/tools/local-system/Intervention/MoveLocalFiles/MoveFileItem.tsx +56 -0
  132. package/src/tools/local-system/Intervention/MoveLocalFiles/index.tsx +26 -0
  133. package/src/tools/local-system/Intervention/RunCommand/index.tsx +1 -2
  134. package/src/tools/local-system/Intervention/index.ts +11 -0
  135. package/src/tools/local-system/Render/MoveLocalFiles/MoveFileItem.tsx +56 -0
  136. package/src/tools/local-system/Render/MoveLocalFiles/index.tsx +26 -0
  137. package/src/tools/local-system/Render/index.ts +21 -0
  138. package/src/tools/renders.ts +6 -24
  139. package/src/tools/web-browsing/Render/index.ts +13 -0
  140. package/src/app/[variants]/(main)/knowledge/routes/KnowledgeHome/menu/FileMenu.tsx +0 -75
  141. package/src/features/FileManager/FileList/MasonryFileItem/index.tsx +0 -582
  142. package/src/features/FileManager/index.tsx +0 -36
  143. /package/src/features/{FileManager/FileList/ToolBar → KnowledgeBaseModal/AssignKnowledgeBase}/ViewSwitcher.tsx +0 -0
  144. /package/src/features/{FileManager → KnowledgeManager}/ChunkDrawer/ChunkList/ChunkItem.tsx +0 -0
  145. /package/src/features/{FileManager → KnowledgeManager}/ChunkDrawer/ChunkList/index.tsx +0 -0
  146. /package/src/features/{FileManager → KnowledgeManager}/ChunkDrawer/Content.tsx +0 -0
  147. /package/src/features/{FileManager → KnowledgeManager}/ChunkDrawer/Loading/index.tsx +0 -0
  148. /package/src/features/{FileManager → KnowledgeManager}/ChunkDrawer/SimilaritySearchList/Item.tsx +0 -0
  149. /package/src/features/{FileManager → KnowledgeManager}/ChunkDrawer/SimilaritySearchList/index.tsx +0 -0
  150. /package/src/features/{FileManager → KnowledgeManager}/ChunkDrawer/index.tsx +0 -0
  151. /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/EmptyStatus.tsx +0 -0
  152. /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/FileListItem/ChunkTag.tsx +0 -0
  153. /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/FileListItem/DropdownMenu.tsx +0 -0
  154. /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/FileSkeleton.tsx +0 -0
  155. /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/MasonryFileItem/MasonryItemWrapper.tsx +0 -0
  156. /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/MasonrySkeleton.tsx +0 -0
  157. /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/ToolBar/Config.tsx +0 -0
  158. /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/ToolBar/MultiSelectActions.tsx +0 -0
  159. /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/ToolBar/index.tsx +0 -0
  160. /package/src/features/{FileManager/FileList → KnowledgeManager/FileExplorer}/useCheckTaskStatus.ts +0 -0
  161. /package/src/features/{FileManager → KnowledgeManager}/Header/FilesSearchBar.tsx +0 -0
  162. /package/src/features/{FileManager → KnowledgeManager}/Header/TogglePanelButton.tsx +0 -0
  163. /package/src/features/{FileManager → KnowledgeManager}/Header/UploadFileButton.tsx +0 -0
  164. /package/src/features/{FileManager → KnowledgeManager}/UploadDock/Item.tsx +0 -0
  165. /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 { LocalSystemApiName, LocalSystemManifest } from './local-system';
4
- import RunCommand from './local-system/Intervention/RunCommand';
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
+ };
@@ -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 { LocalSystemApiName, LocalSystemManifest } from './local-system';
7
- import ListFiles from './local-system/Render/ListFiles';
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 { WebBrowsingApiName, WebBrowsingManifest } from './web-browsing';
15
- import CrawlMultiPages from './web-browsing/Render/CrawlMultiPages';
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
- [LocalSystemApiName.searchLocalFiles]: SearchFiles as BuiltinRender,
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;