@gientech/modual 2.0.5 → 2.0.6
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/README.md +118 -0
- package/{dist/chat.js → chat.js} +98 -98
- package/package.json +41 -103
- package/.editorconfig +0 -38
- package/.prettierignore +0 -16
- package/.prettierrc +0 -17
- package/USAGE.md +0 -247
- package/bash.exe.stackdump +0 -40
- package/components.json +0 -21
- package/dist/README.md +0 -643
- package/dist/package.json +0 -68
- package/doc_assets/2.png +0 -0
- package/doc_assets/demo.md +0 -27
- package/doc_assets/demos/dist-app/assets/index.Dh-ZAS9Z.css +0 -2
- package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js +0 -23699
- package/doc_assets/demos/dist-app/assets/index.Dv8KVW18.js.map +0 -1
- package/doc_assets/demos/dist-app/index.html +0 -14
- package/doc_assets/demos/dist-app/vite.svg +0 -1
- package/doc_assets/images/1.png +0 -0
- package/doc_assets/images/3.png +0 -0
- package/doc_assets/images/component-screenshot.png +0 -1
- package/doc_assets/install.md +0 -5
- package/doc_assets//346/226/271/346/241/210//344/274/230/345/214/226/346/226/271/346/241/210-/345/244/232/344/274/232/350/257/235SSE/350/277/236/346/216/245/347/256/241/347/220/206.md +0 -504
- package/eslint.config.js +0 -92
- package/index.html +0 -13
- package/package.json.demo-backup +0 -109
- package/postcss.config.cjs +0 -19
- package/public/icons/answerAwartar.png +0 -0
- package/public/icons/docx-file.png +0 -0
- package/public/icons/folder.png +0 -0
- package/public/icons/html.png +0 -0
- package/public/icons/image.png +0 -0
- package/public/icons/jpg-file.png +0 -0
- package/public/icons/json.png +0 -0
- package/public/icons/md.png +0 -0
- package/public/icons/pdf.png +0 -0
- package/public/icons/pptx.png +0 -0
- package/public/icons/questionAwartar.png +0 -0
- package/public/icons/sheets.png +0 -0
- package/public/icons/txt.png +0 -0
- package/public/icons/xlsx.png +0 -0
- package/public/vite.svg +0 -1
- package/public/worker/pdf.worker.min.js +0 -22
- package/scripts/README.md +0 -133
- package/scripts/build-demo.js +0 -88
- package/scripts/decrypt-api-key.js +0 -95
- package/scripts/demo-selector.js +0 -216
- package/scripts/dev-demo.js +0 -76
- package/scripts/preview-demo.js +0 -130
- package/scripts/run-demo.bat +0 -34
- package/src/assets/img/close.png +0 -0
- package/src/assets/img/database.png +0 -0
- package/src/assets/img/downArrow.png +0 -0
- package/src/assets/img/downLoad.png +0 -0
- package/src/assets/img/excel.png +0 -0
- package/src/assets/img/graphIcon.png +0 -0
- package/src/assets/img/img.png +0 -0
- package/src/assets/img/pdf.png +0 -0
- package/src/assets/img/ppt.png +0 -0
- package/src/assets/img/singleQa.png +0 -0
- package/src/assets/img/txt.png +0 -0
- package/src/assets/img/webSearch.png +0 -0
- package/src/assets/img/word.png +0 -0
- package/src/assets/login/homeBg.png +0 -0
- package/src/assets/login/left.jpg +0 -0
- package/src/assets/login/logoImg.png +0 -0
- package/src/examples/ConversationAssistantPage/index.tsx +0 -41
- package/src/examples/Demo/index.tsx +0 -12
- package/src/examples/LoginPage/index.tsx +0 -18
- package/src/examples/chat/components/DrawerGraphPreview.tsx +0 -78
- package/src/examples/chat/index.tsx +0 -154
- package/src/examples/chat/logo03.png +0 -0
- package/src/examples/gientechStreamFilesReader/index.tsx +0 -951
- package/src/examples/headlessChat/index.tsx +0 -234
- package/src/examples/ragDatabaseDataPage/index.tsx +0 -40
- package/src/examples/ragDatabaseIdPage/index.tsx +0 -47
- package/src/examples/ragDatabasePage/index.tsx +0 -36
- package/src/examples/ragModelManagePage/index.tsx +0 -38
- package/src/examples/ragSearchPage/index.tsx +0 -0
- package/src/examples/ragSensitiveWordsPage/index.tsx +0 -32
- package/src/examples/streamFiles/index.tsx +0 -417
- package/src/lib_enter.ts +0 -43
- package/src/main.tsx +0 -5
- package/src/main.tsx.backup +0 -5
- package/src/modules/CHAT_UNIFICATION_PLAN.md +0 -324
- package/src/modules/assistantConfig/assets/databse.svg +0 -6
- package/src/modules/assistantConfig/assets/empty.png +0 -0
- package/src/modules/assistantConfig/assets/graph.svg +0 -4
- package/src/modules/assistantConfig/assets/knowledge.svg +0 -4
- package/src/modules/assistantConfig/assets/sensitive.svg +0 -5
- package/src/modules/assistantConfig/components/Database.tsx +0 -171
- package/src/modules/assistantConfig/components/Graph.tsx +0 -177
- package/src/modules/assistantConfig/components/Knowledge.tsx +0 -276
- package/src/modules/assistantConfig/components/NotFoundContent.tsx +0 -21
- package/src/modules/assistantConfig/components/Paragraph.tsx +0 -51
- package/src/modules/assistantConfig/components/ParamsItem.tsx +0 -39
- package/src/modules/assistantConfig/components/ResourceBinderItem.tsx +0 -133
- package/src/modules/assistantConfig/components/SearchableSelector.tsx +0 -500
- package/src/modules/assistantConfig/components/Sensitive.tsx +0 -221
- package/src/modules/assistantConfig/components/SliderInput.tsx +0 -65
- package/src/modules/assistantConfig/constants.tsx +0 -75
- package/src/modules/assistantConfig/index.tsx +0 -710
- package/src/modules/assistantConfig/server.ts +0 -262
- package/src/modules/chat/Conversations/Item.tsx +0 -167
- package/src/modules/chat/Conversations/List.tsx +0 -210
- package/src/modules/chat/Conversations/groupByTime.ts +0 -39
- package/src/modules/chat/Conversations/index.tsx +0 -252
- package/src/modules/chat/ReferenceBar.tsx +0 -622
- package/src/modules/chat/constants.tsx +0 -52
- package/src/modules/chat/data.txt +0 -82
- package/src/modules/chat/index.tsx +0 -2054
- package/src/modules/chat/referenceCom/DeleteModal.tsx +0 -75
- package/src/modules/chat/referenceCom/DrawerContent.tsx +0 -136
- package/src/modules/chat/referenceCom/DrawerDatabase.tsx +0 -102
- package/src/modules/chat/referenceCom/DrawerGraphPreview.tsx +0 -86
- package/src/modules/chat/referenceCom/DrawerPreview.tsx +0 -73
- package/src/modules/chat/referenceCom/DrawerTitle.tsx +0 -26
- package/src/modules/chat/referenceCom/RenameModal.tsx +0 -86
- package/src/modules/chat/referenceCom/TagCom.tsx +0 -30
- package/src/modules/chat/style.less +0 -3
- package/src/modules/chat/types.ts +0 -17
- package/src/modules/chat/utils/index.ts +0 -348
- package/src/modules/database/CreateModal.tsx +0 -403
- package/src/modules/database/assets/Doris.png +0 -0
- package/src/modules/database/assets/PostgreSQL.png +0 -0
- package/src/modules/database/assets/SQLServer.png +0 -0
- package/src/modules/database/assets/database.svg +0 -11
- package/src/modules/database/assets/database_add.svg +0 -53
- package/src/modules/database/assets/database_connect.svg +0 -66
- package/src/modules/database/assets/database_upload.svg +0 -29
- package/src/modules/database/assets/empty.png +0 -0
- package/src/modules/database/assets/mysql.svg +0 -14
- package/src/modules/database/index.tsx +0 -477
- package/src/modules/database/server.ts +0 -196
- package/src/modules/databaseId/CustomCom.tsx +0 -156
- package/src/modules/databaseId/EditConfig.tsx +0 -280
- package/src/modules/databaseId/UploadDrawer.tsx +0 -535
- package/src/modules/databaseId/assets/aiOptimize.svg +0 -10
- package/src/modules/databaseId/assets/empty.png +0 -0
- package/src/modules/databaseId/assets/template.svg +0 -6
- package/src/modules/databaseId/assets/upload.svg +0 -9
- package/src/modules/databaseId/assets/useTemp.svg +0 -6
- package/src/modules/databaseId/index.tsx +0 -769
- package/src/modules/databaseId/server.ts +0 -286
- package/src/modules/databaseId/style.css +0 -5
- package/src/modules/databaseTable/EditRowDrawer.tsx +0 -124
- package/src/modules/databaseTable/index.tsx +0 -359
- package/src/modules/databaseTable/server.ts +0 -180
- package/src/modules/headlessChat/ReferenceBar.tsx +0 -783
- package/src/modules/headlessChat/constants.tsx +0 -54
- package/src/modules/headlessChat/index.tsx +0 -1706
- package/src/modules/headlessChat/referenceCom/DeleteModal.tsx +0 -75
- package/src/modules/headlessChat/referenceCom/DrawerContent.tsx +0 -136
- package/src/modules/headlessChat/referenceCom/DrawerDatabase.tsx +0 -102
- package/src/modules/headlessChat/referenceCom/DrawerGraphPreview.tsx +0 -86
- package/src/modules/headlessChat/referenceCom/DrawerPreview.tsx +0 -73
- package/src/modules/headlessChat/referenceCom/DrawerTitle.tsx +0 -26
- package/src/modules/headlessChat/referenceCom/RenameModal.tsx +0 -86
- package/src/modules/headlessChat/referenceCom/TagCom.tsx +0 -30
- package/src/modules/headlessChat/style.less +0 -3
- package/src/modules/headlessChat/types.ts +0 -23
- package/src/modules/headlessChat/utils/index.ts +0 -348
- package/src/modules/login/components/Login/LoginBox/index.tsx +0 -102
- package/src/modules/login/components/Login/RegisterBox/index.tsx +0 -180
- package/src/modules/login/components/Login/index.tsx +0 -100
- package/src/modules/login/index.tsx +0 -106
- package/src/modules/login/style.css +0 -3
- package/src/modules/login/useServices.ts +0 -53
- package/src/modules/login/utils.ts +0 -42
- package/src/modules/modelManage/ConfigDrawer.tsx +0 -249
- package/src/modules/modelManage/ReplaceModal.tsx +0 -124
- package/src/modules/modelManage/assets/empty.png +0 -0
- package/src/modules/modelManage/const.ts +0 -51
- package/src/modules/modelManage/index.tsx +0 -606
- package/src/modules/modelManage/server.ts +0 -223
- package/src/modules/nodegraph/index.tsx +0 -1
- package/src/modules/search/assets/Icon-history.svg +0 -8
- package/src/modules/search/assets/answerAwartar.png +0 -0
- package/src/modules/search/assets/doc.png +0 -0
- package/src/modules/search/assets/genera.gif +0 -0
- package/src/modules/search/assets/icon-robot.svg +0 -9
- package/src/modules/search/assets/icon-search-bar.svg +0 -14
- package/src/modules/search/assets/icon-sub-title.svg +0 -3
- package/src/modules/search/assets/icon-title.svg +0 -9
- package/src/modules/search/assets/icon-zoomOut.svg +0 -9
- package/src/modules/search/assets/iconAi.svg +0 -9
- package/src/modules/search/assets/pdf.png +0 -0
- package/src/modules/search/assets/ppt.png +0 -0
- package/src/modules/search/assets/search.svg +0 -3
- package/src/modules/search/assets/selected.svg +0 -4
- package/src/modules/search/assets/txt.png +0 -0
- package/src/modules/search/assets/xls.png +0 -0
- package/src/modules/search/components/AssisSelect.tsx +0 -137
- package/src/modules/search/components/Editor/ChatViewEditor.tsx +0 -261
- package/src/modules/search/components/Editor/aichat.css +0 -1
- package/src/modules/search/components/Editor/constant.ts +0 -13
- package/src/modules/search/components/Editor/index.tsx +0 -113
- package/src/modules/search/components/Editor/plugins/autofomatRules.ts +0 -332
- package/src/modules/search/components/Editor/plugins/convertImgPlugins.tsx +0 -20
- package/src/modules/search/components/Editor/plugins/createIndexes.tsx +0 -38
- package/src/modules/search/components/Editor/plugins/displayer.ts +0 -298
- package/src/modules/search/components/Editor/plugins/imageClick.tsx +0 -32
- package/src/modules/search/components/Editor/plugins/myplugin.tsx +0 -98
- package/src/modules/search/components/Editor/ui/avatar.tsx +0 -19
- package/src/modules/search/components/Editor/ui/blockquote-element.tsx +0 -21
- package/src/modules/search/components/Editor/ui/button.tsx +0 -58
- package/src/modules/search/components/Editor/ui/calendar.tsx +0 -68
- package/src/modules/search/components/Editor/ui/caption.tsx +0 -46
- package/src/modules/search/components/Editor/ui/checkbox.tsx +0 -27
- package/src/modules/search/components/Editor/ui/code-block-combobox.tsx +0 -188
- package/src/modules/search/components/Editor/ui/code-block-element.css +0 -434
- package/src/modules/search/components/Editor/ui/code-block-element.tsx +0 -39
- package/src/modules/search/components/Editor/ui/code-leaf.tsx +0 -24
- package/src/modules/search/components/Editor/ui/code-line-element.tsx +0 -10
- package/src/modules/search/components/Editor/ui/code-syntax-leaf.tsx +0 -21
- package/src/modules/search/components/Editor/ui/column-element.tsx +0 -30
- package/src/modules/search/components/Editor/ui/column-group-element.tsx +0 -94
- package/src/modules/search/components/Editor/ui/command.tsx +0 -75
- package/src/modules/search/components/Editor/ui/comment-avatar.tsx +0 -22
- package/src/modules/search/components/Editor/ui/comment-create-form.tsx +0 -37
- package/src/modules/search/components/Editor/ui/comment-item.tsx +0 -74
- package/src/modules/search/components/Editor/ui/comment-leaf.tsx +0 -49
- package/src/modules/search/components/Editor/ui/comment-more-dropdown.tsx +0 -42
- package/src/modules/search/components/Editor/ui/comment-reply-items.tsx +0 -22
- package/src/modules/search/components/Editor/ui/comment-resolve-button.tsx +0 -32
- package/src/modules/search/components/Editor/ui/comment-value.tsx +0 -34
- package/src/modules/search/components/Editor/ui/comments-popover.tsx +0 -63
- package/src/modules/search/components/Editor/ui/date-element.tsx +0 -83
- package/src/modules/search/components/Editor/ui/dialog.tsx +0 -63
- package/src/modules/search/components/Editor/ui/draggable.tsx +0 -177
- package/src/modules/search/components/Editor/ui/dropdown-menu.tsx +0 -180
- package/src/modules/search/components/Editor/ui/emoji-input-element.tsx +0 -85
- package/src/modules/search/components/Editor/ui/excalidraw-element.tsx +0 -28
- package/src/modules/search/components/Editor/ui/fixed-toolbar-buttons.tsx +0 -76
- package/src/modules/search/components/Editor/ui/fixed-toolbar.tsx +0 -8
- package/src/modules/search/components/Editor/ui/floating-toolbar-buttons.tsx +0 -51
- package/src/modules/search/components/Editor/ui/floating-toolbar.tsx +0 -77
- package/src/modules/search/components/Editor/ui/heading-element.tsx +0 -48
- package/src/modules/search/components/Editor/ui/highlight-leaf.tsx +0 -17
- package/src/modules/search/components/Editor/ui/hr-element.tsx +0 -30
- package/src/modules/search/components/Editor/ui/icons.tsx +0 -267
- package/src/modules/search/components/Editor/ui/image-element.tsx +0 -74
- package/src/modules/search/components/Editor/ui/inline-combobox.tsx +0 -368
- package/src/modules/search/components/Editor/ui/input.tsx +0 -25
- package/src/modules/search/components/Editor/ui/insert-dropdown-menu.tsx +0 -218
- package/src/modules/search/components/Editor/ui/kbd-leaf.tsx +0 -20
- package/src/modules/search/components/Editor/ui/link-element.tsx +0 -29
- package/src/modules/search/components/Editor/ui/link-floating-toolbar.tsx +0 -161
- package/src/modules/search/components/Editor/ui/list-element.tsx +0 -30
- package/src/modules/search/components/Editor/ui/mark-toolbar-button.tsx +0 -24
- package/src/modules/search/components/Editor/ui/media-embed-element.tsx +0 -133
- package/src/modules/search/components/Editor/ui/media-popover.tsx +0 -97
- package/src/modules/search/components/Editor/ui/mention-element.tsx +0 -43
- package/src/modules/search/components/Editor/ui/mention-input-element.tsx +0 -141
- package/src/modules/search/components/Editor/ui/mode-dropdown-menu.tsx +0 -93
- package/src/modules/search/components/Editor/ui/more-dropdown-menu.tsx +0 -67
- package/src/modules/search/components/Editor/ui/paragraph-element.tsx +0 -4
- package/src/modules/search/components/Editor/ui/placeholder.tsx +0 -52
- package/src/modules/search/components/Editor/ui/popover.tsx +0 -32
- package/src/modules/search/components/Editor/ui/resizable.tsx +0 -66
- package/src/modules/search/components/Editor/ui/separator.tsx +0 -25
- package/src/modules/search/components/Editor/ui/style.less +0 -12
- package/src/modules/search/components/Editor/ui/table-cell-element.tsx +0 -143
- package/src/modules/search/components/Editor/ui/table-element.tsx +0 -243
- package/src/modules/search/components/Editor/ui/table-row-element.tsx +0 -22
- package/src/modules/search/components/Editor/ui/tableValue.tsx +0 -135
- package/src/modules/search/components/Editor/ui/todo-list-element.tsx +0 -43
- package/src/modules/search/components/Editor/ui/toggle-element.tsx +0 -31
- package/src/modules/search/components/Editor/ui/toolbar.tsx +0 -157
- package/src/modules/search/components/Editor/ui/tooltip.tsx +0 -65
- package/src/modules/search/components/Editor/ui/turn-into-dropdown-menu.tsx +0 -160
- package/src/modules/search/components/Editor/ui/with-draggables.tsx +0 -175
- package/src/modules/search/components/FileList.tsx +0 -287
- package/src/modules/search/components/ImageGroupView/index.tsx +0 -85
- package/src/modules/search/components/ResultContent.tsx +0 -232
- package/src/modules/search/components/SearchInput.tsx +0 -232
- package/src/modules/search/components/SearchLanding.tsx +0 -74
- package/src/modules/search/components/SearchView.tsx +0 -563
- package/src/modules/search/components/SimpleEditor.tsx +0 -158
- package/src/modules/search/components/SimpleFileList.tsx +0 -215
- package/src/modules/search/index.tsx +0 -10
- package/src/modules/search/reademe.md +0 -1
- package/src/modules/search/servers/apis.tsx +0 -19
- package/src/modules/search/servers/index.ts +0 -184
- package/src/modules/search/style.less +0 -503
- package/src/modules/search/type.ts +0 -22
- package/src/modules/search/utils.ts +0 -34
- package/src/modules/sensitive/index.tsx +0 -313
- package/src/modules/sensitive/server.ts +0 -122
- package/src/modules/streamFilesReader/GientechStreamReader.tsx +0 -1625
- package/src/modules/streamFilesReader/components/Header/Toolbar.tsx +0 -0
- package/src/modules/streamFilesReader/components/Header/index.tsx +0 -297
- package/src/modules/streamFilesReader/index.tsx +0 -3
- package/src/style.css +0 -6
- package/src/type.d.ts +0 -0
- package/src/utils/commonFn.tsx +0 -111
- package/src/utils/decryptApiKey.ts +0 -40
- package/src/utils/gientechCommon/components/AppError.tsx +0 -32
- package/src/utils/gientechCommon/components/AppLoading.tsx +0 -75
- package/src/utils/gientechCommon/components/DeleteModal.tsx +0 -75
- package/src/utils/gientechCommon/components/DisplayError.tsx +0 -33
- package/src/utils/gientechCommon/components/DisplayLoading.tsx +0 -38
- package/src/utils/gientechCommon/components/FeedBackModal.tsx +0 -319
- package/src/utils/gientechCommon/components/FileCardCommon.tsx +0 -82
- package/src/utils/gientechCommon/components/FileManager/index.tsx +0 -400
- package/src/utils/gientechCommon/components/FileManager/style.css +0 -5
- package/src/utils/gientechCommon/components/Messages/GientechNewChatWelcome.tsx +0 -581
- package/src/utils/gientechCommon/components/Messages/ReferenceCard.tsx +0 -359
- package/src/utils/gientechCommon/components/Messages/RetriveItem.tsx +0 -245
- package/src/utils/gientechCommon/components/Messages/WebRetriveItem.tsx +0 -209
- package/src/utils/gientechCommon/components/Messages/defaultBot.png +0 -0
- package/src/utils/gientechCommon/components/Messages/defaultStyleSet.tsx +0 -148
- package/src/utils/gientechCommon/components/Messages/defaultWeLogo.svg +0 -14
- package/src/utils/gientechCommon/components/RenameModal.tsx +0 -86
- package/src/utils/gientechCommon/components/style.less +0 -11
- package/src/utils/gientechCommon/configs/commonConfig.ts +0 -2
- package/src/utils/gientechCommon/configs/senderConfig.ts +0 -0
- package/src/utils/gientechCommon/configs/stylesConfig.ts +0 -142
- package/src/utils/gientechCommon/hooks/AichatUseController.tsx +0 -417
- package/src/utils/gientechCommon/hooks/useFileDisplayTools.tsx +0 -204
- package/src/utils/gientechCommon/hooks/useFileManager.ts +0 -193
- package/src/utils/gientechCommon/slate/converters/deserializers.ts +0 -763
- package/src/utils/gientechCommon/slate/converters/mockData.ts +0 -232
- package/src/utils/gientechCommon/slate/converters/slateConverters.ts +0 -258
- package/src/utils/gientechCommon/slate/richElements/index.tsx +0 -499
- package/src/utils/gientechCommon/utils/fileUtils.ts +0 -86
- package/src/utils/gientechCommon/utils/request.ts +0 -37
- package/src/utils/gientechCommon/utils/serverFn.ts +0 -172
- package/src/utils/index.tsx +0 -142
- package/src/utils/testconfigs/demologin/index.tsx +0 -32
- package/src/utils/testconfigs/index.ts +0 -59
- package/src/vite-env.d.ts +0 -42
- package/stats.html +0 -4949
- package/tailwind.config.js +0 -170
- package/tsconfig.app.json +0 -30
- package/tsconfig.app.tsbuildinfo +0 -11
- package/tsconfig.json +0 -13
- package/tsconfig.node.json +0 -22
- package/tsconfig.node.tsbuildinfo +0 -1
- package/vite.config.app.ts +0 -93
- package/vite.config.ts +0 -232
- package/workflows/release.yml +0 -60
- package//346/215/242/350/241/214/346/240/274/345/274/217/344/277/235/346/214/201/344/274/230/345/214/226/346/226/271/346/241/210.md +0 -359
- /package/{dist/assets → assets}/Doris.png +0 -0
- /package/{dist/assets → assets}/GientechStreamReader-DUCq-O5X.js +0 -0
- /package/{dist/assets → assets}/PostgreSQL.png +0 -0
- /package/{dist/assets → assets}/SQLServer.png +0 -0
- /package/{dist/assets → assets}/database.svg +0 -0
- /package/{dist/assets → assets}/database_add.svg +0 -0
- /package/{dist/assets → assets}/database_connect.svg +0 -0
- /package/{dist/assets → assets}/database_upload.svg +0 -0
- /package/{dist/assets → assets}/databse.svg +0 -0
- /package/{dist/assets → assets}/defaultWeLogo.svg +0 -0
- /package/{dist/assets → assets}/empty.png +0 -0
- /package/{dist/assets → assets}/graph.svg +0 -0
- /package/{dist/assets → assets}/homeBg.png +0 -0
- /package/{dist/assets → assets}/index-B2yNvzjy.js +0 -0
- /package/{dist/assets → assets}/index-BKe5FgcC.js +0 -0
- /package/{dist/assets → assets}/index-CpW6Dhpp.js +0 -0
- /package/{dist/assets → assets}/index-D72cKELw.js +0 -0
- /package/{dist/assets → assets}/index-DdVFXD_y.js +0 -0
- /package/{dist/assets → assets}/index-DrkSoKz6.js +0 -0
- /package/{dist/assets → assets}/index-KCfkkJKb.js +0 -0
- /package/{dist/assets → assets}/index-QI9biQrR.js +0 -0
- /package/{dist/assets → assets}/index-ZopkeZtI.js +0 -0
- /package/{dist/assets → assets}/index-g-SUxfJH.js +0 -0
- /package/{dist/assets → assets}/index-j0kQJd0a.js +0 -0
- /package/{dist/assets → assets}/knowledge.svg +0 -0
- /package/{dist/assets → assets}/left.jpg +0 -0
- /package/{dist/assets → assets}/logoImg.png +0 -0
- /package/{dist/assets → assets}/mysql.svg +0 -0
- /package/{dist/assets → assets}/plus-V9zUoSq6.js +0 -0
- /package/{dist/assets → assets}/sensitive.svg +0 -0
- /package/{dist/assets → assets}/style-CGmZ5osp.js +0 -0
- /package/{dist/assets → assets}/style.css +0 -0
- /package/{dist/assets → assets}/style2.css +0 -0
- /package/{dist/assets → assets}/style3.css +0 -0
- /package/{dist/assets → assets}/style4.css +0 -0
- /package/{dist/assets → assets}/worker-BbpylX7l.js +0 -0
- /package/{dist/assets → assets}/x-CnaaLGJF.js +0 -0
- /package/{dist/assistantConfig.d.ts → assistantConfig.d.ts} +0 -0
- /package/{dist/assistantConfig.js → assistantConfig.js} +0 -0
- /package/{dist/chat.d.ts → chat.d.ts} +0 -0
- /package/{dist/database.d.ts → database.d.ts} +0 -0
- /package/{dist/database.js → database.js} +0 -0
- /package/{dist/databaseId.d.ts → databaseId.d.ts} +0 -0
- /package/{dist/databaseId.js → databaseId.js} +0 -0
- /package/{dist/databaseTable.d.ts → databaseTable.d.ts} +0 -0
- /package/{dist/databaseTable.js → databaseTable.js} +0 -0
- /package/{dist/icons → icons}/answerAwartar.png +0 -0
- /package/{dist/icons → icons}/docx-file.png +0 -0
- /package/{dist/icons → icons}/folder.png +0 -0
- /package/{dist/icons → icons}/html.png +0 -0
- /package/{dist/icons → icons}/image.png +0 -0
- /package/{dist/icons → icons}/jpg-file.png +0 -0
- /package/{dist/icons → icons}/json.png +0 -0
- /package/{dist/icons → icons}/md.png +0 -0
- /package/{dist/icons → icons}/pdf.png +0 -0
- /package/{dist/icons → icons}/pptx.png +0 -0
- /package/{dist/icons → icons}/questionAwartar.png +0 -0
- /package/{dist/icons → icons}/sheets.png +0 -0
- /package/{dist/icons → icons}/txt.png +0 -0
- /package/{dist/icons → icons}/xlsx.png +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/index.js → index.js} +0 -0
- /package/{dist/modelManage.d.ts → modelManage.d.ts} +0 -0
- /package/{dist/modelManage.js → modelManage.js} +0 -0
- /package/{dist/sensitive.d.ts → sensitive.d.ts} +0 -0
- /package/{dist/sensitive.js → sensitive.js} +0 -0
- /package/{dist/streamFilesReader.d.ts → streamFilesReader.d.ts} +0 -0
- /package/{dist/streamFilesReader.js → streamFilesReader.js} +0 -0
- /package/{dist/vite.svg → vite.svg} +0 -0
- /package/{dist/worker → worker}/pdf.worker.min.js +0 -0
package/dist/README.md
DELETED
|
@@ -1,643 +0,0 @@
|
|
|
1
|
-
# @gientech/modual
|
|
2
|
-
|
|
3
|
-
Gientech 多模块集成包,提供聊天、数据库、文件预览等业务模块。
|
|
4
|
-
|
|
5
|
-
## 📦 安装
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @gientech/modual
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## 🏗️ 打包逻辑
|
|
12
|
-
|
|
13
|
-
### 多入口打包架构
|
|
14
|
-
|
|
15
|
-
本包采用**多入口打包**策略,每个业务模块独立打包,支持按需引入:
|
|
16
|
-
|
|
17
|
-
```text
|
|
18
|
-
dist/
|
|
19
|
-
├── index.js # 主入口(导出所有模块)
|
|
20
|
-
├── chat.js # 聊天模块
|
|
21
|
-
├── database.js # 数据库模块
|
|
22
|
-
├── databaseId.js # 数据库ID模块
|
|
23
|
-
├── databaseTable.js # 数据库表模块
|
|
24
|
-
├── modelManage.js # 模型管理模块
|
|
25
|
-
├── sensitive.js # 敏感词模块
|
|
26
|
-
├── streamFilesReader.js # 流式文件读取器模块
|
|
27
|
-
├── assets/
|
|
28
|
-
│ └── style.css # 统一样式文件
|
|
29
|
-
└── *.d.ts # TypeScript 类型定义文件
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### 打包配置说明
|
|
33
|
-
|
|
34
|
-
1. **入口文件**(`vite.config.ts`):
|
|
35
|
-
- `index`: `src/lib_enter.ts` - 主入口,导出所有模块
|
|
36
|
-
- `chat`: `src/modules/chat/index.tsx` - 聊天模块
|
|
37
|
-
- `database`: `src/modules/database/index.tsx` - 数据库模块
|
|
38
|
-
- 其他模块类似...
|
|
39
|
-
|
|
40
|
-
2. **外部依赖**(不打包进 bundle):
|
|
41
|
-
- `react`, `react-dom`
|
|
42
|
-
- `antd`, `axios`
|
|
43
|
-
- `@mxmweb/*` 系列包
|
|
44
|
-
|
|
45
|
-
3. **样式处理**:
|
|
46
|
-
- 所有 CSS/LESS 文件合并到 `dist/assets/style.css`
|
|
47
|
-
- 支持通过 `@gientech/modual/style.css` 引入
|
|
48
|
-
|
|
49
|
-
4. **打包模式**:
|
|
50
|
-
- `build`: 内联依赖模式(`VITE_INLINE_DEPS=true`)
|
|
51
|
-
- `build:external`: 外部依赖模式(推荐用于 npm 发布)
|
|
52
|
-
|
|
53
|
-
## 🚀 快速开始
|
|
54
|
-
|
|
55
|
-
### 1. 注册 PDF Worker(必需)
|
|
56
|
-
|
|
57
|
-
**⚠️ 重要:必须在应用入口文件(main.tsx)中注册,不能在组件内部注册!**
|
|
58
|
-
|
|
59
|
-
```javascript
|
|
60
|
-
// main.tsx(应用入口文件)
|
|
61
|
-
import React from 'react';
|
|
62
|
-
import ReactDOM from 'react-dom/client';
|
|
63
|
-
|
|
64
|
-
// 方式一:从主入口引入(推荐)
|
|
65
|
-
import { registerPDFWorker } from '@gientech/modual';
|
|
66
|
-
|
|
67
|
-
// 方式二:从 chat 模块引入
|
|
68
|
-
// import { registerPDFWorker } from '@gientech/modual/chat';
|
|
69
|
-
|
|
70
|
-
// 方式三:直接从 @mxmweb/fviewer 引入
|
|
71
|
-
// import { registerPDFWorker } from '@mxmweb/fviewer';
|
|
72
|
-
|
|
73
|
-
// ⚠️ 必须在组件渲染之前注册 Worker!
|
|
74
|
-
registerPDFWorker('/worker/pdf.worker.min.js');
|
|
75
|
-
|
|
76
|
-
// 验证注册是否成功(可选)
|
|
77
|
-
import { isPDFWorkerRegistered } from '@mxmweb/fviewer';
|
|
78
|
-
if (isPDFWorkerRegistered()) {
|
|
79
|
-
console.log('PDF Worker 注册成功');
|
|
80
|
-
} else {
|
|
81
|
-
console.error('PDF Worker 注册失败,请检查路径是否正确');
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
import App from './App';
|
|
85
|
-
|
|
86
|
-
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
87
|
-
<React.StrictMode>
|
|
88
|
-
<App />
|
|
89
|
-
</React.StrictMode>
|
|
90
|
-
);
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
**❌ 错误示例(不要在组件内部注册):**
|
|
94
|
-
|
|
95
|
-
```javascript
|
|
96
|
-
// ❌ 错误:在组件内部注册
|
|
97
|
-
function App() {
|
|
98
|
-
registerPDFWorker('/worker/pdf.worker.min.js'); // 错误!
|
|
99
|
-
return <YourComponent />;
|
|
100
|
-
}
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
**✅ 正确示例(在入口文件注册):**
|
|
104
|
-
|
|
105
|
-
```javascript
|
|
106
|
-
// ✅ 正确:在入口文件注册
|
|
107
|
-
// main.tsx
|
|
108
|
-
import { registerPDFWorker } from '@gientech/modual';
|
|
109
|
-
registerPDFWorker('/worker/pdf.worker.min.js'); // 在组件渲染前注册
|
|
110
|
-
|
|
111
|
-
import App from './App';
|
|
112
|
-
ReactDOM.createRoot(document.getElementById('root')!).render(<App />);
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
**Worker 文件部署**:
|
|
116
|
-
|
|
117
|
-
1. 从 `node_modules/pdfjs-dist/build/pdf.worker.min.js` 复制到 `public/worker/`
|
|
118
|
-
2. 或使用 CDN 提供 Worker 文件
|
|
119
|
-
3. 确保路径与注册时使用的路径一致
|
|
120
|
-
|
|
121
|
-
### 2. 引入样式
|
|
122
|
-
|
|
123
|
-
**⚠️ 重要:必须引入所有相关样式文件,否则组件样式会丢失!**
|
|
124
|
-
|
|
125
|
-
```javascript
|
|
126
|
-
// 在入口文件引入(推荐)
|
|
127
|
-
// 1. 引入 gientech 包样式
|
|
128
|
-
import '@gientech/modual/style.css';
|
|
129
|
-
|
|
130
|
-
// 2. 引入依赖包的样式(必需)
|
|
131
|
-
import '@mxmweb/rtext/style.css';
|
|
132
|
-
import '@mxmweb/aichat/style.css';
|
|
133
|
-
import '@mxmweb/zui/style.css';
|
|
134
|
-
|
|
135
|
-
// 3. 引入 Antd 样式(如果使用 Antd 组件)
|
|
136
|
-
import 'antd/dist/reset.css';
|
|
137
|
-
// 或者使用 Antd 5.x 的样式
|
|
138
|
-
// import 'antd/dist/reset.css';
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**样式引入顺序**(建议按以下顺序):
|
|
142
|
-
|
|
143
|
-
```javascript
|
|
144
|
-
// main.tsx 或 App.tsx
|
|
145
|
-
// 1. 先引入依赖包样式
|
|
146
|
-
import '@mxmweb/rtext/style.css';
|
|
147
|
-
import '@mxmweb/aichat/style.css';
|
|
148
|
-
import '@mxmweb/zui/style.css';
|
|
149
|
-
import 'antd/dist/reset.css';
|
|
150
|
-
|
|
151
|
-
// 2. 再引入 gientech 包样式
|
|
152
|
-
import '@gientech/modual/style.css';
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
#### 方式二:在 HTML 中引入
|
|
156
|
-
|
|
157
|
-
```html
|
|
158
|
-
<link rel="stylesheet" href="./node_modules/@mxmweb/rtext/dist/style.css">
|
|
159
|
-
<link rel="stylesheet" href="./node_modules/@mxmweb/aichat/dist/style.css">
|
|
160
|
-
<link rel="stylesheet" href="./node_modules/@mxmweb/zui/dist/style.css">
|
|
161
|
-
<link rel="stylesheet" href="./node_modules/antd/dist/reset.css">
|
|
162
|
-
<link rel="stylesheet" href="./node_modules/@gientech/modual/dist/assets/style.css">
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### 3. 使用组件
|
|
166
|
-
|
|
167
|
-
#### 方式一:按需引入(推荐)
|
|
168
|
-
|
|
169
|
-
```javascript
|
|
170
|
-
// 只引入需要的模块,减少 bundle 大小
|
|
171
|
-
import withGientechChatAdopter from '@gientech/modual/chat';
|
|
172
|
-
|
|
173
|
-
// 引入样式(必需)
|
|
174
|
-
import '@mxmweb/rtext/style.css';
|
|
175
|
-
import '@mxmweb/aichat/style.css';
|
|
176
|
-
import '@mxmweb/zui/style.css';
|
|
177
|
-
import 'antd/dist/reset.css';
|
|
178
|
-
import '@gientech/modual/style.css';
|
|
179
|
-
|
|
180
|
-
// 使用高阶组件
|
|
181
|
-
const GientechChat = withGientechChatAdopter();
|
|
182
|
-
|
|
183
|
-
function App() {
|
|
184
|
-
return (
|
|
185
|
-
<GientechChat
|
|
186
|
-
token="your-token"
|
|
187
|
-
url="https://your-api.com"
|
|
188
|
-
// 其他配置...
|
|
189
|
-
/>
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
#### 方式二:从主入口引入
|
|
195
|
-
|
|
196
|
-
```javascript
|
|
197
|
-
// 引入所有模块(会增加 bundle 大小)
|
|
198
|
-
import {
|
|
199
|
-
withGientechChatAdopter,
|
|
200
|
-
GientechStreamReader,
|
|
201
|
-
registerPDFWorker
|
|
202
|
-
} from '@gientech/modual';
|
|
203
|
-
|
|
204
|
-
// 引入样式(必需)
|
|
205
|
-
import '@mxmweb/rtext/style.css';
|
|
206
|
-
import '@mxmweb/aichat/style.css';
|
|
207
|
-
import '@mxmweb/zui/style.css';
|
|
208
|
-
import 'antd/dist/reset.css';
|
|
209
|
-
import '@gientech/modual/style.css';
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
## 📚 模块说明
|
|
213
|
-
|
|
214
|
-
### Chat 聊天模块
|
|
215
|
-
|
|
216
|
-
```javascript
|
|
217
|
-
import withGientechChatAdopter from '@gientech/modual/chat';
|
|
218
|
-
|
|
219
|
-
// 引入样式(必需)
|
|
220
|
-
import '@mxmweb/rtext/style.css';
|
|
221
|
-
import '@mxmweb/aichat/style.css';
|
|
222
|
-
import '@mxmweb/zui/style.css';
|
|
223
|
-
import 'antd/dist/reset.css';
|
|
224
|
-
import '@gientech/modual/style.css';
|
|
225
|
-
|
|
226
|
-
const GientechChat = withGientechChatAdopter();
|
|
227
|
-
|
|
228
|
-
function App() {
|
|
229
|
-
return (
|
|
230
|
-
<GientechChat
|
|
231
|
-
token="your-token"
|
|
232
|
-
url="https://your-api.com"
|
|
233
|
-
styles={{
|
|
234
|
-
theme: {
|
|
235
|
-
colors: {
|
|
236
|
-
primary: '#4E6EF2',
|
|
237
|
-
// ... 其他主题配置
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}}
|
|
241
|
-
eventsEmit={(eventName, data) => {
|
|
242
|
-
console.log('事件:', eventName, data);
|
|
243
|
-
}}
|
|
244
|
-
/>
|
|
245
|
-
);
|
|
246
|
-
}
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
### StreamFilesReader 流式文件读取器
|
|
250
|
-
|
|
251
|
-
```javascript
|
|
252
|
-
import { GientechStreamReader } from '@gientech/modual/streamFilesReader';
|
|
253
|
-
|
|
254
|
-
function FileViewer() {
|
|
255
|
-
return (
|
|
256
|
-
<GientechStreamReader
|
|
257
|
-
convertedFilePath="https://example.com/file.pdf"
|
|
258
|
-
fileName="example.pdf"
|
|
259
|
-
fileType="pdf"
|
|
260
|
-
totalPages={10}
|
|
261
|
-
authorization="your-token"
|
|
262
|
-
streamApiUrl="/api/file/stream"
|
|
263
|
-
/>
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
### Database 数据库模块
|
|
269
|
-
|
|
270
|
-
```javascript
|
|
271
|
-
import DatabaseViewAdopter from '@gientech/modual/database';
|
|
272
|
-
|
|
273
|
-
function DatabasePage() {
|
|
274
|
-
return (
|
|
275
|
-
<DatabaseViewAdopter
|
|
276
|
-
token="your-token"
|
|
277
|
-
url="https://your-api.com"
|
|
278
|
-
/>
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
### 其他模块
|
|
284
|
-
|
|
285
|
-
- `@gientech/modual/databaseId` - 数据库ID模块
|
|
286
|
-
- `@gientech/modual/databaseTable` - 数据库表模块
|
|
287
|
-
- `@gientech/modual/modelManage` - 模型管理模块
|
|
288
|
-
- `@gientech/modual/sensitive` - 敏感词模块
|
|
289
|
-
|
|
290
|
-
## 📦 依赖要求
|
|
291
|
-
|
|
292
|
-
### Peer Dependencies(需要用户自行安装)
|
|
293
|
-
|
|
294
|
-
```json
|
|
295
|
-
{
|
|
296
|
-
"react": ">=18 <20",
|
|
297
|
-
"react-dom": ">=18 <20",
|
|
298
|
-
"@mxmweb/fviewer": "^1",
|
|
299
|
-
"@mxmweb/rtext": "^1.2.*",
|
|
300
|
-
"@mxmweb/zui": "^1.3.x",
|
|
301
|
-
"@mxmweb/aichat": "^1.8.0",
|
|
302
|
-
"@mxmweb/xviewer": "^1.2.x",
|
|
303
|
-
"antd": "^5.18.0",
|
|
304
|
-
"axios": "^1.7.2",
|
|
305
|
-
"pdfjs-dist": "2.16.105",
|
|
306
|
-
"styled-components": "^6.1.19"
|
|
307
|
-
}
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
### 安装依赖
|
|
311
|
-
|
|
312
|
-
```bash
|
|
313
|
-
npm install react react-dom @mxmweb/fviewer @mxmweb/rtext @mxmweb/zui @mxmweb/aichat @mxmweb/xviewer antd axios pdfjs-dist@2.16.105 styled-components@^6.1.19
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
**⚠️ 重要**:`pdfjs-dist` 和 `styled-components` 是 `@mxmweb/fviewer` 的必需依赖,必须安装。
|
|
317
|
-
|
|
318
|
-
## 🔧 打包模式说明
|
|
319
|
-
|
|
320
|
-
### 内联依赖模式(`build`)
|
|
321
|
-
|
|
322
|
-
```bash
|
|
323
|
-
npm run build
|
|
324
|
-
# 或
|
|
325
|
-
cross-env VITE_INLINE_DEPS=true vite build --mode production
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
- 将部分依赖打包进 bundle
|
|
329
|
-
- 适合独立部署的场景
|
|
330
|
-
- Bundle 体积较大
|
|
331
|
-
|
|
332
|
-
### 外部依赖模式(`build:external`,推荐)
|
|
333
|
-
|
|
334
|
-
```bash
|
|
335
|
-
npm run build:external
|
|
336
|
-
# 或
|
|
337
|
-
vite build --mode production
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
- 依赖作为 peerDependencies
|
|
341
|
-
- 适合 npm 发布
|
|
342
|
-
- Bundle 体积较小
|
|
343
|
-
- 用户需要安装 peerDependencies
|
|
344
|
-
|
|
345
|
-
## 📝 完整使用示例
|
|
346
|
-
|
|
347
|
-
```javascript
|
|
348
|
-
// main.tsx
|
|
349
|
-
import React from 'react';
|
|
350
|
-
import ReactDOM from 'react-dom/client';
|
|
351
|
-
import { registerPDFWorker } from '@gientech/modual';
|
|
352
|
-
|
|
353
|
-
// 1. 引入依赖包样式(必需,顺序很重要)
|
|
354
|
-
import '@mxmweb/rtext/style.css';
|
|
355
|
-
import '@mxmweb/aichat/style.css';
|
|
356
|
-
import '@mxmweb/zui/style.css';
|
|
357
|
-
import 'antd/dist/reset.css';
|
|
358
|
-
|
|
359
|
-
// 2. 引入 gientech 包样式
|
|
360
|
-
import '@gientech/modual/style.css';
|
|
361
|
-
|
|
362
|
-
import App from './App';
|
|
363
|
-
|
|
364
|
-
// 3. 注册 PDF Worker(必须在组件使用前)
|
|
365
|
-
registerPDFWorker('/worker/pdf.worker.min.js');
|
|
366
|
-
|
|
367
|
-
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
368
|
-
<React.StrictMode>
|
|
369
|
-
<App />
|
|
370
|
-
</React.StrictMode>
|
|
371
|
-
);
|
|
372
|
-
|
|
373
|
-
// App.tsx
|
|
374
|
-
import React from 'react';
|
|
375
|
-
import withGientechChatAdopter from '@gientech/modual/chat';
|
|
376
|
-
|
|
377
|
-
const GientechChat = withGientechChatAdopter();
|
|
378
|
-
|
|
379
|
-
function App() {
|
|
380
|
-
return (
|
|
381
|
-
<div style={{ width: '100vw', height: '100vh' }}>
|
|
382
|
-
<GientechChat
|
|
383
|
-
token="your-token"
|
|
384
|
-
url="https://your-api.com"
|
|
385
|
-
styles={{
|
|
386
|
-
theme: {
|
|
387
|
-
colors: {
|
|
388
|
-
primary: '#4E6EF2',
|
|
389
|
-
background: '#ffffff',
|
|
390
|
-
text: '#000000',
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}}
|
|
394
|
-
eventsEmit={(eventName, data) => {
|
|
395
|
-
console.log('事件:', eventName, data);
|
|
396
|
-
}}
|
|
397
|
-
/>
|
|
398
|
-
</div>
|
|
399
|
-
);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
export default App;
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
## ⚠️ 注意事项
|
|
406
|
-
|
|
407
|
-
1. **PDF Worker 注册**:
|
|
408
|
-
- 必须在应用入口处注册
|
|
409
|
-
- 只注册一次即可
|
|
410
|
-
- Worker 文件路径需要根据实际部署情况调整
|
|
411
|
-
|
|
412
|
-
2. **样式引入**:
|
|
413
|
-
- **必须引入所有相关样式文件**,否则组件样式会丢失
|
|
414
|
-
- 依赖包样式(必需):
|
|
415
|
-
- `@mxmweb/rtext/style.css`
|
|
416
|
-
- `@mxmweb/aichat/style.css`
|
|
417
|
-
- `@mxmweb/zui/style.css`
|
|
418
|
-
- `antd/dist/reset.css`(如果使用 Antd 组件)
|
|
419
|
-
- gientech 包样式:`@gientech/modual/style.css`
|
|
420
|
-
- **引入顺序**:先引入依赖包样式,再引入 gientech 包样式
|
|
421
|
-
|
|
422
|
-
3. **按需引入**:
|
|
423
|
-
- 推荐使用按需引入,减少 bundle 大小
|
|
424
|
-
- 例如:`import withGientechChatAdopter from '@gientech/modual/chat'`
|
|
425
|
-
|
|
426
|
-
4. **依赖安装**:
|
|
427
|
-
- 确保所有 peerDependencies 已安装
|
|
428
|
-
- 版本需要满足 package.json 中的要求
|
|
429
|
-
|
|
430
|
-
5. **TypeScript 支持**:
|
|
431
|
-
- 包包含完整的 TypeScript 类型定义
|
|
432
|
-
- 类型文件位于 `dist/*.d.ts`
|
|
433
|
-
|
|
434
|
-
## 🐛 常见问题
|
|
435
|
-
|
|
436
|
-
### Q: PDF 预览报错 "PDF Worker 未注册"
|
|
437
|
-
|
|
438
|
-
**A**: 需要**在应用入口文件(main.tsx)中**注册 Worker,不能在组件内部注册:
|
|
439
|
-
|
|
440
|
-
```javascript
|
|
441
|
-
// main.tsx(应用入口文件)
|
|
442
|
-
import { registerPDFWorker } from '@gientech/modual';
|
|
443
|
-
|
|
444
|
-
// ⚠️ 必须在组件渲染之前调用!
|
|
445
|
-
registerPDFWorker('/worker/pdf.worker.min.js');
|
|
446
|
-
|
|
447
|
-
import App from './App';
|
|
448
|
-
ReactDOM.createRoot(document.getElementById('root')!).render(<App />);
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
**常见错误**:
|
|
452
|
-
|
|
453
|
-
1. **在组件内部注册**(错误):
|
|
454
|
-
|
|
455
|
-
```javascript
|
|
456
|
-
function App() {
|
|
457
|
-
registerPDFWorker('/worker/pdf.worker.min.js'); // ❌ 错误!
|
|
458
|
-
return <YourComponent />;
|
|
459
|
-
}
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
2. **在 useEffect 中注册**(错误):
|
|
463
|
-
|
|
464
|
-
```javascript
|
|
465
|
-
useEffect(() => {
|
|
466
|
-
registerPDFWorker('/worker/pdf.worker.min.js'); // ❌ 错误!可能太晚了
|
|
467
|
-
}, []);
|
|
468
|
-
```
|
|
469
|
-
|
|
470
|
-
3. **Worker 文件路径不正确**:
|
|
471
|
-
- 确保 `pdf.worker.min.js` 文件存在于 `public/worker/` 目录
|
|
472
|
-
- 确保路径与注册时使用的路径一致
|
|
473
|
-
|
|
474
|
-
**验证注册是否成功**:
|
|
475
|
-
|
|
476
|
-
```javascript
|
|
477
|
-
// 方式一:使用 @mxmweb/fviewer 的检查函数
|
|
478
|
-
import { isPDFWorkerRegistered } from '@mxmweb/fviewer';
|
|
479
|
-
|
|
480
|
-
if (isPDFWorkerRegistered()) {
|
|
481
|
-
console.log('✅ PDF Worker 已注册');
|
|
482
|
-
} else {
|
|
483
|
-
console.error('❌ PDF Worker 未注册');
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
// 方式二:直接检查 pdfjs-dist(推荐,更可靠)
|
|
487
|
-
import * as pdfjsLib from 'pdfjs-dist';
|
|
488
|
-
|
|
489
|
-
if (pdfjsLib.GlobalWorkerOptions.workerSrc) {
|
|
490
|
-
console.log('✅ PDF Worker 已注册:', pdfjsLib.GlobalWorkerOptions.workerSrc);
|
|
491
|
-
} else {
|
|
492
|
-
console.error('❌ PDF Worker 未注册');
|
|
493
|
-
}
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
**⚠️ 重要提示**:
|
|
497
|
-
|
|
498
|
-
如果 `registerPDFWorker` 显示成功但 `isPDFWorkerRegistered()` 返回 false,可能是因为:
|
|
499
|
-
|
|
500
|
-
1. **多个 pdfjs-dist 实例**:确保项目中只有一个 `pdfjs-dist` 实例
|
|
501
|
-
|
|
502
|
-
```bash
|
|
503
|
-
# 检查是否有多个版本
|
|
504
|
-
npm ls pdfjs-dist
|
|
505
|
-
|
|
506
|
-
# 如果有多版本,统一版本
|
|
507
|
-
npm install pdfjs-dist@2.16.105 --save
|
|
508
|
-
```
|
|
509
|
-
|
|
510
|
-
2. **Vite 配置问题**:确保 `pdfjs-dist` 被正确 externalize(见下方配置)
|
|
511
|
-
|
|
512
|
-
3. **模块解析问题**:在 `vite.config.ts` 中添加 `dedupe` 配置:
|
|
513
|
-
|
|
514
|
-
```typescript
|
|
515
|
-
resolve: {
|
|
516
|
-
dedupe: ['pdfjs-dist', 'styled-components'],
|
|
517
|
-
}
|
|
518
|
-
```
|
|
519
|
-
|
|
520
|
-
### Q: 找不到 registerPDFWorker
|
|
521
|
-
|
|
522
|
-
**A**: `registerPDFWorker` 可以从以下位置引入:
|
|
523
|
-
|
|
524
|
-
```javascript
|
|
525
|
-
// 方式一:从主入口引入(推荐)
|
|
526
|
-
import { registerPDFWorker } from '@gientech/modual';
|
|
527
|
-
|
|
528
|
-
// 方式二:从 chat 模块引入
|
|
529
|
-
import { registerPDFWorker } from '@gientech/modual/chat';
|
|
530
|
-
|
|
531
|
-
// 方式三:直接从依赖包引入
|
|
532
|
-
import { registerPDFWorker } from '@mxmweb/fviewer';
|
|
533
|
-
```
|
|
534
|
-
|
|
535
|
-
**注意**:
|
|
536
|
-
|
|
537
|
-
- 如果使用 TypeScript,确保已安装 `@mxmweb/fviewer` 作为 peerDependency
|
|
538
|
-
- **必须安装 `pdfjs-dist@2.16.105`**,这是 `@mxmweb/fviewer` 的必需依赖
|
|
539
|
-
- 如果使用 Vite,可能需要在 `vite.config.ts` 中将 `pdfjs-dist` 标记为外部依赖(见下方配置示例)
|
|
540
|
-
|
|
541
|
-
### Q: 组件样式丢失或样式差距很大
|
|
542
|
-
|
|
543
|
-
**A**: 需要引入**所有相关样式文件**,包括依赖包的样式:
|
|
544
|
-
|
|
545
|
-
```javascript
|
|
546
|
-
// 1. 引入依赖包样式(必需)
|
|
547
|
-
import '@mxmweb/rtext/style.css';
|
|
548
|
-
import '@mxmweb/aichat/style.css';
|
|
549
|
-
import '@mxmweb/zui/style.css';
|
|
550
|
-
import 'antd/dist/reset.css';
|
|
551
|
-
|
|
552
|
-
// 2. 引入 gientech 包样式
|
|
553
|
-
import '@gientech/modual/style.css';
|
|
554
|
-
```
|
|
555
|
-
|
|
556
|
-
**注意**:
|
|
557
|
-
|
|
558
|
-
- 样式引入顺序很重要,建议先引入依赖包样式,再引入 gientech 包样式
|
|
559
|
-
- 如果只引入 `@gientech/modual/style.css`,依赖包的样式会丢失,导致组件样式不完整
|
|
560
|
-
|
|
561
|
-
### Q: 打包后 Worker 文件找不到
|
|
562
|
-
|
|
563
|
-
**A**: Worker 文件不应被打包,应作为静态资源部署:
|
|
564
|
-
|
|
565
|
-
- 将 `pdf.worker.min.js` 放在 `public/worker/` 目录
|
|
566
|
-
- 或使用 CDN 提供 Worker 文件
|
|
567
|
-
|
|
568
|
-
### Q: 报错 "Could not resolve pdfjs-dist"
|
|
569
|
-
|
|
570
|
-
**A**: 需要安装 `pdfjs-dist` 依赖:
|
|
571
|
-
|
|
572
|
-
```bash
|
|
573
|
-
npm install pdfjs-dist@2.16.105
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
如果使用 Vite,可能还需要在 `vite.config.ts` 中配置:
|
|
577
|
-
|
|
578
|
-
```typescript
|
|
579
|
-
// vite.config.ts
|
|
580
|
-
import { defineConfig } from 'vite';
|
|
581
|
-
|
|
582
|
-
export default defineConfig({
|
|
583
|
-
// ... 其他配置
|
|
584
|
-
build: {
|
|
585
|
-
rollupOptions: {
|
|
586
|
-
external: ['pdfjs-dist'], // 将 pdfjs-dist 标记为外部依赖
|
|
587
|
-
},
|
|
588
|
-
},
|
|
589
|
-
optimizeDeps: {
|
|
590
|
-
include: ['pdfjs-dist'], // 预构建 pdfjs-dist
|
|
591
|
-
},
|
|
592
|
-
});
|
|
593
|
-
```
|
|
594
|
-
|
|
595
|
-
**注意**:`pdfjs-dist` 是 `@mxmweb/fviewer` 的 peerDependency,必须安装。
|
|
596
|
-
|
|
597
|
-
### Q: 报错 "PDF Worker 自动注册失败" 或 "xe3 is not a function"
|
|
598
|
-
|
|
599
|
-
**A**: 这是 `@mxmweb/fviewer` 内部自动注册逻辑的问题,可以忽略。**请确保在应用入口处手动注册 Worker**:
|
|
600
|
-
|
|
601
|
-
```javascript
|
|
602
|
-
// main.tsx
|
|
603
|
-
import { registerPDFWorker } from '@gientech/modual';
|
|
604
|
-
registerPDFWorker('/worker/pdf.worker.min.js');
|
|
605
|
-
```
|
|
606
|
-
|
|
607
|
-
**原因**:`@mxmweb/fviewer` 内部有自动注册逻辑,但打包后可能因为函数引用问题导致失败。手动注册可以避免这个问题。
|
|
608
|
-
|
|
609
|
-
### Q: 警告 "several instances of 'styled-components'"
|
|
610
|
-
|
|
611
|
-
**A**: 这是因为 `styled-components` 被打包进了多个 bundle。解决方案:
|
|
612
|
-
|
|
613
|
-
1. **确保 `styled-components` 被正确 externalize**(在 `gientech` 包中已配置)
|
|
614
|
-
|
|
615
|
-
2. **在用户项目的 `vite.config.ts` 中配置**:
|
|
616
|
-
|
|
617
|
-
```typescript
|
|
618
|
-
// vite.config.ts
|
|
619
|
-
import { defineConfig } from 'vite';
|
|
620
|
-
|
|
621
|
-
export default defineConfig({
|
|
622
|
-
resolve: {
|
|
623
|
-
dedupe: ['styled-components', 'pdfjs-dist'],
|
|
624
|
-
},
|
|
625
|
-
optimizeDeps: {
|
|
626
|
-
include: ['styled-components'],
|
|
627
|
-
},
|
|
628
|
-
});
|
|
629
|
-
```
|
|
630
|
-
|
|
631
|
-
3. **检查是否有多个版本**:
|
|
632
|
-
|
|
633
|
-
```bash
|
|
634
|
-
npm ls styled-components
|
|
635
|
-
# 如果有多版本,统一版本
|
|
636
|
-
npm install styled-components@^6.1.19 --save
|
|
637
|
-
```
|
|
638
|
-
|
|
639
|
-
**注意**:这个警告通常不会影响功能,但会增加 bundle 大小。建议修复。
|
|
640
|
-
|
|
641
|
-
## 📄 许可证
|
|
642
|
-
|
|
643
|
-
MIT
|
package/dist/package.json
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@gientech/modual",
|
|
3
|
-
"license": "MIT",
|
|
4
|
-
"style": "assets/style.css",
|
|
5
|
-
"private": false,
|
|
6
|
-
"version": "2.0.5",
|
|
7
|
-
"author": "hanfeng_Zhang",
|
|
8
|
-
"type": "module",
|
|
9
|
-
"main": "index.js",
|
|
10
|
-
"types": "index.d.ts",
|
|
11
|
-
"scripts": {
|
|
12
|
-
"test": "yarn link",
|
|
13
|
-
"disconnect": "yarn unlink"
|
|
14
|
-
},
|
|
15
|
-
"peerDependencies": {
|
|
16
|
-
"react": ">=18",
|
|
17
|
-
"react-dom": ">=18"
|
|
18
|
-
},
|
|
19
|
-
"exports": {
|
|
20
|
-
".": {
|
|
21
|
-
"types": "./index.d.ts",
|
|
22
|
-
"import": "./index.js",
|
|
23
|
-
"default": "./index.js"
|
|
24
|
-
},
|
|
25
|
-
"./chat": {
|
|
26
|
-
"types": "./chat.d.ts",
|
|
27
|
-
"import": "./chat.js",
|
|
28
|
-
"default": "./chat.js"
|
|
29
|
-
},
|
|
30
|
-
"./database": {
|
|
31
|
-
"types": "./database.d.ts",
|
|
32
|
-
"import": "./database.js",
|
|
33
|
-
"default": "./database.js"
|
|
34
|
-
},
|
|
35
|
-
"./databaseId": {
|
|
36
|
-
"types": "./databaseId.d.ts",
|
|
37
|
-
"import": "./databaseId.js",
|
|
38
|
-
"default": "./databaseId.js"
|
|
39
|
-
},
|
|
40
|
-
"./modelManage": {
|
|
41
|
-
"types": "./modelManage.d.ts",
|
|
42
|
-
"import": "./modelManage.js",
|
|
43
|
-
"default": "./modelManage.js"
|
|
44
|
-
},
|
|
45
|
-
"./databaseTable": {
|
|
46
|
-
"types": "./databaseTable.d.ts",
|
|
47
|
-
"import": "./databaseTable.js",
|
|
48
|
-
"default": "./databaseTable.js"
|
|
49
|
-
},
|
|
50
|
-
"./sensitive": {
|
|
51
|
-
"types": "./sensitive.d.ts",
|
|
52
|
-
"import": "./sensitive.js",
|
|
53
|
-
"default": "./sensitive.js"
|
|
54
|
-
},
|
|
55
|
-
"./streamFilesReader": {
|
|
56
|
-
"types": "./streamFilesReader.d.ts",
|
|
57
|
-
"import": "./streamFilesReader.js",
|
|
58
|
-
"default": "./streamFilesReader.js"
|
|
59
|
-
},
|
|
60
|
-
"./assistantConfig": {
|
|
61
|
-
"types": "./assistantConfig.d.ts",
|
|
62
|
-
"import": "./assistantConfig.js",
|
|
63
|
-
"default": "./assistantConfig.js"
|
|
64
|
-
},
|
|
65
|
-
"./style.css": "./assets/style.css",
|
|
66
|
-
"./assets/style.css": "./assets/style.css"
|
|
67
|
-
}
|
|
68
|
-
}
|
package/doc_assets/2.png
DELETED
|
Binary file
|