From 38f1a42ce8a37475ef0a0055035aed3ba93a3865 Mon Sep 17 00:00:00 2001 From: twwu Date: Thu, 8 May 2025 11:15:27 +0800 Subject: [PATCH] refactor: remove unused icon components and update imports in dataset components --- .../assets/vender/knowledge/general-type.svg | 5 -- .../vender/knowledge/parent-child-type.svg | 7 --- .../src/vender/knowledge/GeneralType.json | 38 ------------- .../src/vender/knowledge/GeneralType.tsx | 20 ------- .../src/vender/knowledge/ParentChildType.json | 56 ------------------- .../src/vender/knowledge/ParentChildType.tsx | 20 ------- .../base/icons/src/vender/knowledge/index.ts | 2 - .../datasets/common/chunking-mode-label.tsx | 7 ++- .../datasets/common/document-picker/index.tsx | 4 +- .../list/template-card/details.tsx | 2 +- .../input-field/field-list/field-item.tsx | 2 +- .../input-field-button.tsx | 2 +- web/i18n/en-US/dataset-pipeline.ts | 1 + web/i18n/zh-Hans/dataset-pipeline.ts | 1 + 14 files changed, 11 insertions(+), 156 deletions(-) delete mode 100644 web/app/components/base/icons/assets/vender/knowledge/general-type.svg delete mode 100644 web/app/components/base/icons/assets/vender/knowledge/parent-child-type.svg delete mode 100644 web/app/components/base/icons/src/vender/knowledge/GeneralType.json delete mode 100644 web/app/components/base/icons/src/vender/knowledge/GeneralType.tsx delete mode 100644 web/app/components/base/icons/src/vender/knowledge/ParentChildType.json delete mode 100644 web/app/components/base/icons/src/vender/knowledge/ParentChildType.tsx diff --git a/web/app/components/base/icons/assets/vender/knowledge/general-type.svg b/web/app/components/base/icons/assets/vender/knowledge/general-type.svg deleted file mode 100644 index 779df5f31c..0000000000 --- a/web/app/components/base/icons/assets/vender/knowledge/general-type.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/web/app/components/base/icons/assets/vender/knowledge/parent-child-type.svg b/web/app/components/base/icons/assets/vender/knowledge/parent-child-type.svg deleted file mode 100644 index bc596b672a..0000000000 --- a/web/app/components/base/icons/assets/vender/knowledge/parent-child-type.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/web/app/components/base/icons/src/vender/knowledge/GeneralType.json b/web/app/components/base/icons/src/vender/knowledge/GeneralType.json deleted file mode 100644 index 0ccedc3d63..0000000000 --- a/web/app/components/base/icons/src/vender/knowledge/GeneralType.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "icon": { - "type": "element", - "isRootNode": true, - "name": "svg", - "attributes": { - "width": "12", - "height": "12", - "viewBox": "0 0 12 12", - "fill": "none", - "xmlns": "http://www.w3.org/2000/svg" - }, - "children": [ - { - "type": "element", - "name": "g", - "attributes": { - "id": "Icon L" - }, - "children": [ - { - "type": "element", - "name": "path", - "attributes": { - "id": "Vector", - "fill-rule": "evenodd", - "clip-rule": "evenodd", - "d": "M6 0.5C6.27615 0.5 6.5 0.72386 6.5 1V1.52755C6.95855 1.57831 7.3967 1.69804 7.80355 1.87619L8.067 1.41997C8.20505 1.18083 8.51085 1.09889 8.75 1.23696C8.98915 1.37503 9.07105 1.68082 8.933 1.91998L8.6692 2.37685C9.033 2.64523 9.3548 2.96707 9.6232 3.33084L10.0801 3.06703C10.3193 2.92896 10.6251 3.0109 10.7632 3.25005C10.9012 3.4892 10.8193 3.79499 10.5801 3.93306L10.1238 4.19649C10.302 4.60333 10.4218 5.0415 10.4725 5.50005H11C11.2761 5.50005 11.5 5.7239 11.5 6.00005C11.5 6.2762 11.2761 6.50005 11 6.50005H10.4725C10.4218 6.9586 10.302 7.3968 10.1238 7.80365L10.5801 8.0671C10.8193 8.20515 10.9012 8.51095 10.7632 8.7501C10.6251 8.98925 10.3193 9.0712 10.0801 8.9331L9.6232 8.6693C9.3548 9.03305 9.03295 9.3549 8.6692 9.62325L8.933 10.0802C9.07105 10.3193 8.98915 10.6251 8.75 10.7632C8.51085 10.9012 8.20505 10.8193 8.067 10.5802L7.80355 10.1239C7.3967 10.3021 6.95855 10.4218 6.5 10.4726V11C6.5 11.2761 6.27615 11.5 6 11.5C5.72385 11.5 5.5 11.2761 5.5 11V10.4726C5.04145 10.4218 4.60328 10.3021 4.19644 10.1239L3.933 10.5802C3.79493 10.8194 3.48914 10.9013 3.24999 10.7633C3.01084 10.6252 2.92891 10.3194 3.06698 10.0802L3.3308 9.62325C2.96702 9.3549 2.64517 9.03305 2.37678 8.66925L1.91986 8.93305C1.68071 9.07115 1.37492 8.9892 1.23685 8.75005C1.09878 8.5109 1.18072 8.2051 1.41986 8.06705L1.87612 7.8036C1.69797 7.39675 1.57824 6.9586 1.52749 6.50005L0.999975 6.5C0.723835 6.5 0.499987 6.2761 0.5 6C0.500015 5.72385 0.72388 5.5 1.00003 5.5L1.5275 5.50005C1.57825 5.0415 1.69796 4.60335 1.87611 4.19652L1.41987 3.93312C1.18072 3.79504 1.09878 3.48925 1.23685 3.2501C1.37492 3.01095 1.68071 2.92901 1.91985 3.06709L2.37675 3.33086C2.64514 2.96708 2.967 2.64524 3.33078 2.37684L3.06698 1.91992C2.92891 1.68077 3.01084 1.37498 3.24999 1.23691C3.48914 1.09884 3.79493 1.18077 3.933 1.41992L4.19642 1.87619C4.60327 1.69803 5.04145 1.57831 5.5 1.52755V1C5.5 0.72386 5.72385 0.5 6 0.5ZM3.83484 3.24991C3.48643 3.52463 3.19141 3.86415 2.96808 4.25014C2.67048 4.7645 2.49999 5.3616 2.49999 6.00005C2.49999 6.6385 2.67048 7.2356 2.96809 7.75C3.19142 8.13595 3.48645 8.4755 3.83486 8.7502L4.8599 6.97475C4.63581 6.71285 4.49999 6.37245 4.49999 6.00005C4.49999 5.62765 4.63581 5.28725 4.8599 5.02535L3.83484 3.24991ZM5.7258 4.52514L4.70041 2.74911C5.10185 2.58847 5.5402 2.50005 6 2.50005C6.63845 2.50005 7.23555 2.67054 7.74995 2.96816C8.28125 3.27557 8.7245 3.71882 9.0319 4.25012C9.2503 4.62764 9.4003 5.04975 9.4646 5.50005H7.41465C7.2087 4.91745 6.6531 4.50005 6 4.50005C5.9065 4.50005 5.8148 4.50865 5.7258 4.52514ZM7.41465 6.50005C7.2087 7.08265 6.6531 7.50005 6 7.50005C5.9065 7.50005 5.8148 7.49145 5.7258 7.47495L4.70043 9.251C5.10185 9.41165 5.5402 9.50005 6 9.50005C6.63845 9.50005 7.23555 9.32955 7.7499 9.03195C8.2812 8.72455 8.72445 8.2813 9.03185 7.75C9.2503 7.3725 9.4003 6.95035 9.4646 6.50005H7.41465Z", - "fill": "currentColor" - }, - "children": [] - } - ] - } - ] - }, - "name": "GeneralType" -} \ No newline at end of file diff --git a/web/app/components/base/icons/src/vender/knowledge/GeneralType.tsx b/web/app/components/base/icons/src/vender/knowledge/GeneralType.tsx deleted file mode 100644 index 29005b8d07..0000000000 --- a/web/app/components/base/icons/src/vender/knowledge/GeneralType.tsx +++ /dev/null @@ -1,20 +0,0 @@ -// GENERATE BY script -// DON NOT EDIT IT MANUALLY - -import * as React from 'react' -import data from './GeneralType.json' -import IconBase from '@/app/components/base/icons/IconBase' -import type { IconData } from '@/app/components/base/icons/IconBase' - -const Icon = ( - { - ref, - ...props - }: React.SVGProps & { - ref?: React.RefObject>; - }, -) => - -Icon.displayName = 'GeneralType' - -export default Icon diff --git a/web/app/components/base/icons/src/vender/knowledge/ParentChildType.json b/web/app/components/base/icons/src/vender/knowledge/ParentChildType.json deleted file mode 100644 index 2857350051..0000000000 --- a/web/app/components/base/icons/src/vender/knowledge/ParentChildType.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "icon": { - "type": "element", - "isRootNode": true, - "name": "svg", - "attributes": { - "width": "10", - "height": "11", - "viewBox": "0 0 10 11", - "fill": "none", - "xmlns": "http://www.w3.org/2000/svg" - }, - "children": [ - { - "type": "element", - "name": "g", - "attributes": { - "id": "Group" - }, - "children": [ - { - "type": "element", - "name": "path", - "attributes": { - "id": "Vector", - "d": "M2.70833 3.87501C3.51375 3.87501 4.16666 3.22209 4.16666 2.41668C4.16666 1.61126 3.51375 0.958344 2.70833 0.958344C1.90292 0.958344 1.25 1.61126 1.25 2.41668C1.25 3.22209 1.90292 3.87501 2.70833 3.87501Z", - "fill": "currentColor" - }, - "children": [] - }, - { - "type": "element", - "name": "path", - "attributes": { - "id": "Vector_2", - "d": "M7.29158 3.87501C8.097 3.87501 8.74992 3.22209 8.74992 2.41668C8.74992 1.61126 8.097 0.958344 7.29158 0.958344C6.48617 0.958344 5.83325 1.61126 5.83325 2.41668C5.83325 3.22209 6.48617 3.87501 7.29158 3.87501Z", - "fill": "currentColor" - }, - "children": [] - }, - { - "type": "element", - "name": "path", - "attributes": { - "id": "Vector_3", - "d": "M7.29167 4.70835C6.83771 4.70886 6.39118 4.82363 5.99324 5.04208C5.59529 5.26053 5.25874 5.57563 5.01459 5.95835C5.34482 5.9622 5.66011 6.09658 5.89159 6.33215C6.12306 6.56771 6.25191 6.8853 6.24998 7.21555C6.24805 7.5458 6.11551 7.86187 5.8813 8.09472C5.6471 8.32756 5.33026 8.45826 5 8.45826C4.66975 8.45826 4.35291 8.32756 4.1187 8.09472C3.8845 7.86187 3.75195 7.5458 3.75003 7.21555C3.7481 6.8853 3.87695 6.56771 4.10842 6.33215C4.3399 6.09658 4.65519 5.9622 4.98542 5.95835C4.67086 5.46415 4.20432 5.08546 3.656 4.87926C3.10767 4.67306 2.50721 4.6505 1.94496 4.81497C1.3827 4.97944 0.889064 5.32205 0.538306 5.79125C0.187547 6.26045 -0.00135882 6.83086 7.35834e-06 7.41668V10.125C7.35834e-06 10.2355 0.043906 10.3415 0.122046 10.4196C0.200186 10.4978 0.306167 10.5417 0.416674 10.5417H3.33334V9.50001L1.83334 8.37501C1.78957 8.34218 1.75269 8.30105 1.72481 8.25397C1.69693 8.20688 1.6786 8.15477 1.67086 8.1006C1.65523 7.99121 1.6837 7.88008 1.75001 7.79168C1.81631 7.70327 1.91502 7.64483 2.02441 7.6292C2.13381 7.61357 2.24493 7.64204 2.33334 7.70835L3.88875 8.87501H6.11125L7.66667 7.70835C7.75507 7.64204 7.8662 7.61357 7.97559 7.6292C8.08499 7.64483 8.1837 7.70327 8.25 7.79168C8.31631 7.88008 8.34478 7.99121 8.32915 8.1006C8.31352 8.21 8.25507 8.30871 8.16667 8.37501L6.66667 9.50001V10.5417H9.58333C9.69384 10.5417 9.79982 10.4978 9.87796 10.4196C9.9561 10.3415 10 10.2355 10 10.125V7.41668C9.99912 6.69866 9.71349 6.01029 9.20577 5.50257C8.69805 4.99485 8.00969 4.70923 7.29167 4.70835Z", - "fill": "currentColor" - }, - "children": [] - } - ] - } - ] - }, - "name": "ParentChildType" -} \ No newline at end of file diff --git a/web/app/components/base/icons/src/vender/knowledge/ParentChildType.tsx b/web/app/components/base/icons/src/vender/knowledge/ParentChildType.tsx deleted file mode 100644 index 107315002a..0000000000 --- a/web/app/components/base/icons/src/vender/knowledge/ParentChildType.tsx +++ /dev/null @@ -1,20 +0,0 @@ -// GENERATE BY script -// DON NOT EDIT IT MANUALLY - -import * as React from 'react' -import data from './ParentChildType.json' -import IconBase from '@/app/components/base/icons/IconBase' -import type { IconData } from '@/app/components/base/icons/IconBase' - -const Icon = ( - { - ref, - ...props - }: React.SVGProps & { - ref?: React.RefObject>; - }, -) => - -Icon.displayName = 'ParentChildType' - -export default Icon diff --git a/web/app/components/base/icons/src/vender/knowledge/index.ts b/web/app/components/base/icons/src/vender/knowledge/index.ts index 894186be2e..f894defd5f 100644 --- a/web/app/components/base/icons/src/vender/knowledge/index.ts +++ b/web/app/components/base/icons/src/vender/knowledge/index.ts @@ -5,10 +5,8 @@ export { default as Divider } from './Divider' export { default as Economic } from './Economic' export { default as FullTextSearch } from './FullTextSearch' export { default as GeneralChunk } from './GeneralChunk' -export { default as GeneralType } from './GeneralType' export { default as HighQuality } from './HighQuality' export { default as HybridSearch } from './HybridSearch' export { default as ParentChildChunk } from './ParentChildChunk' -export { default as ParentChildType } from './ParentChildType' export { default as QuestionAndAnswer } from './QuestionAndAnswer' export { default as VectorSearch } from './VectorSearch' diff --git a/web/app/components/datasets/common/chunking-mode-label.tsx b/web/app/components/datasets/common/chunking-mode-label.tsx index d6d7a7b240..fb6c4a68c8 100644 --- a/web/app/components/datasets/common/chunking-mode-label.tsx +++ b/web/app/components/datasets/common/chunking-mode-label.tsx @@ -3,7 +3,7 @@ import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import Badge from '@/app/components/base/badge' -import { GeneralType, ParentChildType } from '@/app/components/base/icons/src/vender/knowledge' +import { GeneralChunk, ParentChildChunk } from '@/app/components/base/icons/src/vender/knowledge' type Props = { isGeneralMode: boolean @@ -15,13 +15,14 @@ const ChunkingModeLabel: FC = ({ isQAMode, }) => { const { t } = useTranslation() - const TypeIcon = isGeneralMode ? GeneralType : ParentChildType + const TypeIcon = isGeneralMode ? GeneralChunk : ParentChildChunk + const generalSuffix = isQAMode ? ' · QA' : '' return (
- {isGeneralMode ? `${t('dataset.chunkingMode.general')}${isQAMode ? ' · QA' : ''}` : t('dataset.chunkingMode.parentChild')} + {isGeneralMode ? `${t('dataset.chunkingMode.general')}${generalSuffix}` : t('dataset.chunkingMode.parentChild')}
) diff --git a/web/app/components/datasets/common/document-picker/index.tsx b/web/app/components/datasets/common/document-picker/index.tsx index 068db3af0a..7c03082b10 100644 --- a/web/app/components/datasets/common/document-picker/index.tsx +++ b/web/app/components/datasets/common/document-picker/index.tsx @@ -15,7 +15,7 @@ import { } from '@/app/components/base/portal-to-follow-elem' import cn from '@/utils/classnames' import SearchInput from '@/app/components/base/search-input' -import { GeneralType, ParentChildType } from '@/app/components/base/icons/src/vender/knowledge' +import { GeneralChunk, ParentChildChunk } from '@/app/components/base/icons/src/vender/knowledge' import { useDocumentList } from '@/service/knowledge/use-document' import Loading from '@/app/components/base/loading' @@ -54,7 +54,7 @@ const DocumentPicker: FC = ({ }) const documentsList = data?.data const isParentChild = processMode === ProcessMode.parentChild - const TypeIcon = isParentChild ? ParentChildType : GeneralType + const TypeIcon = isParentChild ? ParentChildChunk : GeneralChunk const [open, { set: setOpen, diff --git a/web/app/components/datasets/create-from-pipeline/list/template-card/details.tsx b/web/app/components/datasets/create-from-pipeline/list/template-card/details.tsx index 2cf6c5cfce..577851f070 100644 --- a/web/app/components/datasets/create-from-pipeline/list/template-card/details.tsx +++ b/web/app/components/datasets/create-from-pipeline/list/template-card/details.tsx @@ -87,7 +87,7 @@ const Details = ({ {t('datasetPipeline.details.structure')} diff --git a/web/app/components/rag-pipeline/components/input-field/field-list/field-item.tsx b/web/app/components/rag-pipeline/components/input-field/field-list/field-item.tsx index 36ef082b10..0c3dfa910e 100644 --- a/web/app/components/rag-pipeline/components/input-field/field-list/field-item.tsx +++ b/web/app/components/rag-pipeline/components/input-field/field-list/field-item.tsx @@ -8,7 +8,7 @@ import { RiEditLine, } from '@remixicon/react' import type { InputVar } from '@/app/components/workflow/types' -import { InputField } from '@/app/components/base/icons/src/public/pipeline' +import { InputField } from '@/app/components/base/icons/src/vender/pipeline' import InputVarTypeIcon from '@/app/components/workflow/nodes/_base/components/input-var-type-icon' import cn from '@/utils/classnames' import Badge from '@/app/components/base/badge' diff --git a/web/app/components/rag-pipeline/components/rag-pipeline-header/input-field-button.tsx b/web/app/components/rag-pipeline/components/rag-pipeline-header/input-field-button.tsx index 6488f864da..918da8ee41 100644 --- a/web/app/components/rag-pipeline/components/rag-pipeline-header/input-field-button.tsx +++ b/web/app/components/rag-pipeline/components/rag-pipeline-header/input-field-button.tsx @@ -1,5 +1,5 @@ import Button from '@/app/components/base/button' -import { InputField } from '@/app/components/base/icons/src/public/pipeline' +import { InputField } from '@/app/components/base/icons/src/vender/pipeline' import { useStore } from '@/app/components/workflow/store' import { useCallback } from 'react' diff --git a/web/i18n/en-US/dataset-pipeline.ts b/web/i18n/en-US/dataset-pipeline.ts index 251608c31d..705a484a13 100644 --- a/web/i18n/en-US/dataset-pipeline.ts +++ b/web/i18n/en-US/dataset-pipeline.ts @@ -41,6 +41,7 @@ const translation = { }, details: { structure: 'Structure', + structureTooltip: 'Chunk Structure determines how documents are split and indexed—offering General, Parent-Child, and Q&A modes—and is unique to each knowledge base.', }, } diff --git a/web/i18n/zh-Hans/dataset-pipeline.ts b/web/i18n/zh-Hans/dataset-pipeline.ts index 4570db18c1..3f90180e2a 100644 --- a/web/i18n/zh-Hans/dataset-pipeline.ts +++ b/web/i18n/zh-Hans/dataset-pipeline.ts @@ -41,6 +41,7 @@ const translation = { }, details: { structure: '文档结构', + structureTooltip: '文档结构决定了文档的拆分和索引方式,Dify 提供了通用、父子和问答模式,每个知识库的文档结构是唯一的。', }, }