fix: segement settings of documents raise error (#8971)

This commit is contained in:
非法操作 2024-10-25 16:58:50 +08:00 committed by GitHub
parent fb218f8b10
commit fd437ff4c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 7 deletions

View File

@ -5,7 +5,7 @@ import { useBoolean } from 'ahooks'
import { useContext } from 'use-context-selector' import { useContext } from 'use-context-selector'
import { useRouter } from 'next/navigation' import { useRouter } from 'next/navigation'
import DatasetDetailContext from '@/context/dataset-detail' import DatasetDetailContext from '@/context/dataset-detail'
import type { FullDocumentDetail } from '@/models/datasets' import type { CrawlOptions, CustomFile, FullDocumentDetail } from '@/models/datasets'
import type { MetadataType } from '@/service/datasets' import type { MetadataType } from '@/service/datasets'
import { fetchDocumentDetail } from '@/service/datasets' import { fetchDocumentDetail } from '@/service/datasets'
@ -15,6 +15,7 @@ import AccountSetting from '@/app/components/header/account-setting'
import AppUnavailable from '@/app/components/base/app-unavailable' import AppUnavailable from '@/app/components/base/app-unavailable'
import { useDefaultModel } from '@/app/components/header/account-setting/model-provider-page/hooks' import { useDefaultModel } from '@/app/components/header/account-setting/model-provider-page/hooks'
import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import { ModelTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations'
import type { NotionPage } from '@/models/common'
type DocumentSettingsProps = { type DocumentSettingsProps = {
datasetId: string datasetId: string
@ -40,7 +41,7 @@ const DocumentSettings = ({ datasetId, documentId }: DocumentSettingsProps) => {
page_id: documentDetail?.data_source_info.notion_page_id, page_id: documentDetail?.data_source_info.notion_page_id,
page_name: documentDetail?.name, page_name: documentDetail?.name,
page_icon: documentDetail?.data_source_info.notion_page_icon, page_icon: documentDetail?.data_source_info.notion_page_icon,
type: documentDetail?.data_source_info.type, type: documentDetail?.data_source_type,
} }
}, [documentDetail]) }, [documentDetail])
useEffect(() => { useEffect(() => {
@ -72,7 +73,7 @@ const DocumentSettings = ({ datasetId, documentId }: DocumentSettingsProps) => {
onSetting={showSetAPIKey} onSetting={showSetAPIKey}
datasetId={datasetId} datasetId={datasetId}
dataSourceType={documentDetail.data_source_type} dataSourceType={documentDetail.data_source_type}
notionPages={[currentPage]} notionPages={[currentPage as unknown as NotionPage]}
websitePages={[ websitePages={[
{ {
title: documentDetail.name, title: documentDetail.name,
@ -81,12 +82,13 @@ const DocumentSettings = ({ datasetId, documentId }: DocumentSettingsProps) => {
description: '', description: '',
}, },
]} ]}
fireCrawlJobId={documentDetail.data_source_info?.job_id} websiteCrawlProvider={documentDetail.data_source_info?.provider}
crawlOptions={documentDetail.data_source_info} websiteCrawlJobId={documentDetail.data_source_info?.job_id}
crawlOptions={documentDetail.data_source_info as unknown as CrawlOptions}
indexingType={indexingTechnique || ''} indexingType={indexingTechnique || ''}
isSetting isSetting
documentDetail={documentDetail} documentDetail={documentDetail}
files={[documentDetail.data_source_info.upload_file]} files={[documentDetail.data_source_info.upload_file as CustomFile]}
onSave={saveHandler} onSave={saveHandler}
onCancel={cancelHandler} onCancel={cancelHandler}
/> />

View File

@ -1,4 +1,4 @@
import type { DataSourceNotionPage } from './common' import type { DataSourceNotionPage, DataSourceProvider } from './common'
import type { AppIconType, AppMode, RetrievalConfig } from '@/types/app' import type { AppIconType, AppMode, RetrievalConfig } from '@/types/app'
import type { Tag } from '@/app/components/base/tag-management/constant' import type { Tag } from '@/app/components/base/tag-management/constant'
@ -230,6 +230,9 @@ export type DataSourceInfo = {
extension: string extension: string
} }
notion_page_icon?: string notion_page_icon?: string
notion_workspace_id?: string
notion_page_id?: string
provider?: DataSourceProvider
job_id: string job_id: string
url: string url: string
} }