@lobehub/chat 1.11.9 → 1.12.1
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/.github/workflows/release.yml +2 -1
- package/.github/workflows/test.yml +2 -1
- package/CHANGELOG.md +50 -0
- package/Dockerfile.database +2 -0
- package/docs/self-hosting/advanced/knowledge-base.zh-CN.mdx +65 -0
- package/locales/ar/chat.json +13 -3
- package/locales/ar/components.json +2 -0
- package/locales/bg-BG/chat.json +13 -3
- package/locales/bg-BG/components.json +2 -0
- package/locales/de-DE/chat.json +13 -3
- package/locales/de-DE/components.json +2 -0
- package/locales/en-US/chat.json +13 -3
- package/locales/en-US/components.json +2 -0
- package/locales/es-ES/chat.json +13 -3
- package/locales/es-ES/components.json +2 -0
- package/locales/fr-FR/chat.json +13 -3
- package/locales/fr-FR/components.json +2 -0
- package/locales/it-IT/chat.json +13 -3
- package/locales/it-IT/components.json +2 -0
- package/locales/ja-JP/chat.json +13 -3
- package/locales/ja-JP/components.json +2 -0
- package/locales/ko-KR/chat.json +13 -3
- package/locales/ko-KR/components.json +2 -0
- package/locales/nl-NL/chat.json +13 -3
- package/locales/nl-NL/components.json +2 -0
- package/locales/pl-PL/chat.json +13 -3
- package/locales/pl-PL/components.json +2 -0
- package/locales/pt-BR/chat.json +13 -3
- package/locales/pt-BR/components.json +2 -0
- package/locales/ru-RU/chat.json +13 -3
- package/locales/ru-RU/components.json +2 -0
- package/locales/tr-TR/chat.json +13 -3
- package/locales/tr-TR/components.json +2 -0
- package/locales/vi-VN/chat.json +13 -3
- package/locales/vi-VN/components.json +2 -0
- package/locales/zh-CN/chat.json +13 -3
- package/locales/zh-CN/components.json +2 -0
- package/locales/zh-TW/chat.json +13 -3
- package/locales/zh-TW/components.json +2 -0
- package/package.json +3 -2
- package/scripts/migrateServerDB/docker.cjs +6 -0
- package/scripts/migrateServerDB/errorHint.js +17 -0
- package/scripts/migrateServerDB/index.ts +6 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/FilePreview/FileItem/Content.tsx +37 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/FilePreview/FileItem/index.tsx +87 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/FilePreview/FileItem/style.ts +4 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/FilePreview/FileItem/utils.ts +28 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/FilePreview/FileList.tsx +41 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/FilePreview/index.tsx +40 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/SendMore.tsx +1 -1
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/index.tsx +7 -22
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/TextArea.tsx +1 -1
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/index.tsx +2 -4
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/Files/FileItem/File.tsx +72 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/Files/FileItem/Image.tsx +74 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/Files/FileItem/index.tsx +39 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/Files/FileItem/style.ts +1 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/Files/index.tsx +33 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/InputArea/Container.tsx +41 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/InputArea/index.tsx +154 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/Send.tsx +34 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/index.tsx +24 -11
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/components/UploadDetail/UploadStatus.tsx +71 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/components/UploadDetail/index.tsx +49 -0
- package/src/app/(main)/chat/(workspace)/@portal/FilePreview/index.tsx +26 -0
- package/src/app/(main)/chat/(workspace)/@portal/Home/Files/FileList/Item.tsx +53 -0
- package/src/app/(main)/chat/(workspace)/@portal/Home/Files/FileList/index.tsx +50 -0
- package/src/app/(main)/chat/(workspace)/@portal/Home/Files/index.tsx +21 -0
- package/src/app/(main)/chat/(workspace)/@portal/Home/index.tsx +2 -0
- package/src/app/(main)/chat/(workspace)/@portal/router.tsx +4 -0
- package/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/KnowledgeTag.tsx +41 -0
- package/src/app/(main)/chat/(workspace)/_layout/Desktop/ChatHeader/Tags.tsx +7 -2
- package/src/app/(main)/chat/(workspace)/_layout/Desktop/HotKeys.tsx +1 -1
- package/src/app/(main)/files/(content)/@menu/default.tsx +27 -0
- package/src/app/(main)/files/(content)/@menu/features/FileMenu/index.tsx +97 -0
- package/src/app/(main)/files/(content)/@menu/features/KnowledgeBase/EmptyStatus.tsx +53 -0
- package/src/app/(main)/files/(content)/@menu/features/KnowledgeBase/Item/Content.tsx +175 -0
- package/src/app/(main)/files/(content)/@menu/features/KnowledgeBase/Item/index.tsx +69 -0
- package/src/app/(main)/files/(content)/@menu/features/KnowledgeBase/KnowledgeBaseList.tsx +30 -0
- package/src/app/(main)/files/(content)/@menu/features/KnowledgeBase/SkeletonList.tsx +57 -0
- package/src/app/(main)/files/(content)/@menu/features/KnowledgeBase/index.tsx +54 -0
- package/src/app/(main)/files/(content)/@modal/(.)[id]/FileDetail.tsx +16 -0
- package/src/app/(main)/files/(content)/@modal/(.)[id]/FilePreview.tsx +15 -0
- package/src/app/(main)/files/(content)/@modal/(.)[id]/FullscreenModal.tsx +85 -0
- package/src/app/(main)/files/(content)/@modal/(.)[id]/page.tsx +19 -0
- package/src/app/(main)/files/(content)/@modal/default.tsx +3 -0
- package/src/app/(main)/files/(content)/NotSupportClient.tsx +152 -0
- package/src/app/(main)/files/(content)/_layout/Desktop/index.tsx +28 -0
- package/src/app/(main)/files/(content)/_layout/Mobile.tsx +47 -0
- package/src/app/(main)/files/(content)/_layout/type.ts +7 -0
- package/src/app/(main)/files/(content)/layout.tsx +18 -0
- package/src/app/(main)/files/(content)/page.tsx +14 -0
- package/src/app/(main)/files/[id]/Header.tsx +63 -0
- package/src/app/(main)/files/[id]/page.tsx +44 -0
- package/src/app/(main)/files/features/FileDetail.tsx +93 -0
- package/src/app/(main)/files/hooks/useFileCategory.ts +9 -0
- package/src/app/(main)/files/layout.tsx +12 -0
- package/src/app/(main)/files/loading.tsx +21 -0
- package/src/app/(main)/repos/[id]/@menu/Head/index.tsx +33 -0
- package/src/app/(main)/repos/[id]/@menu/Menu/index.tsx +56 -0
- package/src/app/(main)/repos/[id]/@menu/default.tsx +25 -0
- package/src/app/(main)/repos/[id]/_layout/Desktop/index.tsx +25 -0
- package/src/app/(main)/repos/[id]/_layout/Mobile.tsx +47 -0
- package/src/app/(main)/repos/[id]/_layout/type.ts +6 -0
- package/src/app/(main)/repos/[id]/hooks/useKnowledgeItem.ts +7 -0
- package/src/app/(main)/repos/[id]/layout.tsx +13 -0
- package/src/app/(main)/repos/[id]/page.tsx +18 -0
- package/src/app/(main)/repos/layout.tsx +13 -0
- package/src/app/(main)/repos/page.tsx +5 -0
- package/src/app/trpc/async/[trpc]/route.ts +28 -0
- package/src/chains/abstractChunk.ts +19 -0
- package/src/chains/answerWithContext.ts +34 -0
- package/src/chains/rewriteQuery.ts +22 -0
- package/src/components/DragUpload/index.tsx +6 -99
- package/src/components/DragUpload/useDragUpload.tsx +146 -0
- package/src/components/FeatureList/index.tsx +64 -0
- package/src/components/FileParsingStatus/index.tsx +230 -0
- package/src/components/ImageItem/index.tsx +10 -2
- package/src/components/KnowledgeIcon/index.tsx +28 -0
- package/src/config/app.ts +6 -1
- package/src/config/featureFlags/schema.ts +1 -1
- package/src/const/file.ts +1 -0
- package/src/const/url.ts +1 -0
- package/src/database/client/models/file.ts +8 -2
- package/src/database/server/migrations/0005_pgvector.sql +2 -0
- package/src/database/server/migrations/0006_add_knowledge_base.sql +307 -0
- package/src/database/server/migrations/0007_fix_embedding_table.sql +18 -0
- package/src/database/server/migrations/meta/0005_snapshot.json +2119 -0
- package/src/database/server/migrations/meta/0006_snapshot.json +3006 -0
- package/src/database/server/migrations/meta/0007_snapshot.json +3012 -0
- package/src/database/server/migrations/meta/_journal.json +21 -0
- package/src/database/server/models/__tests__/_test_template.ts +155 -0
- package/src/database/server/models/__tests__/agent.test.ts +226 -0
- package/src/database/server/models/__tests__/asyncTask.test.ts +176 -0
- package/src/database/server/models/__tests__/chunk.test.ts +336 -0
- package/src/database/server/models/__tests__/file.test.ts +317 -29
- package/src/database/server/models/__tests__/fixtures/embedding.ts +568 -0
- package/src/database/server/models/__tests__/knowledgeBase.test.ts +132 -0
- package/src/database/server/models/__tests__/message.test.ts +7 -4
- package/src/database/server/models/_template.ts +10 -1
- package/src/database/server/models/agent.ts +165 -0
- package/src/database/server/models/asyncTask.ts +96 -0
- package/src/database/server/models/chunk.ts +203 -0
- package/src/database/server/models/embedding.ts +50 -0
- package/src/database/server/models/file.ts +231 -12
- package/src/database/server/models/knowledgeBase.ts +94 -0
- package/src/database/server/models/message.ts +156 -30
- package/src/database/server/models/user.ts +12 -1
- package/src/database/server/schemas/lobechat/agent.ts +93 -0
- package/src/database/server/schemas/lobechat/discover.ts +1 -1
- package/src/database/server/schemas/lobechat/file.ts +118 -1
- package/src/database/server/schemas/lobechat/index.ts +5 -1
- package/src/database/server/schemas/lobechat/message.ts +169 -0
- package/src/database/server/schemas/lobechat/rag.ts +53 -0
- package/src/database/server/schemas/lobechat/relations.ts +68 -48
- package/src/database/server/schemas/lobechat/session.ts +77 -0
- package/src/database/server/schemas/lobechat/topic.ts +32 -0
- package/src/database/server/schemas/lobechat/user.ts +40 -25
- package/src/database/server/utils/idGenerator.ts +1 -0
- package/src/features/ChatInput/ActionBar/Clear.tsx +1 -1
- package/src/features/ChatInput/ActionBar/Knowledge/Dropdown.tsx +160 -0
- package/src/features/ChatInput/ActionBar/Knowledge/ListItem.tsx +52 -0
- package/src/features/ChatInput/ActionBar/Knowledge/index.tsx +54 -0
- package/src/features/ChatInput/ActionBar/Tools/index.tsx +1 -1
- package/src/features/ChatInput/ActionBar/Upload/ClientMode.tsx +52 -0
- package/src/features/ChatInput/ActionBar/Upload/ServerMode.tsx +104 -0
- package/src/features/ChatInput/ActionBar/Upload/index.tsx +8 -0
- package/src/features/ChatInput/ActionBar/config.ts +14 -5
- package/src/features/ChatInput/useSend.ts +16 -7
- package/src/features/Conversation/Messages/Assistant/FileChunks/Item/index.tsx +51 -0
- package/src/features/Conversation/Messages/Assistant/FileChunks/Item/style.ts +38 -0
- package/src/features/Conversation/Messages/Assistant/FileChunks/index.tsx +76 -0
- package/src/features/Conversation/Messages/Assistant/index.tsx +13 -4
- package/src/features/Conversation/Messages/Default.tsx +4 -0
- package/src/features/Conversation/Messages/User/BelowMessage.tsx +78 -0
- package/src/features/Conversation/Messages/User/FileListViewer/Item.tsx +53 -0
- package/src/features/Conversation/Messages/User/FileListViewer/index.tsx +21 -0
- package/src/{components/FileList/FileListViewer.tsx → features/Conversation/Messages/User/ImageFileListViewer.tsx} +10 -2
- package/src/features/Conversation/Messages/{User.tsx → User/index.tsx} +11 -2
- package/src/features/Conversation/Messages/index.ts +8 -3
- package/src/features/Conversation/components/ChatItem/index.tsx +33 -10
- package/src/features/Conversation/components/InboxWelcome/QuestionSuggest.tsx +1 -1
- package/src/features/Conversation/types/index.tsx +1 -0
- package/src/features/FileManager/ChunkDrawer/ChunkList/ChunkItem.tsx +61 -0
- package/src/features/FileManager/ChunkDrawer/ChunkList/index.tsx +42 -0
- package/src/features/FileManager/ChunkDrawer/Content.tsx +38 -0
- package/src/features/FileManager/ChunkDrawer/Loading/index.tsx +16 -0
- package/src/features/FileManager/ChunkDrawer/SimilaritySearchList/Item.tsx +62 -0
- package/src/features/FileManager/ChunkDrawer/SimilaritySearchList/index.tsx +31 -0
- package/src/features/FileManager/ChunkDrawer/index.tsx +48 -0
- package/src/features/FileManager/FileList/EmptyStatus.tsx +153 -0
- package/src/features/FileManager/FileList/FileListItem/ChunkTag.tsx +35 -0
- package/src/features/FileManager/FileList/FileListItem/DropdownMenu.tsx +150 -0
- package/src/features/FileManager/FileList/FileListItem/index.tsx +211 -0
- package/src/features/FileManager/FileList/FileSkeleton.tsx +25 -0
- package/src/features/FileManager/FileList/ToolBar/Config.tsx +28 -0
- package/src/features/FileManager/FileList/ToolBar/MultiSelectActions.tsx +152 -0
- package/src/features/FileManager/FileList/ToolBar/index.tsx +114 -0
- package/src/features/FileManager/FileList/index.tsx +143 -0
- package/src/features/FileManager/FileList/useCheckTaskStatus.ts +27 -0
- package/src/features/FileManager/Header/FilesSearchBar.tsx +41 -0
- package/src/features/FileManager/Header/UploadFileButton.tsx +79 -0
- package/src/features/FileManager/Header/index.tsx +39 -0
- package/src/features/FileManager/UploadDock/Item.tsx +124 -0
- package/src/features/FileManager/UploadDock/index.tsx +183 -0
- package/src/features/FileManager/index.tsx +38 -0
- package/src/features/FileSidePanel/index.tsx +79 -0
- package/src/features/FileViewer/NotSupport/index.tsx +54 -0
- package/src/features/FileViewer/PDFViewer/HighlightLayer.tsx +81 -0
- package/src/features/FileViewer/PDFViewer/index.tsx +93 -0
- package/src/features/FileViewer/PDFViewer/style.ts +20 -0
- package/src/features/FileViewer/PDFViewer/useResizeObserver.ts +33 -0
- package/src/features/FileViewer/TXTViewer/index.tsx +41 -0
- package/src/features/FileViewer/index.tsx +45 -0
- package/src/features/KnowledgeBaseModal/AddFilesToKnowledgeBase/SelectForm.tsx +115 -0
- package/src/features/KnowledgeBaseModal/AddFilesToKnowledgeBase/index.tsx +43 -0
- package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/Item/Action.tsx +103 -0
- package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/Item/EditCustomPlugin.tsx +55 -0
- package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/Item/PluginTag.tsx +58 -0
- package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/Item/index.tsx +70 -0
- package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/List.tsx +49 -0
- package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/Loading.tsx +13 -0
- package/src/features/KnowledgeBaseModal/AssignKnowledgeBase/index.tsx +39 -0
- package/src/features/KnowledgeBaseModal/CreateNew/CreateForm.tsx +73 -0
- package/src/features/KnowledgeBaseModal/CreateNew/index.tsx +35 -0
- package/src/features/KnowledgeBaseModal/index.ts +3 -0
- package/src/libs/langchain/loaders/pdf/index.ts +2 -2
- package/src/libs/trpc/async/asyncAuth.ts +24 -0
- package/src/libs/trpc/async/index.ts +10 -0
- package/src/libs/trpc/async/init.ts +11 -0
- package/src/libs/trpc/client/async.ts +14 -0
- package/src/libs/trpc/client/index.ts +1 -0
- package/src/libs/trpc/client/lambda.ts +9 -0
- package/src/libs/trpc/middleware/keyVaults.ts +18 -0
- package/src/libs/unstructured/__tests__/index.test.ts +0 -10
- package/src/libs/unstructured/index.ts +6 -11
- package/src/locales/default/chat.ts +47 -3
- package/src/locales/default/common.ts +1 -0
- package/src/locales/default/components.ts +2 -0
- package/src/locales/default/error.ts +6 -1
- package/src/locales/default/file.ts +92 -0
- package/src/locales/default/index.ts +4 -0
- package/src/locales/default/knowledgeBase.ts +31 -0
- package/src/locales/default/portal.ts +1 -0
- package/src/middleware.ts +3 -0
- package/src/server/asyncContext.ts +40 -0
- package/src/server/modules/ContentChunk/index.ts +135 -0
- package/src/server/modules/S3/index.ts +30 -5
- package/src/server/routers/async/caller.ts +27 -0
- package/src/server/routers/async/file.ts +247 -0
- package/src/server/routers/async/index.ts +12 -0
- package/src/server/routers/lambda/_template.ts +77 -0
- package/src/server/routers/lambda/agent.ts +159 -0
- package/src/server/routers/lambda/chunk.ts +189 -0
- package/src/server/routers/lambda/file.ts +129 -5
- package/src/server/routers/lambda/index.ts +6 -0
- package/src/server/routers/lambda/knowledgeBase.ts +79 -0
- package/src/server/routers/lambda/message.ts +6 -0
- package/src/server/routers/lambda/session.ts +0 -25
- package/src/server/routers/lambda/user.ts +5 -1
- package/src/server/services/chunk/index.ts +74 -0
- package/src/server/utils/files.ts +9 -0
- package/src/services/__tests__/chat.test.ts +18 -20
- package/src/services/__tests__/{upload.test.ts → upload_legacy.test.ts} +1 -1
- package/src/services/agent.ts +45 -0
- package/src/services/chat.ts +17 -15
- package/src/services/file/client.test.ts +1 -50
- package/src/services/file/client.ts +12 -25
- package/src/services/file/server.ts +25 -3
- package/src/services/file/type.ts +7 -4
- package/src/services/knowledgeBase.ts +34 -0
- package/src/services/message/client.test.ts +1 -1
- package/src/services/message/client.ts +29 -3
- package/src/services/message/index.ts +0 -2
- package/src/services/message/server.ts +9 -3
- package/src/services/message/type.ts +1 -13
- package/src/services/rag.ts +29 -0
- package/src/services/session/server.ts +1 -1
- package/src/services/upload.ts +89 -84
- package/src/services/upload_legacy.ts +104 -0
- package/src/services/user/client.ts +7 -2
- package/src/services/user/server.ts +6 -2
- package/src/services/user/type.ts +3 -2
- package/src/store/agent/slices/chat/action.ts +90 -18
- package/src/store/agent/slices/chat/initialState.ts +1 -0
- package/src/store/agent/slices/chat/selectors.ts +58 -0
- package/src/store/chat/slices/builtinTool/action.test.ts +2 -2
- package/src/store/chat/slices/builtinTool/action.ts +2 -2
- package/src/store/chat/slices/message/action.test.ts +2 -1
- package/src/store/chat/slices/message/action.ts +102 -26
- package/src/store/chat/slices/message/actions/rag.ts +148 -0
- package/src/store/chat/slices/message/initialState.ts +7 -0
- package/src/store/chat/slices/message/reducer.ts +6 -2
- package/src/store/chat/slices/message/selectors.ts +38 -3
- package/src/store/chat/slices/plugin/action.ts +8 -2
- package/src/store/chat/slices/portal/action.ts +8 -0
- package/src/store/chat/slices/portal/initialState.ts +3 -0
- package/src/store/chat/slices/portal/selectors.ts +8 -2
- package/src/store/file/initialState.ts +5 -1
- package/src/store/file/reducers/uploadFileList.ts +133 -0
- package/src/store/file/selectors.ts +3 -0
- package/src/store/file/slices/chat/action.test.ts +90 -90
- package/src/store/file/slices/chat/action.ts +164 -109
- package/src/store/file/slices/chat/initialState.ts +7 -2
- package/src/store/file/slices/chat/selectors.test.ts +84 -61
- package/src/store/file/slices/chat/selectors.ts +22 -32
- package/src/store/file/slices/chunk/action.ts +36 -0
- package/src/store/file/slices/chunk/index.ts +3 -0
- package/src/store/file/slices/chunk/initialState.ts +15 -0
- package/src/store/file/slices/chunk/selectors.ts +10 -0
- package/src/store/file/slices/fileManager/action.ts +187 -0
- package/src/store/file/slices/fileManager/index.ts +3 -0
- package/src/store/file/slices/fileManager/initialState.ts +18 -0
- package/src/store/file/slices/fileManager/selectors.ts +58 -0
- package/src/store/file/slices/tts/action.test.ts +1 -1
- package/src/store/file/slices/tts/action.ts +2 -2
- package/src/store/file/slices/upload/action.ts +164 -0
- package/src/store/file/store.ts +12 -1
- package/src/store/knowledgeBase/index.ts +2 -0
- package/src/store/knowledgeBase/initialState.ts +7 -0
- package/src/store/knowledgeBase/selectors.ts +1 -0
- package/src/store/knowledgeBase/slices/content/action.ts +27 -0
- package/src/store/knowledgeBase/slices/content/index.ts +1 -0
- package/src/store/knowledgeBase/slices/crud/action.ts +78 -0
- package/src/store/knowledgeBase/slices/crud/index.ts +3 -0
- package/src/store/knowledgeBase/slices/crud/initialState.ts +12 -0
- package/src/store/knowledgeBase/slices/crud/selectors.ts +7 -0
- package/src/store/knowledgeBase/store.ts +30 -0
- package/src/store/serverConfig/selectors.test.ts +1 -1
- package/src/store/user/slices/preference/selectors.ts +8 -0
- package/src/store/user/slices/settings/selectors/systemAgent.ts +2 -0
- package/src/tools/dalle/Render/Item/ImageFileItem.tsx +3 -23
- package/src/types/agent/index.ts +9 -0
- package/src/types/asyncTask.ts +31 -0
- package/src/types/chunk/document.ts +9 -0
- package/src/types/chunk/index.ts +52 -0
- package/src/types/files/index.ts +35 -0
- package/src/types/files/list.ts +44 -0
- package/src/types/files/upload.ts +91 -0
- package/src/types/knowledgeBase/index.ts +45 -0
- package/src/types/message/index.ts +54 -5
- package/src/types/rag.ts +16 -0
- package/src/utils/filter.test.ts +2 -0
- package/src/utils/server/auth.ts +23 -0
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/LocalFiles.tsx +0 -46
- package/src/app/(main)/chat/(workspace)/@conversation/features/ChatInput/Mobile/Files.tsx +0 -19
- package/src/components/FileList/EditableFileList.tsx +0 -47
- package/src/components/FileList/index.ts +0 -2
- package/src/components/FileList/type.tsx +0 -7
- package/src/database/server/schemas/lobechat/chat.ts +0 -331
- package/src/features/ChatInput/ActionBar/FileUpload.tsx +0 -69
- package/src/features/ChatInput/useChatInput.ts +0 -45
- package/src/features/FileList/EditableFileList.tsx +0 -31
- package/src/features/FileList/FileListPreviewer.tsx +0 -17
- package/src/features/FileList/index.tsx +0 -2
- package/src/types/files.ts +0 -42
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Typography } from 'antd';
|
|
2
|
+
import { createStyles } from 'antd-style';
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { Flexbox } from 'react-layout-kit';
|
|
5
|
+
|
|
6
|
+
import KnowledgeIcon from '@/components/KnowledgeIcon';
|
|
7
|
+
import { KnowledgeItem } from '@/types/knowledgeBase';
|
|
8
|
+
|
|
9
|
+
import Actions from './Action';
|
|
10
|
+
|
|
11
|
+
const { Paragraph } = Typography;
|
|
12
|
+
|
|
13
|
+
const useStyles = createStyles(({ css, token }) => ({
|
|
14
|
+
desc: css`
|
|
15
|
+
margin: 0 !important;
|
|
16
|
+
font-size: 12px;
|
|
17
|
+
line-height: 1;
|
|
18
|
+
color: ${token.colorTextDescription};
|
|
19
|
+
`,
|
|
20
|
+
link: css`
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
color: ${token.colorText};
|
|
23
|
+
`,
|
|
24
|
+
title: css`
|
|
25
|
+
margin: 0 !important;
|
|
26
|
+
font-size: 14px;
|
|
27
|
+
line-height: 1;
|
|
28
|
+
`,
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
const PluginItem = memo<KnowledgeItem>(({ id, fileType, name, type, description, enabled }) => {
|
|
32
|
+
const { styles } = useStyles();
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Flexbox
|
|
36
|
+
align={'center'}
|
|
37
|
+
gap={8}
|
|
38
|
+
horizontal
|
|
39
|
+
justify={'space-between'}
|
|
40
|
+
paddingBlock={12}
|
|
41
|
+
paddingInline={16}
|
|
42
|
+
style={{ position: 'relative' }}
|
|
43
|
+
>
|
|
44
|
+
<Flexbox
|
|
45
|
+
align={'center'}
|
|
46
|
+
flex={1}
|
|
47
|
+
gap={8}
|
|
48
|
+
horizontal
|
|
49
|
+
style={{ overflow: 'hidden', position: 'relative' }}
|
|
50
|
+
>
|
|
51
|
+
<KnowledgeIcon fileType={fileType} name={name} size={{ file: 40, repo: 40 }} type={type} />
|
|
52
|
+
<Flexbox flex={1} gap={4} style={{ overflow: 'hidden', position: 'relative' }}>
|
|
53
|
+
<Flexbox align={'center'} gap={8} horizontal>
|
|
54
|
+
<Paragraph className={styles.title} ellipsis={{ rows: 1 }}>
|
|
55
|
+
{name}
|
|
56
|
+
</Paragraph>
|
|
57
|
+
</Flexbox>
|
|
58
|
+
{description && (
|
|
59
|
+
<Paragraph className={styles.desc} ellipsis={{ rows: 1 }}>
|
|
60
|
+
{description}
|
|
61
|
+
</Paragraph>
|
|
62
|
+
)}
|
|
63
|
+
</Flexbox>
|
|
64
|
+
</Flexbox>
|
|
65
|
+
<Actions enabled={enabled} id={id} type={type} />
|
|
66
|
+
</Flexbox>
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export default PluginItem;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Icon } from '@lobehub/ui';
|
|
2
|
+
import { Empty } from 'antd';
|
|
3
|
+
import { ServerCrash } from 'lucide-react';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { Center } from 'react-layout-kit';
|
|
7
|
+
import { Virtuoso } from 'react-virtuoso';
|
|
8
|
+
|
|
9
|
+
import { useAgentStore } from '@/store/agent';
|
|
10
|
+
|
|
11
|
+
import Item from './Item';
|
|
12
|
+
import Loading from './Loading';
|
|
13
|
+
|
|
14
|
+
export const List = memo(() => {
|
|
15
|
+
const { t } = useTranslation('plugin');
|
|
16
|
+
|
|
17
|
+
const useFetchFilesAndKnowledgeBases = useAgentStore((s) => s.useFetchFilesAndKnowledgeBases);
|
|
18
|
+
|
|
19
|
+
const { isLoading, error, data } = useFetchFilesAndKnowledgeBases();
|
|
20
|
+
|
|
21
|
+
const isEmpty = data && data.length === 0;
|
|
22
|
+
|
|
23
|
+
return isLoading ? (
|
|
24
|
+
<Loading />
|
|
25
|
+
) : isEmpty ? (
|
|
26
|
+
<Center gap={12} padding={40}>
|
|
27
|
+
{error ? (
|
|
28
|
+
<>
|
|
29
|
+
<Icon icon={ServerCrash} size={{ fontSize: 80 }} />
|
|
30
|
+
{t('store.networkError')}
|
|
31
|
+
</>
|
|
32
|
+
) : (
|
|
33
|
+
<Empty description={t('store.empty')} image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
|
34
|
+
)}
|
|
35
|
+
</Center>
|
|
36
|
+
) : (
|
|
37
|
+
<Virtuoso
|
|
38
|
+
itemContent={(index) => {
|
|
39
|
+
const item = data![index];
|
|
40
|
+
return <Item key={item.id} {...item} />;
|
|
41
|
+
}}
|
|
42
|
+
overscan={400}
|
|
43
|
+
style={{ height: 500, marginInline: -16 }}
|
|
44
|
+
totalCount={data!.length}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export default List;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Skeleton } from 'antd';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { Flexbox } from 'react-layout-kit';
|
|
4
|
+
|
|
5
|
+
const Loading = memo(() => {
|
|
6
|
+
return (
|
|
7
|
+
<Flexbox>
|
|
8
|
+
<Skeleton paragraph={{ rows: 8 }} />
|
|
9
|
+
</Flexbox>
|
|
10
|
+
);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export default Loading;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Modal } from '@lobehub/ui';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Flexbox } from 'react-layout-kit';
|
|
5
|
+
|
|
6
|
+
import { useServerConfigStore } from '@/store/serverConfig';
|
|
7
|
+
|
|
8
|
+
import List from './List';
|
|
9
|
+
|
|
10
|
+
interface AssignKnowledgeBaseProps {
|
|
11
|
+
open?: boolean;
|
|
12
|
+
setOpen: (open: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
export const AssignKnowledgeBaseModal = memo<AssignKnowledgeBaseProps>(({ setOpen, open }) => {
|
|
15
|
+
const { t } = useTranslation('chat');
|
|
16
|
+
const mobile = useServerConfigStore((s) => s.isMobile);
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Modal
|
|
20
|
+
allowFullscreen
|
|
21
|
+
footer={null}
|
|
22
|
+
onCancel={() => {
|
|
23
|
+
setOpen(false);
|
|
24
|
+
}}
|
|
25
|
+
open={open}
|
|
26
|
+
styles={{ body: { overflow: 'hidden' } }}
|
|
27
|
+
title={t('knowledgeBase.library.title')}
|
|
28
|
+
width={600}
|
|
29
|
+
>
|
|
30
|
+
<Flexbox
|
|
31
|
+
gap={mobile ? 8 : 16}
|
|
32
|
+
style={{ maxHeight: mobile ? '-webkit-fill-available' : 'inherit' }}
|
|
33
|
+
width={'100%'}
|
|
34
|
+
>
|
|
35
|
+
<List />
|
|
36
|
+
</Flexbox>
|
|
37
|
+
</Modal>
|
|
38
|
+
);
|
|
39
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Button, Form, Input } from 'antd';
|
|
2
|
+
import { css, cx } from 'antd-style';
|
|
3
|
+
import { memo, useState } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Flexbox } from 'react-layout-kit';
|
|
6
|
+
|
|
7
|
+
import { useKnowledgeBaseStore } from '@/store/knowledgeBase';
|
|
8
|
+
import { CreateKnowledgeBaseParams } from '@/types/knowledgeBase';
|
|
9
|
+
|
|
10
|
+
const formItem = css`
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: 12px;
|
|
14
|
+
|
|
15
|
+
.ant-form-item {
|
|
16
|
+
margin-block-end: 0;
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
interface CreateFormProps {
|
|
21
|
+
onClose?: () => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const CreateForm = memo<CreateFormProps>(({ onClose }) => {
|
|
25
|
+
const { t } = useTranslation('knowledgeBase');
|
|
26
|
+
const [loading, setLoading] = useState(false);
|
|
27
|
+
const createNewKnowledgeBase = useKnowledgeBaseStore((s) => s.createNewKnowledgeBase);
|
|
28
|
+
|
|
29
|
+
const onFinish = async (values: CreateKnowledgeBaseParams) => {
|
|
30
|
+
setLoading(true);
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
await createNewKnowledgeBase(values);
|
|
34
|
+
setLoading(false);
|
|
35
|
+
onClose?.();
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.error(e);
|
|
38
|
+
setLoading(false);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Flexbox gap={8}>
|
|
44
|
+
<div>{t('createNew.formTitle')}</div>
|
|
45
|
+
<Form className={cx(formItem)} onFinish={onFinish}>
|
|
46
|
+
<Form.Item
|
|
47
|
+
name={'name'}
|
|
48
|
+
rules={[{ message: t('createNew.name.required'), required: true }]}
|
|
49
|
+
>
|
|
50
|
+
<Input autoFocus placeholder={t('createNew.name.placeholder')} variant={'filled'} />
|
|
51
|
+
</Form.Item>
|
|
52
|
+
<Form.Item name={'description'}>
|
|
53
|
+
<Input.TextArea
|
|
54
|
+
placeholder={t('createNew.description.placeholder')}
|
|
55
|
+
style={{ minHeight: 120 }}
|
|
56
|
+
variant={'filled'}
|
|
57
|
+
/>
|
|
58
|
+
</Form.Item>
|
|
59
|
+
<Button
|
|
60
|
+
block
|
|
61
|
+
htmlType={'submit'}
|
|
62
|
+
loading={loading}
|
|
63
|
+
style={{ marginTop: 16 }}
|
|
64
|
+
type={'primary'}
|
|
65
|
+
>
|
|
66
|
+
{t('createNew.confirm')}
|
|
67
|
+
</Button>
|
|
68
|
+
</Form>
|
|
69
|
+
</Flexbox>
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export default CreateForm;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Icon } from '@lobehub/ui';
|
|
2
|
+
import { LibraryBig } from 'lucide-react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Flexbox } from 'react-layout-kit';
|
|
5
|
+
|
|
6
|
+
import { createModal } from '@/components/FunctionModal';
|
|
7
|
+
|
|
8
|
+
import CreateForm from './CreateForm';
|
|
9
|
+
|
|
10
|
+
const Title = () => {
|
|
11
|
+
const { t } = useTranslation('knowledgeBase');
|
|
12
|
+
return (
|
|
13
|
+
<Flexbox gap={8} horizontal>
|
|
14
|
+
<Icon icon={LibraryBig} />
|
|
15
|
+
{t('createNew.title')}
|
|
16
|
+
</Flexbox>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const useCreateNewModal = createModal((instance) => {
|
|
21
|
+
return {
|
|
22
|
+
content: (
|
|
23
|
+
<Flexbox paddingInline={16} style={{ marginBlock: 24 }}>
|
|
24
|
+
<CreateForm
|
|
25
|
+
onClose={() => {
|
|
26
|
+
instance.current?.destroy();
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
</Flexbox>
|
|
30
|
+
),
|
|
31
|
+
focusTriggerAfterClose: true,
|
|
32
|
+
footer: false,
|
|
33
|
+
title: <Title />,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PDFLoader } from '@langchain/community/document_loaders/fs/pdf';
|
|
2
2
|
|
|
3
|
-
export const PdfLoader = async (
|
|
4
|
-
const loader = new PDFLoader(
|
|
3
|
+
export const PdfLoader = async (fileBlob: Blob) => {
|
|
4
|
+
const loader = new PDFLoader(fileBlob);
|
|
5
5
|
|
|
6
6
|
return await loader.load();
|
|
7
7
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TRPCError } from '@trpc/server';
|
|
2
|
+
|
|
3
|
+
import { serverDBEnv } from '@/config/db';
|
|
4
|
+
import { UserModel } from '@/database/server/models/user';
|
|
5
|
+
|
|
6
|
+
import { asyncTrpc } from './init';
|
|
7
|
+
|
|
8
|
+
export const asyncAuth = asyncTrpc.middleware(async (opts) => {
|
|
9
|
+
const { ctx } = opts;
|
|
10
|
+
|
|
11
|
+
if (ctx.secret !== serverDBEnv.KEY_VAULTS_SECRET || !ctx.userId) {
|
|
12
|
+
throw new TRPCError({ code: 'UNAUTHORIZED' });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const result = await UserModel.findById(ctx.userId);
|
|
16
|
+
|
|
17
|
+
if (!result) {
|
|
18
|
+
throw new TRPCError({ code: 'UNAUTHORIZED', message: 'user is invalid' });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return opts.next({
|
|
22
|
+
ctx: { userId: ctx.userId },
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { asyncAuth } from './asyncAuth';
|
|
2
|
+
import { asyncTrpc } from './init';
|
|
3
|
+
|
|
4
|
+
export const publicProcedure = asyncTrpc.procedure;
|
|
5
|
+
|
|
6
|
+
export const asyncRouter = asyncTrpc.router;
|
|
7
|
+
|
|
8
|
+
export const asyncAuthedProcedure = asyncTrpc.procedure.use(asyncAuth);
|
|
9
|
+
|
|
10
|
+
export const createAsyncCallerFactory = asyncTrpc.createCallerFactory;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { initTRPC } from '@trpc/server';
|
|
2
|
+
import superjson from 'superjson';
|
|
3
|
+
|
|
4
|
+
import { AsyncContext } from '@/server/asyncContext';
|
|
5
|
+
|
|
6
|
+
export const asyncTrpc = initTRPC.context<AsyncContext>().create({
|
|
7
|
+
errorFormatter({ shape }) {
|
|
8
|
+
return shape;
|
|
9
|
+
},
|
|
10
|
+
transformer: superjson,
|
|
11
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createTRPCClient, httpBatchLink } from '@trpc/client';
|
|
2
|
+
import superjson from 'superjson';
|
|
3
|
+
|
|
4
|
+
import { AsyncRouter } from '@/server/routers/async';
|
|
5
|
+
|
|
6
|
+
export const asyncClient = createTRPCClient<AsyncRouter>({
|
|
7
|
+
links: [
|
|
8
|
+
httpBatchLink({
|
|
9
|
+
maxURLLength: 2083,
|
|
10
|
+
transformer: superjson,
|
|
11
|
+
url: '/trpc/async',
|
|
12
|
+
}),
|
|
13
|
+
],
|
|
14
|
+
});
|
|
@@ -3,6 +3,7 @@ import { createTRPCReact } from '@trpc/react-query';
|
|
|
3
3
|
import superjson from 'superjson';
|
|
4
4
|
|
|
5
5
|
import { fetchErrorNotification } from '@/components/FetchErrorNotification';
|
|
6
|
+
import { ModelProvider } from '@/libs/agent-runtime';
|
|
6
7
|
import type { LambdaRouter } from '@/server/routers/lambda';
|
|
7
8
|
|
|
8
9
|
import { ErrorResponse } from './types';
|
|
@@ -24,6 +25,14 @@ const links = [
|
|
|
24
25
|
|
|
25
26
|
return response;
|
|
26
27
|
},
|
|
28
|
+
headers: async () => {
|
|
29
|
+
// dynamic import to avoid circular dependency
|
|
30
|
+
const { createHeaderWithAuth } = await import('@/services/_auth');
|
|
31
|
+
|
|
32
|
+
// TODO: we need to support provider select
|
|
33
|
+
return createHeaderWithAuth({ provider: ModelProvider.OpenAI });
|
|
34
|
+
},
|
|
35
|
+
maxURLLength: 2083,
|
|
27
36
|
transformer: superjson,
|
|
28
37
|
url: '/trpc/lambda',
|
|
29
38
|
}),
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TRPCError } from '@trpc/server';
|
|
2
|
+
|
|
3
|
+
import { getJWTPayload } from '@/app/api/middleware/auth/utils';
|
|
4
|
+
import { trpc } from '@/libs/trpc/init';
|
|
5
|
+
|
|
6
|
+
export const keyVaults = trpc.middleware(async (opts) => {
|
|
7
|
+
const { ctx } = opts;
|
|
8
|
+
|
|
9
|
+
if (!ctx.authorizationHeader) throw new TRPCError({ code: 'UNAUTHORIZED' });
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
const jwtPayload = await getJWTPayload(ctx.authorizationHeader);
|
|
13
|
+
|
|
14
|
+
return opts.next({ ctx: { jwtPayload } });
|
|
15
|
+
} catch (e) {
|
|
16
|
+
throw new TRPCError({ code: 'UNAUTHORIZED', message: (e as Error).message });
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -52,16 +52,6 @@ describe('Unstructured', () => {
|
|
|
52
52
|
const customUnstructured = new Unstructured('custom-api-key');
|
|
53
53
|
expect(customUnstructured).toBeInstanceOf(Unstructured);
|
|
54
54
|
});
|
|
55
|
-
|
|
56
|
-
it('should throw an error if no API key is provided or in environment', () => {
|
|
57
|
-
let defaultKey = UNSTRUCTURED_API_KEY;
|
|
58
|
-
UNSTRUCTURED_API_KEY = '';
|
|
59
|
-
|
|
60
|
-
expect(() => new Unstructured()).toThrow(
|
|
61
|
-
'"UNSTRUCTURED_API_KEY" variables are not set completely, please check your env',
|
|
62
|
-
);
|
|
63
|
-
UNSTRUCTURED_API_KEY = defaultKey;
|
|
64
|
-
});
|
|
65
55
|
});
|
|
66
56
|
|
|
67
57
|
describe('basic partition', () => {
|
|
@@ -43,12 +43,12 @@ export interface Coordinates {
|
|
|
43
43
|
system: string;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
class UnstructuredError extends Error {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
46
|
+
// class UnstructuredError extends Error {
|
|
47
|
+
// constructor(message: string) {
|
|
48
|
+
// super(message);
|
|
49
|
+
// this.name = 'Unstructured';
|
|
50
|
+
// }
|
|
51
|
+
// }
|
|
52
52
|
|
|
53
53
|
interface PartitionParameters {
|
|
54
54
|
chunkingStrategy?: ChunkingStrategy;
|
|
@@ -63,11 +63,6 @@ export class Unstructured {
|
|
|
63
63
|
private client: UnstructuredClient;
|
|
64
64
|
|
|
65
65
|
constructor(apikey?: string) {
|
|
66
|
-
if (!apikey && !knowledgeEnv.UNSTRUCTURED_API_KEY)
|
|
67
|
-
throw new UnstructuredError(
|
|
68
|
-
`"UNSTRUCTURED_API_KEY" variables are not set completely, please check your env`,
|
|
69
|
-
);
|
|
70
|
-
|
|
71
66
|
this.client = new UnstructuredClient({
|
|
72
67
|
security: { apiKeyAuth: apikey || knowledgeEnv.UNSTRUCTURED_API_KEY! },
|
|
73
68
|
serverURL: knowledgeEnv.UNSTRUCTURED_SERVER_URL,
|
|
@@ -37,6 +37,25 @@ export default {
|
|
|
37
37
|
stop: '停止',
|
|
38
38
|
warp: '换行',
|
|
39
39
|
},
|
|
40
|
+
knowledgeBase: {
|
|
41
|
+
all: '所有内容',
|
|
42
|
+
allFiles: '所有文件',
|
|
43
|
+
allKnowledgeBases: '所有知识库',
|
|
44
|
+
disabled:
|
|
45
|
+
'当前部署模式不支持知识库对话,如需使用,请切换到服务端数据库部署或使用 LobeChat Cloud 服务',
|
|
46
|
+
library: {
|
|
47
|
+
action: {
|
|
48
|
+
add: '添加',
|
|
49
|
+
detail: '详情',
|
|
50
|
+
remove: '移除',
|
|
51
|
+
},
|
|
52
|
+
title: '文件/知识库',
|
|
53
|
+
},
|
|
54
|
+
relativeFilesOrKnowledgeBases: '关联文件/知识库',
|
|
55
|
+
title: '知识库',
|
|
56
|
+
uploadGuide: '上传过的文件可以在「知识库」中查看哦',
|
|
57
|
+
viewMore: '查看更多',
|
|
58
|
+
},
|
|
40
59
|
messageAction: {
|
|
41
60
|
delAndRegenerate: '删除并重新生成',
|
|
42
61
|
regenerate: '重新生成',
|
|
@@ -44,6 +63,15 @@ export default {
|
|
|
44
63
|
newAgent: '新建助手',
|
|
45
64
|
pin: '置顶',
|
|
46
65
|
pinOff: '取消置顶',
|
|
66
|
+
rag: {
|
|
67
|
+
referenceChunks: '引用源',
|
|
68
|
+
userQuery: {
|
|
69
|
+
actions: {
|
|
70
|
+
delete: '删除 Query 重写',
|
|
71
|
+
regenerate: '重新生成 Query',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
47
75
|
regenerate: '重新生成',
|
|
48
76
|
roleAndArchive: '角色与记录',
|
|
49
77
|
searchAgentPlaceholder: '搜索助手和对话...',
|
|
@@ -130,8 +158,24 @@ export default {
|
|
|
130
158
|
},
|
|
131
159
|
updateAgent: '更新助理信息',
|
|
132
160
|
upload: {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
161
|
+
action: {
|
|
162
|
+
fileUpload: '上传文件',
|
|
163
|
+
folderUpload: '上传文件夹',
|
|
164
|
+
imageDisabled: '当前模型不支持视觉识别,请切换模型后使用',
|
|
165
|
+
imageUpload: '上传图片',
|
|
166
|
+
tooltip: '上传',
|
|
167
|
+
},
|
|
168
|
+
clientMode: {
|
|
169
|
+
actionFiletip: '上传文件',
|
|
170
|
+
actionTooltip: '上传',
|
|
171
|
+
disabled: '当前模型不支持视觉识别和文件分析,请切换模型后使用',
|
|
172
|
+
},
|
|
173
|
+
preview: {
|
|
174
|
+
prepareTasks: '准备分块...',
|
|
175
|
+
status: {
|
|
176
|
+
pending: '准备上传...',
|
|
177
|
+
processing: '文件处理中...',
|
|
178
|
+
},
|
|
179
|
+
},
|
|
136
180
|
},
|
|
137
181
|
};
|
|
@@ -138,5 +138,10 @@ export default {
|
|
|
138
138
|
password: '密码',
|
|
139
139
|
},
|
|
140
140
|
},
|
|
141
|
-
upload: {
|
|
141
|
+
upload: {
|
|
142
|
+
desc: '详情: {{detail}}',
|
|
143
|
+
fileOnlySupportInServerMode:
|
|
144
|
+
'当前部署模式不支持上传非图片文件,如需上传 {{ext}} 格式,请切换到服务端数据库部署或使用 LobeChat Cloud 服务',
|
|
145
|
+
title: '文件上传失败,请检查网络连接或稍后再试',
|
|
146
|
+
},
|
|
142
147
|
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
desc: '管理你的文件与知识库',
|
|
3
|
+
detail: {
|
|
4
|
+
basic: {
|
|
5
|
+
createdAt: '创建时间',
|
|
6
|
+
filename: '文件名',
|
|
7
|
+
size: '文件大小',
|
|
8
|
+
title: '基本信息',
|
|
9
|
+
type: '格式',
|
|
10
|
+
updatedAt: '更新时间',
|
|
11
|
+
},
|
|
12
|
+
data: {
|
|
13
|
+
chunkCount: '分块数',
|
|
14
|
+
embedding: {
|
|
15
|
+
default: '暂未向量化',
|
|
16
|
+
error: '失败',
|
|
17
|
+
pending: '待启动',
|
|
18
|
+
processing: '进行中',
|
|
19
|
+
success: '已完成',
|
|
20
|
+
},
|
|
21
|
+
embeddingStatus: '向量化',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
header: {
|
|
25
|
+
actions: {
|
|
26
|
+
newFolder: '新建文件夹',
|
|
27
|
+
uploadFile: '上传文件',
|
|
28
|
+
uploadFolder: '上传文件夹',
|
|
29
|
+
},
|
|
30
|
+
uploadButton: '上传',
|
|
31
|
+
},
|
|
32
|
+
knowledgeBase: {
|
|
33
|
+
list: {
|
|
34
|
+
confirmRemoveKnowledgeBase:
|
|
35
|
+
'即将删除该知识库,其中的文件不会删除,将移入全部文件中。知识库删除后将不可恢复,请谨慎操作。',
|
|
36
|
+
empty: '点击 <1>+</1> 开始创建知识库',
|
|
37
|
+
},
|
|
38
|
+
new: '新建知识库',
|
|
39
|
+
title: '知识库',
|
|
40
|
+
},
|
|
41
|
+
notSupportGuide: {
|
|
42
|
+
desc: '当前部署实例为客户端数据库模式,无法使用文件管理功能。请切换到<1>服务端数据库部署模式</1>,或直接使用 <3>LobeChat Cloud</3>',
|
|
43
|
+
features: {
|
|
44
|
+
allKind: {
|
|
45
|
+
desc: '支持主流文件类型,包括 Word、PPT、Excel、PDF、TXT 等常见文档格式,以及JS、Python 等主流代码文件',
|
|
46
|
+
title: '多种文件类型解析',
|
|
47
|
+
},
|
|
48
|
+
embeddings: {
|
|
49
|
+
desc: '使用高性能向量模型,对文本分块进行向量化,实现文件内容的语义化检索',
|
|
50
|
+
title: '向量语义化',
|
|
51
|
+
},
|
|
52
|
+
repos: {
|
|
53
|
+
desc: '支持创建知识库,并允许添加不同类型的文件,构建属于你的领域知识',
|
|
54
|
+
title: '知识库',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
title: '当前部署模式不支持文件管理',
|
|
58
|
+
},
|
|
59
|
+
preview: {
|
|
60
|
+
unsupportedFile: '此文件格式不支持在线预览',
|
|
61
|
+
},
|
|
62
|
+
searchFilePlaceholder: '搜索文件',
|
|
63
|
+
tab: {
|
|
64
|
+
all: '全部文件',
|
|
65
|
+
audios: '语音',
|
|
66
|
+
documents: '文档',
|
|
67
|
+
images: '图片',
|
|
68
|
+
videos: '视频',
|
|
69
|
+
websites: '网页',
|
|
70
|
+
},
|
|
71
|
+
title: '文件',
|
|
72
|
+
uploadDock: {
|
|
73
|
+
body: {
|
|
74
|
+
collapse: '收起',
|
|
75
|
+
item: {
|
|
76
|
+
done: '已上传',
|
|
77
|
+
error: '上传失败,请重试',
|
|
78
|
+
pending: '准备上传...',
|
|
79
|
+
processing: '文件处理中...',
|
|
80
|
+
restTime: '剩余 {{time}}',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
totalCount: '共 {{count}} 项',
|
|
84
|
+
uploadStatus: {
|
|
85
|
+
error: '上传出错',
|
|
86
|
+
pending: '等待上传',
|
|
87
|
+
processing: '正在上传',
|
|
88
|
+
success: '上传完成',
|
|
89
|
+
uploading: '正在上传',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -5,6 +5,8 @@ import clerk from './clerk';
|
|
|
5
5
|
import common from './common';
|
|
6
6
|
import components from './components';
|
|
7
7
|
import error from './error';
|
|
8
|
+
import file from './file';
|
|
9
|
+
import knowledgeBase from './knowledgeBase';
|
|
8
10
|
import market from './market';
|
|
9
11
|
import metadata from './metadata';
|
|
10
12
|
import migration from './migration';
|
|
@@ -21,6 +23,8 @@ const resources = {
|
|
|
21
23
|
common,
|
|
22
24
|
components,
|
|
23
25
|
error,
|
|
26
|
+
file,
|
|
27
|
+
knowledgeBase,
|
|
24
28
|
market,
|
|
25
29
|
metadata,
|
|
26
30
|
migration,
|