fix: notion kownledge datasets can't add new page (#21779)
This commit is contained in:
parent
a82943a83d
commit
70035aa9a9
1 changed files with 5 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ import useEditDocumentMetadata from '../metadata/hooks/use-edit-dataset-metadata
|
||||||
import DatasetMetadataDrawer from '../metadata/metadata-dataset/dataset-metadata-drawer'
|
import DatasetMetadataDrawer from '../metadata/metadata-dataset/dataset-metadata-drawer'
|
||||||
import StatusWithAction from '../common/document-status-with-action/status-with-action'
|
import StatusWithAction from '../common/document-status-with-action/status-with-action'
|
||||||
import { useDocLink } from '@/context/i18n'
|
import { useDocLink } from '@/context/i18n'
|
||||||
|
import { useFetchDefaultProcessRule } from '@/service/knowledge/use-create-dataset'
|
||||||
|
|
||||||
const FolderPlusIcon = ({ className }: React.SVGProps<SVGElement>) => {
|
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 ?? ''}>
|
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`)
|
router.push(`/datasets/${datasetId}/documents/create`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fetchDefaultProcessRuleMutation = useFetchDefaultProcessRule()
|
||||||
|
|
||||||
const handleSaveNotionPageSelected = async (selectedPages: NotionPage[]) => {
|
const handleSaveNotionPageSelected = async (selectedPages: NotionPage[]) => {
|
||||||
const workspacesMap = groupBy(selectedPages, 'workspace_id')
|
const workspacesMap = groupBy(selectedPages, 'workspace_id')
|
||||||
const workspaces = Object.keys(workspacesMap).map((workspaceId) => {
|
const workspaces = Object.keys(workspacesMap).map((workspaceId) => {
|
||||||
|
|
@ -186,6 +189,7 @@ const Documents: FC<IDocumentsProps> = ({ datasetId }) => {
|
||||||
pages: workspacesMap[workspaceId],
|
pages: workspacesMap[workspaceId],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const { rules } = await fetchDefaultProcessRuleMutation.mutateAsync('/datasets/process-rule')
|
||||||
const params = {
|
const params = {
|
||||||
data_source: {
|
data_source: {
|
||||||
type: dataset?.data_source_type,
|
type: dataset?.data_source_type,
|
||||||
|
|
@ -209,7 +213,7 @@ const Documents: FC<IDocumentsProps> = ({ datasetId }) => {
|
||||||
},
|
},
|
||||||
indexing_technique: dataset?.indexing_technique,
|
indexing_technique: dataset?.indexing_technique,
|
||||||
process_rule: {
|
process_rule: {
|
||||||
rules: {},
|
rules,
|
||||||
mode: ProcessMode.general,
|
mode: ProcessMode.general,
|
||||||
},
|
},
|
||||||
} as CreateDocumentReq
|
} as CreateDocumentReq
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue