From a8673344b123615a496ad785e5f10ffc0852e774 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Sun, 25 May 2025 20:16:03 +0800 Subject: [PATCH] Test add menu (#4887) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Feature: Add additional dataset options and their descriptions, updat… (#4874) * Feature: Add additional dataset options and their descriptions, update menu components to support submenu functionality * Optimize the menu component by removing the sub-menu position attribute, introducing the MyPopover component to support sub-menu functionality, and adding new dataset options and their descriptions in the dataset list. --------- Co-authored-by: dreamer6680 <146868355@qq.com> * api dataset tip * remove invalid code --------- Co-authored-by: dreamer6680 <1468683855@qq.com> Co-authored-by: dreamer6680 <146868355@qq.com> --- packages/web/components/common/Icon/constants.ts | 1 + .../icons/core/dataset/externalDatasetColor.svg | 14 +++++++------- .../Icon/icons/core/dataset/otherDataset.svg | 11 +++++++++++ packages/web/components/common/MyMenu/index.tsx | 2 +- packages/web/components/common/MyPopover/index.tsx | 1 + packages/web/i18n/en/dataset.json | 8 +++++--- packages/web/i18n/zh-CN/dataset.json | 8 +++++--- packages/web/i18n/zh-Hant/dataset.json | 8 +++++--- projects/app/src/pages/dataset/list/index.tsx | 1 - 9 files changed, 36 insertions(+), 18 deletions(-) create mode 100644 packages/web/components/common/Icon/icons/core/dataset/otherDataset.svg diff --git a/packages/web/components/common/Icon/constants.ts b/packages/web/components/common/Icon/constants.ts index 3280100f1..0866e5012 100644 --- a/packages/web/components/common/Icon/constants.ts +++ b/packages/web/components/common/Icon/constants.ts @@ -230,6 +230,7 @@ export const iconPaths = { 'core/dataset/tableCollection': () => import('./icons/core/dataset/tableCollection.svg'), 'core/dataset/tag': () => import('./icons/core/dataset/tag.svg'), 'core/dataset/websiteDataset': () => import('./icons/core/dataset/websiteDataset.svg'), + 'core/dataset/otherDataset': () => import('./icons/core/dataset/otherDataset.svg'), 'core/dataset/websiteDatasetColor': () => import('./icons/core/dataset/websiteDatasetColor.svg'), 'core/dataset/websiteDatasetOutline': () => import('./icons/core/dataset/websiteDatasetOutline.svg'), diff --git a/packages/web/components/common/Icon/icons/core/dataset/externalDatasetColor.svg b/packages/web/components/common/Icon/icons/core/dataset/externalDatasetColor.svg index b99fd29d5..64d1639c6 100644 --- a/packages/web/components/common/Icon/icons/core/dataset/externalDatasetColor.svg +++ b/packages/web/components/common/Icon/icons/core/dataset/externalDatasetColor.svg @@ -1,11 +1,11 @@ - - - + + + + - - - + + + - \ No newline at end of file diff --git a/packages/web/components/common/Icon/icons/core/dataset/otherDataset.svg b/packages/web/components/common/Icon/icons/core/dataset/otherDataset.svg new file mode 100644 index 000000000..b99fd29d5 --- /dev/null +++ b/packages/web/components/common/Icon/icons/core/dataset/otherDataset.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/packages/web/components/common/MyMenu/index.tsx b/packages/web/components/common/MyMenu/index.tsx index 43717374c..49e07cace 100644 --- a/packages/web/components/common/MyMenu/index.tsx +++ b/packages/web/components/common/MyMenu/index.tsx @@ -216,7 +216,7 @@ const MyMenu = ({ if (offset) return offset; if (typeof width === 'number') return [-width / 2, 5]; return [0, 5]; - }, [offset]); + }, [offset, width]); return ( {Trigger} diff --git a/packages/web/i18n/en/dataset.json b/packages/web/i18n/en/dataset.json index 3ac5f9091..17947d047 100644 --- a/packages/web/i18n/en/dataset.json +++ b/packages/web/i18n/en/dataset.json @@ -28,7 +28,7 @@ "collection_sync_confirm_tip": "Confirm to start synchronizing data? \nThe system will pull the latest data for comparison. If the contents are different, a new collection will be created and the old collection will be deleted. Please confirm!", "collection_tags": "Collection Tags", "common_dataset": "General Dataset", - "common_dataset_desc": "Build a Dataset by importing files, web links, or manual input.", + "common_dataset_desc": "Building a knowledge base by importing files, web page links, or manual entry", "config_sync_schedule": "Configure scheduled synchronization", "confirm_to_rebuild_embedding_tip": "Are you sure you want to switch the index for the Dataset?\nSwitching the index is a significant operation that requires re-indexing all data in your Dataset, which may take a long time. Please ensure your account has sufficient remaining points.\n\nAdditionally, you need to update the applications that use this Dataset to avoid conflicts with other indexed model Datasets.", "core.dataset.import.Adjust parameters": "Adjust parameters", @@ -64,8 +64,9 @@ "enhanced_indexes": "Index enhancement", "error.collectionNotFound": "Collection not found~", "external_file": "External File Library", - "external_file_dataset_desc": "Import files from an external file library to build a Dataset. The files will not be stored again.", + "external_file_dataset_desc": "You can use external file library to build a knowledge library through the API", "external_id": "File Reading ID", + "external_other_dataset_desc": "Customize API, Feishu, Yuque and other external documents as knowledge bases", "external_read_url": "External Preview URL", "external_read_url_tip": "Configure the reading URL of your file library for user authentication. Use the {{fileId}} variable to refer to the external file ID.", "external_url": "File Access URL", @@ -105,6 +106,7 @@ "noSelectedId": "No selected ID", "noValidId": "No valid ID", "open_auto_sync": "After scheduled synchronization is turned on, the system will try to synchronize the collection from time to time every day. During the collection synchronization period, the collection data will not be searched.", + "other_dataset": "Third-party knowledge base", "params_config": "Config", "params_setting": "Parameter settings", "pdf_enhance_parse": "PDF enhancement analysis", @@ -171,7 +173,7 @@ "vector_model_max_tokens_tip": "Each chunk of data has a maximum length of 3000 tokens", "vllm_model": "Image understanding model", "website_dataset": "Website Sync", - "website_dataset_desc": "Website sync allows you to build a Dataset directly using a web link.", + "website_dataset_desc": "Build knowledge base by crawling web page data in batches", "website_info": "Website Information", "yuque_dataset": "Yuque Dataset", "yuque_dataset_config": "Yuque Dataset Config", diff --git a/packages/web/i18n/zh-CN/dataset.json b/packages/web/i18n/zh-CN/dataset.json index 6c1e1ce93..83a9f5d77 100644 --- a/packages/web/i18n/zh-CN/dataset.json +++ b/packages/web/i18n/zh-CN/dataset.json @@ -28,7 +28,7 @@ "collection_sync_confirm_tip": "确认开始同步数据?系统将会拉取最新数据进行比较,如果内容不相同,则会创建一个新的集合并删除旧的集合,请确认!", "collection_tags": "集合标签", "common_dataset": "通用知识库", - "common_dataset_desc": "可通过导入文件、网页链接或手动录入形式构建知识库", + "common_dataset_desc": "通过导入文件、网页链接或手动录入形式构建知识库", "config_sync_schedule": "配置定时同步", "confirm_to_rebuild_embedding_tip": "确认为知识库切换索引?\n切换索引是一个非常重量的操作,需要对您知识库内所有数据进行重新索引,时间可能较长,请确保账号内剩余积分充足。\n\n此外,你还需要注意修改选择该知识库的应用,避免它们与其他索引模型知识库混用。", "core.dataset.import.Adjust parameters": "调整参数", @@ -64,8 +64,9 @@ "enhanced_indexes": "索引增强", "error.collectionNotFound": "集合找不到了~", "external_file": "外部文件库", - "external_file_dataset_desc": "可以从外部文件库导入文件构建知识库,文件不会进行二次存储", + "external_file_dataset_desc": "可以通过 API,使用外部文件库构建知识库", "external_id": "文件阅读 ID", + "external_other_dataset_desc": "自定义API、飞书、语雀等外部文档作为知识库", "external_read_url": "外部预览地址", "external_read_url_tip": "可以配置你文件库的阅读地址。便于对用户进行阅读鉴权操作。目前可以使用 {{fileId}} 变量来指代外部文件 ID。", "external_url": "文件访问 URL", @@ -105,6 +106,7 @@ "noSelectedId": "没有选择 ID", "noValidId": "没有有效的 ID", "open_auto_sync": "开启定时同步后,系统将会每天不定时尝试同步集合,集合同步期间,会出现无法搜索到该集合数据现象。", + "other_dataset": "第三方知识库", "params_config": "配置", "params_setting": "参数设置", "pdf_enhance_parse": "PDF增强解析", @@ -170,7 +172,7 @@ "vector_model_max_tokens_tip": "每个分块数据,最大长度为 3000 tokens", "vllm_model": "图片理解模型", "website_dataset": "Web 站点同步", - "website_dataset_desc": "Web 站点同步允许你直接使用一个网页链接构建知识库", + "website_dataset_desc": "通过爬虫,批量爬取网页数据构建知识库", "website_info": "网站信息", "yuque_dataset": "语雀知识库", "yuque_dataset_config": "配置语雀知识库", diff --git a/packages/web/i18n/zh-Hant/dataset.json b/packages/web/i18n/zh-Hant/dataset.json index d5659446a..4d241deb9 100644 --- a/packages/web/i18n/zh-Hant/dataset.json +++ b/packages/web/i18n/zh-Hant/dataset.json @@ -27,7 +27,7 @@ "collection_sync_confirm_tip": "確認開始同步資料?\n系統將會拉取最新資料進行比較,如果內容不相同,則會建立一個新的集合並刪除舊的集合,請確認!", "collection_tags": "集合標籤", "common_dataset": "通用資料集", - "common_dataset_desc": "可透過匯入檔案、網頁連結或手動輸入的方式建立資料集", + "common_dataset_desc": "通過導入文件、網頁鏈接或手動錄入形式構建知識庫", "config_sync_schedule": "設定定時同步", "confirm_to_rebuild_embedding_tip": "確定要為資料集切換索引嗎?\n切換索引是一個重要的操作,需要對您資料集內所有資料重新建立索引,可能需要較長時間,請確保帳號內剩餘點數充足。\n\n此外,您還需要注意修改使用此資料集的應用程式,避免與其他索引模型資料集混用。", "core.dataset.import.Adjust parameters": "調整參數", @@ -63,8 +63,9 @@ "enhanced_indexes": "索引增強", "error.collectionNotFound": "找不到集合", "external_file": "外部檔案庫", - "external_file_dataset_desc": "可以從外部檔案庫匯入檔案建立資料集,檔案不會進行二次儲存", + "external_file_dataset_desc": "可以通過 API,使用外部文件庫構建知識庫", "external_id": "檔案讀取識別碼", + "external_other_dataset_desc": "自定義API、飛書、語雀等外部文檔作為知識庫", "external_read_url": "外部預覽網址", "external_read_url_tip": "可以設定您檔案庫的讀取網址,方便對使用者進行讀取權限驗證。目前可使用 {{fileId}} 變數來代表外部檔案識別碼。", "external_url": "檔案存取網址", @@ -104,6 +105,7 @@ "noSelectedId": "沒有選擇 ID", "noValidId": "沒有有效的 ID", "open_auto_sync": "開啟定時同步後,系統將每天不定時嘗試同步集合,集合同步期間,會出現無法搜尋到該集合資料現象。", + "other_dataset": "第三方知識庫", "params_config": "設定", "params_setting": "參數設定", "pdf_enhance_parse": "PDF 增強解析", @@ -169,7 +171,7 @@ "vector_model_max_tokens_tip": "每個分塊資料,最大長度為 3000 tokens", "vllm_model": "圖片理解模型", "website_dataset": "網站同步", - "website_dataset_desc": "網站同步功能讓您可以直接使用網頁連結建立資料集", + "website_dataset_desc": "通過爬蟲,批量爬取網頁數據構建知識庫", "website_info": "網站資訊", "yuque_dataset": "語雀知識庫", "yuque_dataset_config": "設定語雀知識庫", diff --git a/projects/app/src/pages/dataset/list/index.tsx b/projects/app/src/pages/dataset/list/index.tsx index 44d81019d..8468ea96b 100644 --- a/projects/app/src/pages/dataset/list/index.tsx +++ b/projects/app/src/pages/dataset/list/index.tsx @@ -30,7 +30,6 @@ import { DatasetTypeEnum } from '@fastgpt/global/core/dataset/constants'; import { useToast } from '@fastgpt/web/hooks/useToast'; import MyBox from '@fastgpt/web/components/common/MyBox'; import { useSystemStore } from '@/web/common/system/useSystemStore'; -import { type PermissionValueType } from '@fastgpt/global/support/permission/type'; const EditFolderModal = dynamic( () => import('@fastgpt/web/components/common/MyModal/EditFolderModal')