Browse Source

fix: notion kownledge datasets can't add new page (#21779)

tags/1.5.1
非法操作 4 months ago
parent
commit
70035aa9a9
No account linked to committer's email address
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      web/app/components/datasets/documents/index.tsx

+ 5
- 1
web/app/components/datasets/documents/index.tsx View File

@@ -30,6 +30,7 @@ import useEditDocumentMetadata from '../metadata/hooks/use-edit-dataset-metadata
import DatasetMetadataDrawer from '../metadata/metadata-dataset/dataset-metadata-drawer'
import StatusWithAction from '../common/document-status-with-action/status-with-action'
import { useDocLink } from '@/context/i18n'
import { useFetchDefaultProcessRule } from '@/service/knowledge/use-create-dataset'

const FolderPlusIcon = ({ className }: React.SVGProps<SVGElement>) => {
return <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" className={className ?? ''}>
@@ -178,6 +179,8 @@ const Documents: FC<IDocumentsProps> = ({ datasetId }) => {
router.push(`/datasets/${datasetId}/documents/create`)
}

const fetchDefaultProcessRuleMutation = useFetchDefaultProcessRule()

const handleSaveNotionPageSelected = async (selectedPages: NotionPage[]) => {
const workspacesMap = groupBy(selectedPages, 'workspace_id')
const workspaces = Object.keys(workspacesMap).map((workspaceId) => {
@@ -186,6 +189,7 @@ const Documents: FC<IDocumentsProps> = ({ datasetId }) => {
pages: workspacesMap[workspaceId],
}
})
const { rules } = await fetchDefaultProcessRuleMutation.mutateAsync('/datasets/process-rule')
const params = {
data_source: {
type: dataset?.data_source_type,
@@ -209,7 +213,7 @@ const Documents: FC<IDocumentsProps> = ({ datasetId }) => {
},
indexing_technique: dataset?.indexing_technique,
process_rule: {
rules: {},
rules,
mode: ProcessMode.general,
},
} as CreateDocumentReq

Loading…
Cancel
Save