From 896906ae7703b4d8929882d48f8650cb29895a07 Mon Sep 17 00:00:00 2001 From: twwu Date: Mon, 23 Jun 2025 15:57:02 +0800 Subject: [PATCH 1/3] feat: refactor layout structure in PipelineSettings component for improved responsiveness --- .../settings/pipeline-settings/index.tsx | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/web/app/components/datasets/documents/detail/settings/pipeline-settings/index.tsx b/web/app/components/datasets/documents/detail/settings/pipeline-settings/index.tsx index 7ac3c11fea..6b41544cd2 100644 --- a/web/app/components/datasets/documents/detail/settings/pipeline-settings/index.tsx +++ b/web/app/components/datasets/documents/detail/settings/pipeline-settings/index.tsx @@ -147,34 +147,38 @@ const PipelineSettings = ({
-
- -
- +
+
+ +
+ +
{/* Preview */} -
- +
+
+ +
) From 916a8c76e7b29fee08582a2bb137d823af1c4cbd Mon Sep 17 00:00:00 2001 From: twwu Date: Mon, 23 Jun 2025 16:31:09 +0800 Subject: [PATCH 2/3] fix: rename currentDocuments to currentDocument for consistency in online documents handling --- .../notion-page-selector/page-selector/index.tsx | 14 +++++++++++++- .../documents/create-from-pipeline/hooks.ts | 8 ++++---- .../documents/create-from-pipeline/index.tsx | 4 ++-- web/service/knowledge/use-dataset.ts | 1 + 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/web/app/components/base/notion-page-selector/page-selector/index.tsx b/web/app/components/base/notion-page-selector/page-selector/index.tsx index 498955994c..33d02da772 100644 --- a/web/app/components/base/notion-page-selector/page-selector/index.tsx +++ b/web/app/components/base/notion-page-selector/page-selector/index.tsx @@ -82,7 +82,19 @@ const ItemComponent = ({ index, style, data }: ListChildComponentProps<{ pagesMap: DataSourceNotionPageMap }>) => { const { t } = useTranslation() - const { dataList, handleToggle, checkedIds, disabledCheckedIds, handleCheck, canPreview, handlePreview, listMapWithChildrenAndDescendants, searchValue, previewPageId, pagesMap } = data + const { + dataList, + handleToggle, + checkedIds, + disabledCheckedIds, + handleCheck, + canPreview, + handlePreview, + listMapWithChildrenAndDescendants, + searchValue, + previewPageId, + pagesMap, + } = data const current = dataList[index] const currentWithChildrenAndDescendants = listMapWithChildrenAndDescendants[current.page_id] const hasChild = currentWithChildrenAndDescendants.descendants.size > 0 diff --git a/web/app/components/datasets/documents/create-from-pipeline/hooks.ts b/web/app/components/datasets/documents/create-from-pipeline/hooks.ts index 9dc608c2c8..01dfd040df 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/hooks.ts +++ b/web/app/components/datasets/documents/create-from-pipeline/hooks.ts @@ -122,7 +122,7 @@ export const useLocalFile = () => { export const useOnlineDocuments = () => { const [onlineDocuments, setOnlineDocuments] = useState([]) - const [currentDocuments, setCurrentDocuments] = useState() + const [currentDocument, setCurrentDocument] = useState() const previewOnlineDocument = useRef(onlineDocuments[0]) @@ -131,18 +131,18 @@ export const useOnlineDocuments = () => { } const updateCurrentPage = useCallback((page: NotionPage) => { - setCurrentDocuments(page) + setCurrentDocument(page) }, []) const hideOnlineDocumentPreview = useCallback(() => { - setCurrentDocuments(undefined) + setCurrentDocument(undefined) }, []) return { onlineDocuments, previewOnlineDocument, updateOnlineDocuments, - currentDocuments, + currentDocument, updateCurrentPage, hideOnlineDocumentPreview, } diff --git a/web/app/components/datasets/documents/create-from-pipeline/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/index.tsx index 2bb8748d9b..5fb587d91f 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/index.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/index.tsx @@ -63,7 +63,7 @@ const CreateFormPipeline = () => { onlineDocuments, previewOnlineDocument, updateOnlineDocuments, - currentDocuments, + currentDocument, updateCurrentPage, hideOnlineDocumentPreview, } = useOnlineDocuments() @@ -324,7 +324,7 @@ const CreateFormPipeline = () => {
{currentFile && } - {currentDocuments && } + {currentDocument && } {currentWebsite && }
diff --git a/web/service/knowledge/use-dataset.ts b/web/service/knowledge/use-dataset.ts index 96eedbbafb..721f4a68a6 100644 --- a/web/service/knowledge/use-dataset.ts +++ b/web/service/knowledge/use-dataset.ts @@ -63,6 +63,7 @@ export const usePreviewNotionPage = (params: NotionPagePreviewRequest) => { queryKey: [NAME_SPACE, 'preview-notion-page'], queryFn: () => get(`notion/workspaces/${workspaceID}/pages/${pageID}/${pageType}/preview`), enabled: !!workspaceID && !!pageID && !!pageType, + staleTime: 0, }) } From 2414dbb5f83fab6408644992f4073e8f988a0bb7 Mon Sep 17 00:00:00 2001 From: twwu Date: Mon, 23 Jun 2025 16:38:19 +0800 Subject: [PATCH 3/3] feat: clear selected IDs on document deletion action in DocumentList component --- web/app/components/datasets/documents/list.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/app/components/datasets/documents/list.tsx b/web/app/components/datasets/documents/list.tsx index cebf89e1c5..1c30c125c1 100644 --- a/web/app/components/datasets/documents/list.tsx +++ b/web/app/components/datasets/documents/list.tsx @@ -166,6 +166,8 @@ const DocumentList: FC = ({ const [e] = await asyncRunSafe(opApi({ datasetId, documentIds: selectedIds }) as Promise) if (!e) { + if (actionName === DocumentActionType.delete) + onSelectedIdChange([]) Toast.notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) onUpdate() }