mirror of
https://github.com/langgenius/dify.git
synced 2025-07-27 03:20:03 +00:00
feat: refactor data source handling and integrate OnlineDrive component in TestRunPanel
This commit is contained in:
parent
025b55ef3b
commit
3a9c79b09a
@ -16,14 +16,18 @@ const DataSourceOptions = ({
|
|||||||
datasourceNodeId,
|
datasourceNodeId,
|
||||||
onSelect,
|
onSelect,
|
||||||
}: DataSourceOptionsProps) => {
|
}: DataSourceOptionsProps) => {
|
||||||
const { datasources, options } = useDatasourceOptions(pipelineNodes)
|
const options = useDatasourceOptions(pipelineNodes)
|
||||||
|
|
||||||
const handelSelect = useCallback((value: string) => {
|
const handelSelect = useCallback((value: string) => {
|
||||||
const selectedOption = datasources.find(option => option.nodeId === value)
|
const selectedOption = options.find(option => option.value === value)
|
||||||
if (!selectedOption)
|
if (!selectedOption)
|
||||||
return
|
return
|
||||||
onSelect(selectedOption)
|
const datasource = {
|
||||||
}, [datasources, onSelect])
|
nodeId: selectedOption.value,
|
||||||
|
nodeData: selectedOption.data,
|
||||||
|
}
|
||||||
|
onSelect(datasource)
|
||||||
|
}, [onSelect, options])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (options.length > 0 && !datasourceNodeId)
|
if (options.length > 0 && !datasourceNodeId)
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { AddDocumentsStep } from './types'
|
import { AddDocumentsStep } from './types'
|
||||||
import type { DataSourceOption, Datasource } from '@/app/components/rag-pipeline/components/panel/test-run/types'
|
import type { DataSourceOption } from '@/app/components/rag-pipeline/components/panel/test-run/types'
|
||||||
import { useCallback, useMemo, useRef, useState } from 'react'
|
import { useCallback, useMemo, useRef, useState } from 'react'
|
||||||
import { BlockEnum, type Node } from '@/app/components/workflow/types'
|
import { BlockEnum, type Node } from '@/app/components/workflow/types'
|
||||||
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
||||||
import type { DatasourceType } from '@/models/pipeline'
|
|
||||||
import type { CrawlResult, CrawlResultItem, DocumentItem, FileItem } from '@/models/datasets'
|
import type { CrawlResult, CrawlResultItem, DocumentItem, FileItem } from '@/models/datasets'
|
||||||
import { CrawlStep } from '@/models/datasets'
|
import { CrawlStep } from '@/models/datasets'
|
||||||
import produce from 'immer'
|
import produce from 'immer'
|
||||||
@ -47,18 +46,6 @@ export const useAddDocumentsSteps = () => {
|
|||||||
|
|
||||||
export const useDatasourceOptions = (pipelineNodes: Node<DataSourceNodeType>[]) => {
|
export const useDatasourceOptions = (pipelineNodes: Node<DataSourceNodeType>[]) => {
|
||||||
const datasourceNodes = pipelineNodes.filter(node => node.data.type === BlockEnum.DataSource)
|
const datasourceNodes = pipelineNodes.filter(node => node.data.type === BlockEnum.DataSource)
|
||||||
const datasources: Datasource[] = useMemo(() => {
|
|
||||||
return datasourceNodes.map((node) => {
|
|
||||||
return {
|
|
||||||
nodeId: node.id,
|
|
||||||
type: node.data.provider_type as DatasourceType,
|
|
||||||
description: node.data.datasource_label,
|
|
||||||
docTitle: 'How to use?',
|
|
||||||
docLink: '',
|
|
||||||
fileExtensions: node.data.fileExtensions || [],
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, [datasourceNodes])
|
|
||||||
|
|
||||||
const options = useMemo(() => {
|
const options = useMemo(() => {
|
||||||
const options: DataSourceOption[] = []
|
const options: DataSourceOption[] = []
|
||||||
@ -70,10 +57,29 @@ export const useDatasourceOptions = (pipelineNodes: Node<DataSourceNodeType>[])
|
|||||||
data: node.data,
|
data: node.data,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
// todo: delete mock data
|
||||||
|
options.push({
|
||||||
|
label: 'Google Drive',
|
||||||
|
value: '123456',
|
||||||
|
// @ts-expect-error mock data
|
||||||
|
data: {
|
||||||
|
datasource_parameters: {},
|
||||||
|
datasource_configurations: {},
|
||||||
|
type: BlockEnum.DataSource,
|
||||||
|
title: 'Google Drive',
|
||||||
|
plugin_id: 'langgenius/google-drive',
|
||||||
|
provider_type: 'online_drive',
|
||||||
|
provider_name: 'google_drive',
|
||||||
|
datasource_name: 'google-drive',
|
||||||
|
datasource_label: 'Google Drive',
|
||||||
|
selected: false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
return options
|
return options
|
||||||
}, [datasourceNodes])
|
}, [datasourceNodes])
|
||||||
|
|
||||||
return { datasources, options }
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useLocalFile = () => {
|
export const useLocalFile = () => {
|
||||||
|
@ -84,17 +84,18 @@ const CreateFormPipeline = () => {
|
|||||||
const isVectorSpaceFull = plan.usage.vectorSpace >= plan.total.vectorSpace
|
const isVectorSpaceFull = plan.usage.vectorSpace >= plan.total.vectorSpace
|
||||||
const isShowVectorSpaceFull = allFileLoaded && isVectorSpaceFull && enableBilling
|
const isShowVectorSpaceFull = allFileLoaded && isVectorSpaceFull && enableBilling
|
||||||
const notSupportBatchUpload = enableBilling && plan.type === 'sandbox'
|
const notSupportBatchUpload = enableBilling && plan.type === 'sandbox'
|
||||||
|
const datasourceType = datasource?.nodeData.provider_type
|
||||||
|
|
||||||
const nextBtnDisabled = useMemo(() => {
|
const nextBtnDisabled = useMemo(() => {
|
||||||
if (!datasource) return true
|
if (!datasource) return true
|
||||||
if (datasource.type === DatasourceType.localFile)
|
if (datasourceType === DatasourceType.localFile)
|
||||||
return isShowVectorSpaceFull || !fileList.length || fileList.some(file => !file.file.id)
|
return isShowVectorSpaceFull || !fileList.length || fileList.some(file => !file.file.id)
|
||||||
if (datasource.type === DatasourceType.onlineDocument)
|
if (datasourceType === DatasourceType.onlineDocument)
|
||||||
return isShowVectorSpaceFull || !onlineDocuments.length
|
return isShowVectorSpaceFull || !onlineDocuments.length
|
||||||
if (datasource.type === DatasourceType.websiteCrawl)
|
if (datasourceType === DatasourceType.websiteCrawl)
|
||||||
return isShowVectorSpaceFull || !websitePages.length
|
return isShowVectorSpaceFull || !websitePages.length
|
||||||
return false
|
return false
|
||||||
}, [datasource, isShowVectorSpaceFull, fileList, onlineDocuments.length, websitePages.length])
|
}, [datasource, datasourceType, isShowVectorSpaceFull, fileList, onlineDocuments.length, websitePages.length])
|
||||||
|
|
||||||
const { mutateAsync: runPublishedPipeline, isIdle, isPending } = useRunPublishedPipeline()
|
const { mutateAsync: runPublishedPipeline, isIdle, isPending } = useRunPublishedPipeline()
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ const CreateFormPipeline = () => {
|
|||||||
if (!datasource)
|
if (!datasource)
|
||||||
return
|
return
|
||||||
const datasourceInfoList: Record<string, any>[] = []
|
const datasourceInfoList: Record<string, any>[] = []
|
||||||
if (datasource.type === DatasourceType.localFile) {
|
if (datasourceType === DatasourceType.localFile) {
|
||||||
const { id, name, type, size, extension, mime_type } = previewFile.current as File
|
const { id, name, type, size, extension, mime_type } = previewFile.current as File
|
||||||
const documentInfo = {
|
const documentInfo = {
|
||||||
related_id: id,
|
related_id: id,
|
||||||
@ -116,7 +117,7 @@ const CreateFormPipeline = () => {
|
|||||||
}
|
}
|
||||||
datasourceInfoList.push(documentInfo)
|
datasourceInfoList.push(documentInfo)
|
||||||
}
|
}
|
||||||
if (datasource.type === DatasourceType.onlineDocument) {
|
if (datasourceType === DatasourceType.onlineDocument) {
|
||||||
const { workspace_id, ...rest } = previewOnlineDocument.current
|
const { workspace_id, ...rest } = previewOnlineDocument.current
|
||||||
const documentInfo = {
|
const documentInfo = {
|
||||||
workspace_id,
|
workspace_id,
|
||||||
@ -124,13 +125,13 @@ const CreateFormPipeline = () => {
|
|||||||
}
|
}
|
||||||
datasourceInfoList.push(documentInfo)
|
datasourceInfoList.push(documentInfo)
|
||||||
}
|
}
|
||||||
if (datasource.type === DatasourceType.websiteCrawl)
|
if (datasourceType === DatasourceType.websiteCrawl)
|
||||||
datasourceInfoList.push(previewWebsitePage.current)
|
datasourceInfoList.push(previewWebsitePage.current)
|
||||||
await runPublishedPipeline({
|
await runPublishedPipeline({
|
||||||
pipeline_id: pipelineId!,
|
pipeline_id: pipelineId!,
|
||||||
inputs: data,
|
inputs: data,
|
||||||
start_node_id: datasource.nodeId,
|
start_node_id: datasource.nodeId,
|
||||||
datasource_type: datasource.type,
|
datasource_type: datasourceType as DatasourceType,
|
||||||
datasource_info_list: datasourceInfoList,
|
datasource_info_list: datasourceInfoList,
|
||||||
is_preview: true,
|
is_preview: true,
|
||||||
}, {
|
}, {
|
||||||
@ -138,13 +139,13 @@ const CreateFormPipeline = () => {
|
|||||||
setEstimateData((res as PublishedPipelineRunPreviewResponse).data.outputs)
|
setEstimateData((res as PublishedPipelineRunPreviewResponse).data.outputs)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}, [datasource, pipelineId, previewFile, previewOnlineDocument, previewWebsitePage, runPublishedPipeline])
|
}, [datasource, datasourceType, pipelineId, previewFile, previewOnlineDocument, previewWebsitePage, runPublishedPipeline])
|
||||||
|
|
||||||
const handleProcess = useCallback(async (data: Record<string, any>) => {
|
const handleProcess = useCallback(async (data: Record<string, any>) => {
|
||||||
if (!datasource)
|
if (!datasource)
|
||||||
return
|
return
|
||||||
const datasourceInfoList: Record<string, any>[] = []
|
const datasourceInfoList: Record<string, any>[] = []
|
||||||
if (datasource.type === DatasourceType.localFile) {
|
if (datasourceType === DatasourceType.localFile) {
|
||||||
fileList.forEach((file) => {
|
fileList.forEach((file) => {
|
||||||
const { id, name, type, size, extension, mime_type } = file.file
|
const { id, name, type, size, extension, mime_type } = file.file
|
||||||
const documentInfo = {
|
const documentInfo = {
|
||||||
@ -160,7 +161,7 @@ const CreateFormPipeline = () => {
|
|||||||
datasourceInfoList.push(documentInfo)
|
datasourceInfoList.push(documentInfo)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (datasource.type === DatasourceType.onlineDocument) {
|
if (datasourceType === DatasourceType.onlineDocument) {
|
||||||
onlineDocuments.forEach((page) => {
|
onlineDocuments.forEach((page) => {
|
||||||
const { workspace_id, ...rest } = page
|
const { workspace_id, ...rest } = page
|
||||||
const documentInfo = {
|
const documentInfo = {
|
||||||
@ -170,7 +171,7 @@ const CreateFormPipeline = () => {
|
|||||||
datasourceInfoList.push(documentInfo)
|
datasourceInfoList.push(documentInfo)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (datasource.type === DatasourceType.websiteCrawl) {
|
if (datasourceType === DatasourceType.websiteCrawl) {
|
||||||
websitePages.forEach((websitePage) => {
|
websitePages.forEach((websitePage) => {
|
||||||
datasourceInfoList.push(websitePage)
|
datasourceInfoList.push(websitePage)
|
||||||
})
|
})
|
||||||
@ -179,7 +180,7 @@ const CreateFormPipeline = () => {
|
|||||||
pipeline_id: pipelineId!,
|
pipeline_id: pipelineId!,
|
||||||
inputs: data,
|
inputs: data,
|
||||||
start_node_id: datasource.nodeId,
|
start_node_id: datasource.nodeId,
|
||||||
datasource_type: datasource.type,
|
datasource_type: datasourceType as DatasourceType,
|
||||||
datasource_info_list: datasourceInfoList,
|
datasource_info_list: datasourceInfoList,
|
||||||
is_preview: false,
|
is_preview: false,
|
||||||
}, {
|
}, {
|
||||||
@ -189,7 +190,7 @@ const CreateFormPipeline = () => {
|
|||||||
handleNextStep()
|
handleNextStep()
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}, [datasource, fileList, handleNextStep, onlineDocuments, pipelineId, runPublishedPipeline, websitePages])
|
}, [datasource, datasourceType, fileList, handleNextStep, onlineDocuments, pipelineId, runPublishedPipeline, websitePages])
|
||||||
|
|
||||||
const onClickProcess = useCallback(() => {
|
const onClickProcess = useCallback(() => {
|
||||||
isPreview.current = false
|
isPreview.current = false
|
||||||
@ -246,38 +247,30 @@ const CreateFormPipeline = () => {
|
|||||||
onSelect={setDatasource}
|
onSelect={setDatasource}
|
||||||
pipelineNodes={(pipelineInfo?.graph.nodes || []) as Node<DataSourceNodeType>[]}
|
pipelineNodes={(pipelineInfo?.graph.nodes || []) as Node<DataSourceNodeType>[]}
|
||||||
/>
|
/>
|
||||||
{datasource?.type === DatasourceType.localFile && (
|
{datasourceType === DatasourceType.localFile && (
|
||||||
<LocalFile
|
<LocalFile
|
||||||
files={fileList}
|
files={fileList}
|
||||||
allowedExtensions={datasource?.fileExtensions || []}
|
allowedExtensions={datasource!.nodeData.fileExtensions || []}
|
||||||
updateFile={updateFile}
|
updateFile={updateFile}
|
||||||
updateFileList={updateFileList}
|
updateFileList={updateFileList}
|
||||||
onPreview={updateCurrentFile}
|
onPreview={updateCurrentFile}
|
||||||
notSupportBatchUpload={notSupportBatchUpload}
|
notSupportBatchUpload={notSupportBatchUpload}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{datasource?.type === DatasourceType.onlineDocument && (
|
{datasourceType === DatasourceType.onlineDocument && (
|
||||||
<OnlineDocuments
|
<OnlineDocuments
|
||||||
nodeId={datasource?.nodeId || ''}
|
nodeId={datasource!.nodeId}
|
||||||
headerInfo={{
|
nodeData={datasource!.nodeData}
|
||||||
title: datasource.description,
|
|
||||||
docTitle: datasource.docTitle || '',
|
|
||||||
docLink: datasource.docLink || '',
|
|
||||||
}}
|
|
||||||
onlineDocuments={onlineDocuments}
|
onlineDocuments={onlineDocuments}
|
||||||
updateOnlineDocuments={updateOnlineDocuments}
|
updateOnlineDocuments={updateOnlineDocuments}
|
||||||
canPreview
|
canPreview
|
||||||
onPreview={updateCurrentPage}
|
onPreview={updateCurrentPage}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{datasource?.type === DatasourceType.websiteCrawl && (
|
{datasourceType === DatasourceType.websiteCrawl && (
|
||||||
<WebsiteCrawl
|
<WebsiteCrawl
|
||||||
nodeId={datasource?.nodeId || ''}
|
nodeId={datasource!.nodeId}
|
||||||
headerInfo={{
|
nodeData={datasource!.nodeData}
|
||||||
title: datasource.description,
|
|
||||||
docTitle: datasource.docTitle || '',
|
|
||||||
docLink: datasource.docLink || '',
|
|
||||||
}}
|
|
||||||
crawlResult={crawlResult}
|
crawlResult={crawlResult}
|
||||||
setCrawlResult={setCrawlResult}
|
setCrawlResult={setCrawlResult}
|
||||||
step={step}
|
step={step}
|
||||||
@ -299,7 +292,7 @@ const CreateFormPipeline = () => {
|
|||||||
currentStep === 2 && (
|
currentStep === 2 && (
|
||||||
<ProcessDocuments
|
<ProcessDocuments
|
||||||
ref={formRef}
|
ref={formRef}
|
||||||
dataSourceNodeId={datasource?.nodeId || ''}
|
dataSourceNodeId={datasource!.nodeId}
|
||||||
onProcess={onClickProcess}
|
onProcess={onClickProcess}
|
||||||
onPreview={onClickPreview}
|
onPreview={onClickPreview}
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
@ -341,7 +334,7 @@ const CreateFormPipeline = () => {
|
|||||||
<div className='h-full min-w-0 flex-1'>
|
<div className='h-full min-w-0 flex-1'>
|
||||||
<div className='flex h-full flex-col pl-2 pt-2'>
|
<div className='flex h-full flex-col pl-2 pt-2'>
|
||||||
<ChunkPreview
|
<ChunkPreview
|
||||||
dataSourceType={datasource!.type}
|
dataSourceType={datasourceType as DatasourceType}
|
||||||
files={fileList.map(file => file.file)}
|
files={fileList.map(file => file.file)}
|
||||||
onlineDocuments={onlineDocuments}
|
onlineDocuments={onlineDocuments}
|
||||||
websitePages={websitePages}
|
websitePages={websitePages}
|
||||||
|
@ -12,14 +12,18 @@ const DataSourceOptions = ({
|
|||||||
dataSourceNodeId,
|
dataSourceNodeId,
|
||||||
onSelect,
|
onSelect,
|
||||||
}: DataSourceOptionsProps) => {
|
}: DataSourceOptionsProps) => {
|
||||||
const { datasources, options } = useDatasourceOptions()
|
const options = useDatasourceOptions()
|
||||||
|
|
||||||
const handelSelect = useCallback((value: string) => {
|
const handelSelect = useCallback((value: string) => {
|
||||||
const selectedOption = datasources.find(option => option.nodeId === value)
|
const selectedOption = options.find(option => option.value === value)
|
||||||
if (!selectedOption)
|
if (!selectedOption)
|
||||||
return
|
return
|
||||||
onSelect(selectedOption)
|
const datasource = {
|
||||||
}, [datasources, onSelect])
|
nodeId: selectedOption.value,
|
||||||
|
nodeData: selectedOption.data,
|
||||||
|
}
|
||||||
|
onSelect(datasource)
|
||||||
|
}, [onSelect, options])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (options.length > 0 && !dataSourceNodeId)
|
if (options.length > 0 && !dataSourceNodeId)
|
||||||
@ -33,9 +37,10 @@ const DataSourceOptions = ({
|
|||||||
<OptionCard
|
<OptionCard
|
||||||
key={option.value}
|
key={option.value}
|
||||||
label={option.label}
|
label={option.label}
|
||||||
|
value={option.value}
|
||||||
nodeData={option.data}
|
nodeData={option.data}
|
||||||
selected={dataSourceNodeId === option.value}
|
selected={dataSourceNodeId === option.value}
|
||||||
onClick={handelSelect.bind(null, option.value)}
|
onClick={handelSelect}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React from 'react'
|
import React, { useCallback } from 'react'
|
||||||
import cn from '@/utils/classnames'
|
import cn from '@/utils/classnames'
|
||||||
import BlockIcon from '@/app/components/workflow/block-icon'
|
import BlockIcon from '@/app/components/workflow/block-icon'
|
||||||
import { BlockEnum } from '@/app/components/workflow/types'
|
import { BlockEnum } from '@/app/components/workflow/types'
|
||||||
@ -7,19 +7,25 @@ import { useToolIcon } from '@/app/components/workflow/hooks'
|
|||||||
|
|
||||||
type OptionCardProps = {
|
type OptionCardProps = {
|
||||||
label: string
|
label: string
|
||||||
|
value: string
|
||||||
selected: boolean
|
selected: boolean
|
||||||
nodeData: DataSourceNodeType
|
nodeData: DataSourceNodeType
|
||||||
onClick?: () => void
|
onClick?: (value: string) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const OptionCard = ({
|
const OptionCard = ({
|
||||||
label,
|
label,
|
||||||
|
value,
|
||||||
selected,
|
selected,
|
||||||
nodeData,
|
nodeData,
|
||||||
onClick,
|
onClick,
|
||||||
}: OptionCardProps) => {
|
}: OptionCardProps) => {
|
||||||
const toolIcon = useToolIcon(nodeData)
|
const toolIcon = useToolIcon(nodeData)
|
||||||
|
|
||||||
|
const handleClickCard = useCallback(() => {
|
||||||
|
onClick?.(value)
|
||||||
|
}, [value, onClick])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
@ -28,7 +34,7 @@ const OptionCard = ({
|
|||||||
? 'border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg shadow-xs ring-[0.5px] ring-inset ring-components-option-card-option-selected-border'
|
? 'border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg shadow-xs ring-[0.5px] ring-inset ring-components-option-card-option-selected-border'
|
||||||
: 'hover:bg-components-option-card-bg-hover hover:border-components-option-card-option-border-hover hover:shadow-xs',
|
: 'hover:bg-components-option-card-bg-hover hover:border-components-option-card-option-border-hover hover:shadow-xs',
|
||||||
)}
|
)}
|
||||||
onClick={onClick}
|
onClick={handleClickCard}
|
||||||
>
|
>
|
||||||
<div className='flex size-7 items-center justify-center rounded-lg border-[0.5px] border-components-panel-border bg-background-default-dodge p-1'>
|
<div className='flex size-7 items-center justify-center rounded-lg border-[0.5px] border-components-panel-border bg-background-default-dodge p-1'>
|
||||||
<BlockIcon
|
<BlockIcon
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
import type { NotionPage } from '@/models/common'
|
import type { NotionPage } from '@/models/common'
|
||||||
import OnlineDocumentSelector from './online-document-selector'
|
import OnlineDocumentSelector from './online-document-selector'
|
||||||
|
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
||||||
|
|
||||||
type OnlineDocumentsProps = {
|
type OnlineDocumentsProps = {
|
||||||
nodeId: string
|
nodeId: string
|
||||||
headerInfo: {
|
nodeData: DataSourceNodeType
|
||||||
title: string
|
|
||||||
docTitle: string
|
|
||||||
docLink: string
|
|
||||||
}
|
|
||||||
onlineDocuments: NotionPage[]
|
onlineDocuments: NotionPage[]
|
||||||
updateOnlineDocuments: (value: NotionPage[]) => void
|
updateOnlineDocuments: (value: NotionPage[]) => void
|
||||||
canPreview?: boolean
|
canPreview?: boolean
|
||||||
@ -17,7 +14,7 @@ type OnlineDocumentsProps = {
|
|||||||
|
|
||||||
const OnlineDocuments = ({
|
const OnlineDocuments = ({
|
||||||
nodeId,
|
nodeId,
|
||||||
headerInfo,
|
nodeData,
|
||||||
onlineDocuments,
|
onlineDocuments,
|
||||||
updateOnlineDocuments,
|
updateOnlineDocuments,
|
||||||
canPreview = false,
|
canPreview = false,
|
||||||
@ -27,7 +24,7 @@ const OnlineDocuments = ({
|
|||||||
return (
|
return (
|
||||||
<OnlineDocumentSelector
|
<OnlineDocumentSelector
|
||||||
nodeId={nodeId}
|
nodeId={nodeId}
|
||||||
headerInfo={headerInfo}
|
nodeData={nodeData}
|
||||||
value={onlineDocuments.map(page => page.page_id)}
|
value={onlineDocuments.map(page => page.page_id)}
|
||||||
onSelect={updateOnlineDocuments}
|
onSelect={updateOnlineDocuments}
|
||||||
canPreview={canPreview}
|
canPreview={canPreview}
|
||||||
|
@ -9,6 +9,7 @@ import { DatasourceType } from '@/models/pipeline'
|
|||||||
import { ssePost } from '@/service/base'
|
import { ssePost } from '@/service/base'
|
||||||
import Toast from '@/app/components/base/toast'
|
import Toast from '@/app/components/base/toast'
|
||||||
import type { DataSourceNodeCompletedResponse } from '@/types/pipeline'
|
import type { DataSourceNodeCompletedResponse } from '@/types/pipeline'
|
||||||
|
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
||||||
|
|
||||||
type OnlineDocumentSelectorProps = {
|
type OnlineDocumentSelectorProps = {
|
||||||
value?: string[]
|
value?: string[]
|
||||||
@ -18,11 +19,7 @@ type OnlineDocumentSelectorProps = {
|
|||||||
onPreview?: (selectedPage: NotionPage) => void
|
onPreview?: (selectedPage: NotionPage) => void
|
||||||
isInPipeline?: boolean
|
isInPipeline?: boolean
|
||||||
nodeId: string
|
nodeId: string
|
||||||
headerInfo: {
|
nodeData: DataSourceNodeType
|
||||||
title: string
|
|
||||||
docTitle: string
|
|
||||||
docLink: string
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const OnlineDocumentSelector = ({
|
const OnlineDocumentSelector = ({
|
||||||
@ -33,7 +30,7 @@ const OnlineDocumentSelector = ({
|
|||||||
onPreview,
|
onPreview,
|
||||||
isInPipeline = false,
|
isInPipeline = false,
|
||||||
nodeId,
|
nodeId,
|
||||||
headerInfo,
|
nodeData,
|
||||||
}: OnlineDocumentSelectorProps) => {
|
}: OnlineDocumentSelectorProps) => {
|
||||||
const pipelineId = useDatasetDetailContextWithSelector(s => s.dataset?.pipeline_id)
|
const pipelineId = useDatasetDetailContextWithSelector(s => s.dataset?.pipeline_id)
|
||||||
const [documentsData, setDocumentsData] = useState<DataSourceNotionWorkspace[]>([])
|
const [documentsData, setDocumentsData] = useState<DataSourceNotionWorkspace[]>([])
|
||||||
@ -118,6 +115,14 @@ const OnlineDocumentSelector = ({
|
|||||||
setCurrentWorkspaceId(firstWorkspaceId)
|
setCurrentWorkspaceId(firstWorkspaceId)
|
||||||
}, [firstWorkspaceId])
|
}, [firstWorkspaceId])
|
||||||
|
|
||||||
|
const headerInfo = useMemo(() => {
|
||||||
|
return {
|
||||||
|
title: nodeData.title,
|
||||||
|
docTitle: 'How to use?',
|
||||||
|
docLink: 'https://docs.dify.ai',
|
||||||
|
}
|
||||||
|
}, [nodeData])
|
||||||
|
|
||||||
if (!documentsData?.length)
|
if (!documentsData?.length)
|
||||||
return null
|
return null
|
||||||
|
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
import BlockIcon from '@/app/components/workflow/block-icon'
|
||||||
|
import { useToolIcon } from '@/app/components/workflow/hooks'
|
||||||
|
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
||||||
|
import { BlockEnum } from '@/app/components/workflow/types'
|
||||||
|
|
||||||
|
type ConnectProps = {
|
||||||
|
nodeData: DataSourceNodeType
|
||||||
|
}
|
||||||
|
|
||||||
|
const Connect = ({
|
||||||
|
nodeData,
|
||||||
|
}: ConnectProps) => {
|
||||||
|
const toolIcon = useToolIcon(nodeData)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='flex flex-col p-6'>
|
||||||
|
<div className='flex size-12 items-center justify-center rounded-[10px] border-[0.5px] border-components-card-border bg-components-card-bg p-1 shadow-lg shadow-shadow-shadow-5'>
|
||||||
|
<BlockIcon
|
||||||
|
type={BlockEnum.DataSource}
|
||||||
|
toolIcon={toolIcon}
|
||||||
|
size='md'
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<p className='mb-6 text-gray-600'>
|
||||||
|
To connect your online drive, please follow the instructions provided by your service provider.
|
||||||
|
</p>
|
||||||
|
<button className='rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600'>
|
||||||
|
Connect Now
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect
|
@ -0,0 +1,16 @@
|
|||||||
|
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
||||||
|
import Connect from './connect'
|
||||||
|
|
||||||
|
type OnlineDriveProps = {
|
||||||
|
nodeData: DataSourceNodeType
|
||||||
|
}
|
||||||
|
|
||||||
|
const OnlineDrive = ({
|
||||||
|
nodeData,
|
||||||
|
}: OnlineDriveProps) => {
|
||||||
|
return (
|
||||||
|
<Connect nodeData={nodeData} />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default OnlineDrive
|
@ -1,5 +1,5 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import type { CrawlResult, CrawlResultItem } from '@/models/datasets'
|
import type { CrawlResult, CrawlResultItem } from '@/models/datasets'
|
||||||
import { CrawlStep } from '@/models/datasets'
|
import { CrawlStep } from '@/models/datasets'
|
||||||
@ -19,22 +19,19 @@ import type {
|
|||||||
DataSourceNodeCompletedResponse,
|
DataSourceNodeCompletedResponse,
|
||||||
DataSourceNodeProcessingResponse,
|
DataSourceNodeProcessingResponse,
|
||||||
} from '@/types/pipeline'
|
} from '@/types/pipeline'
|
||||||
|
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
||||||
|
|
||||||
const I18N_PREFIX = 'datasetCreation.stepOne.website'
|
const I18N_PREFIX = 'datasetCreation.stepOne.website'
|
||||||
|
|
||||||
export type CrawlerProps = {
|
export type CrawlerProps = {
|
||||||
nodeId: string
|
nodeId: string
|
||||||
|
nodeData: DataSourceNodeType
|
||||||
crawlResult: CrawlResult | undefined
|
crawlResult: CrawlResult | undefined
|
||||||
setCrawlResult: (payload: CrawlResult) => void
|
setCrawlResult: (payload: CrawlResult) => void
|
||||||
step: CrawlStep
|
step: CrawlStep
|
||||||
setStep: (step: CrawlStep) => void
|
setStep: (step: CrawlStep) => void
|
||||||
checkedCrawlResult: CrawlResultItem[]
|
checkedCrawlResult: CrawlResultItem[]
|
||||||
onCheckedCrawlResultChange: (payload: CrawlResultItem[]) => void
|
onCheckedCrawlResultChange: (payload: CrawlResultItem[]) => void
|
||||||
headerInfo: {
|
|
||||||
title: string
|
|
||||||
docTitle: string
|
|
||||||
docLink: string
|
|
||||||
}
|
|
||||||
previewIndex?: number
|
previewIndex?: number
|
||||||
onPreview?: (payload: CrawlResultItem, index: number) => void
|
onPreview?: (payload: CrawlResultItem, index: number) => void
|
||||||
isInPipeline?: boolean
|
isInPipeline?: boolean
|
||||||
@ -42,12 +39,12 @@ export type CrawlerProps = {
|
|||||||
|
|
||||||
const Crawler = ({
|
const Crawler = ({
|
||||||
nodeId,
|
nodeId,
|
||||||
|
nodeData,
|
||||||
crawlResult,
|
crawlResult,
|
||||||
setCrawlResult,
|
setCrawlResult,
|
||||||
step,
|
step,
|
||||||
setStep,
|
setStep,
|
||||||
checkedCrawlResult,
|
checkedCrawlResult,
|
||||||
headerInfo,
|
|
||||||
onCheckedCrawlResultChange,
|
onCheckedCrawlResultChange,
|
||||||
previewIndex,
|
previewIndex,
|
||||||
onPreview,
|
onPreview,
|
||||||
@ -125,6 +122,14 @@ const Crawler = ({
|
|||||||
handleRun(value)
|
handleRun(value)
|
||||||
}, [handleRun])
|
}, [handleRun])
|
||||||
|
|
||||||
|
const headerInfo = useMemo(() => {
|
||||||
|
return {
|
||||||
|
title: nodeData.title,
|
||||||
|
docTitle: 'How to use?',
|
||||||
|
docLink: 'https://docs.dify.ai',
|
||||||
|
}
|
||||||
|
}, [nodeData])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='flex flex-col'>
|
<div className='flex flex-col'>
|
||||||
<Header
|
<Header
|
||||||
|
@ -7,12 +7,12 @@ type WebsiteCrawlProps = CrawlerProps
|
|||||||
|
|
||||||
const WebsiteCrawl = ({
|
const WebsiteCrawl = ({
|
||||||
nodeId,
|
nodeId,
|
||||||
|
nodeData,
|
||||||
crawlResult,
|
crawlResult,
|
||||||
setCrawlResult,
|
setCrawlResult,
|
||||||
step,
|
step,
|
||||||
setStep,
|
setStep,
|
||||||
checkedCrawlResult,
|
checkedCrawlResult,
|
||||||
headerInfo,
|
|
||||||
onCheckedCrawlResultChange,
|
onCheckedCrawlResultChange,
|
||||||
previewIndex,
|
previewIndex,
|
||||||
onPreview,
|
onPreview,
|
||||||
@ -21,12 +21,12 @@ const WebsiteCrawl = ({
|
|||||||
return (
|
return (
|
||||||
<Crawler
|
<Crawler
|
||||||
nodeId={nodeId}
|
nodeId={nodeId}
|
||||||
|
nodeData={nodeData}
|
||||||
crawlResult={crawlResult}
|
crawlResult={crawlResult}
|
||||||
setCrawlResult={setCrawlResult}
|
setCrawlResult={setCrawlResult}
|
||||||
step={step}
|
step={step}
|
||||||
setStep={setStep}
|
setStep={setStep}
|
||||||
checkedCrawlResult={checkedCrawlResult}
|
checkedCrawlResult={checkedCrawlResult}
|
||||||
headerInfo={headerInfo}
|
|
||||||
onCheckedCrawlResultChange={onCheckedCrawlResultChange}
|
onCheckedCrawlResultChange={onCheckedCrawlResultChange}
|
||||||
previewIndex={previewIndex}
|
previewIndex={previewIndex}
|
||||||
onPreview={onPreview}
|
onPreview={onPreview}
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import type { DataSourceOption, Datasource } from './types'
|
import type { DataSourceOption } from './types'
|
||||||
import { TestRunStep } from './types'
|
import { TestRunStep } from './types'
|
||||||
import { useNodes } from 'reactflow'
|
import { useNodes } from 'reactflow'
|
||||||
import { BlockEnum } from '@/app/components/workflow/types'
|
import { BlockEnum } from '@/app/components/workflow/types'
|
||||||
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
||||||
import { useCallback, useMemo, useState } from 'react'
|
import { useCallback, useMemo, useState } from 'react'
|
||||||
import type { DatasourceType } from '@/models/pipeline'
|
|
||||||
import type { CrawlResult } from '@/models/datasets'
|
import type { CrawlResult } from '@/models/datasets'
|
||||||
import { type CrawlResultItem, CrawlStep, type FileItem } from '@/models/datasets'
|
import { type CrawlResultItem, CrawlStep, type FileItem } from '@/models/datasets'
|
||||||
import produce from 'immer'
|
import produce from 'immer'
|
||||||
@ -45,18 +44,6 @@ export const useTestRunSteps = () => {
|
|||||||
export const useDatasourceOptions = () => {
|
export const useDatasourceOptions = () => {
|
||||||
const nodes = useNodes<DataSourceNodeType>()
|
const nodes = useNodes<DataSourceNodeType>()
|
||||||
const datasourceNodes = nodes.filter(node => node.data.type === BlockEnum.DataSource)
|
const datasourceNodes = nodes.filter(node => node.data.type === BlockEnum.DataSource)
|
||||||
const datasources: Datasource[] = useMemo(() => {
|
|
||||||
return datasourceNodes.map((node) => {
|
|
||||||
return {
|
|
||||||
nodeId: node.id,
|
|
||||||
type: node.data.provider_type as DatasourceType,
|
|
||||||
description: node.data.datasource_label,
|
|
||||||
docTitle: 'How to use?',
|
|
||||||
docLink: '',
|
|
||||||
fileExtensions: node.data.fileExtensions || [],
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, [datasourceNodes])
|
|
||||||
|
|
||||||
const options = useMemo(() => {
|
const options = useMemo(() => {
|
||||||
const options: DataSourceOption[] = []
|
const options: DataSourceOption[] = []
|
||||||
@ -68,10 +55,28 @@ export const useDatasourceOptions = () => {
|
|||||||
data: node.data,
|
data: node.data,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
// todo: delete mock data
|
||||||
|
options.push({
|
||||||
|
label: 'Google Drive',
|
||||||
|
value: '123456',
|
||||||
|
// @ts-expect-error mock data
|
||||||
|
data: {
|
||||||
|
datasource_parameters: {},
|
||||||
|
datasource_configurations: {},
|
||||||
|
type: BlockEnum.DataSource,
|
||||||
|
title: 'Google Drive',
|
||||||
|
plugin_id: 'langgenius/google-drive',
|
||||||
|
provider_type: 'online_drive',
|
||||||
|
provider_name: 'google_drive',
|
||||||
|
datasource_name: 'google-drive',
|
||||||
|
datasource_label: 'Google Drive',
|
||||||
|
selected: false,
|
||||||
|
},
|
||||||
|
})
|
||||||
return options
|
return options
|
||||||
}, [datasourceNodes])
|
}, [datasourceNodes])
|
||||||
|
|
||||||
return { datasources, options }
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useLocalFile = () => {
|
export const useLocalFile = () => {
|
||||||
|
@ -16,6 +16,7 @@ import { TransferMethod } from '@/types/app'
|
|||||||
import CloseButton from './close-button'
|
import CloseButton from './close-button'
|
||||||
import Header from './header'
|
import Header from './header'
|
||||||
import FooterTips from './footer-tips'
|
import FooterTips from './footer-tips'
|
||||||
|
import OnlineDrive from './data-source/online-drive'
|
||||||
|
|
||||||
const TestRunPanel = () => {
|
const TestRunPanel = () => {
|
||||||
const setShowDebugAndPreviewPanel = useWorkflowStoreWithSelector(state => state.setShowDebugAndPreviewPanel)
|
const setShowDebugAndPreviewPanel = useWorkflowStoreWithSelector(state => state.setShowDebugAndPreviewPanel)
|
||||||
@ -51,17 +52,18 @@ const TestRunPanel = () => {
|
|||||||
|
|
||||||
const isVectorSpaceFull = plan.usage.vectorSpace >= plan.total.vectorSpace
|
const isVectorSpaceFull = plan.usage.vectorSpace >= plan.total.vectorSpace
|
||||||
const isShowVectorSpaceFull = allFileLoaded && isVectorSpaceFull && enableBilling
|
const isShowVectorSpaceFull = allFileLoaded && isVectorSpaceFull && enableBilling
|
||||||
|
const datasourceType = datasource?.nodeData.provider_type
|
||||||
|
|
||||||
const nextBtnDisabled = useMemo(() => {
|
const nextBtnDisabled = useMemo(() => {
|
||||||
if (!datasource) return true
|
if (!datasource) return true
|
||||||
if (datasource.type === DatasourceType.localFile)
|
if (datasourceType === DatasourceType.localFile)
|
||||||
return isShowVectorSpaceFull || !fileList.length || fileList.some(file => !file.file.id)
|
return isShowVectorSpaceFull || !fileList.length || fileList.some(file => !file.file.id)
|
||||||
if (datasource.type === DatasourceType.onlineDocument)
|
if (datasourceType === DatasourceType.onlineDocument)
|
||||||
return isShowVectorSpaceFull || !onlineDocuments.length
|
return isShowVectorSpaceFull || !onlineDocuments.length
|
||||||
if (datasource.type === DatasourceType.websiteCrawl)
|
if (datasourceType === DatasourceType.websiteCrawl)
|
||||||
return isShowVectorSpaceFull || !websitePages.length
|
return isShowVectorSpaceFull || !websitePages.length
|
||||||
return false
|
return false
|
||||||
}, [datasource, isShowVectorSpaceFull, fileList, onlineDocuments.length, websitePages.length])
|
}, [datasource, datasourceType, isShowVectorSpaceFull, fileList, onlineDocuments.length, websitePages.length])
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
setShowDebugAndPreviewPanel(false)
|
setShowDebugAndPreviewPanel(false)
|
||||||
@ -71,7 +73,7 @@ const TestRunPanel = () => {
|
|||||||
if (!datasource)
|
if (!datasource)
|
||||||
return
|
return
|
||||||
const datasourceInfoList: Record<string, any>[] = []
|
const datasourceInfoList: Record<string, any>[] = []
|
||||||
if (datasource.type === DatasourceType.localFile) {
|
if (datasourceType === DatasourceType.localFile) {
|
||||||
const { id, name, type, size, extension, mime_type } = fileList[0].file
|
const { id, name, type, size, extension, mime_type } = fileList[0].file
|
||||||
const documentInfo = {
|
const documentInfo = {
|
||||||
related_id: id,
|
related_id: id,
|
||||||
@ -85,7 +87,7 @@ const TestRunPanel = () => {
|
|||||||
}
|
}
|
||||||
datasourceInfoList.push(documentInfo)
|
datasourceInfoList.push(documentInfo)
|
||||||
}
|
}
|
||||||
if (datasource.type === DatasourceType.onlineDocument) {
|
if (datasourceType === DatasourceType.onlineDocument) {
|
||||||
const { workspace_id, ...rest } = onlineDocuments[0]
|
const { workspace_id, ...rest } = onlineDocuments[0]
|
||||||
const documentInfo = {
|
const documentInfo = {
|
||||||
workspace_id,
|
workspace_id,
|
||||||
@ -93,15 +95,15 @@ const TestRunPanel = () => {
|
|||||||
}
|
}
|
||||||
datasourceInfoList.push(documentInfo)
|
datasourceInfoList.push(documentInfo)
|
||||||
}
|
}
|
||||||
if (datasource.type === DatasourceType.websiteCrawl)
|
if (datasourceType === DatasourceType.websiteCrawl)
|
||||||
datasourceInfoList.push(websitePages[0])
|
datasourceInfoList.push(websitePages[0])
|
||||||
handleRun({
|
handleRun({
|
||||||
inputs: data,
|
inputs: data,
|
||||||
start_node_id: datasource.nodeId,
|
start_node_id: datasource.nodeId,
|
||||||
datasource_type: datasource.type,
|
datasource_type: datasourceType,
|
||||||
datasource_info_list: datasourceInfoList,
|
datasource_info_list: datasourceInfoList,
|
||||||
})
|
})
|
||||||
}, [datasource, fileList, handleRun, onlineDocuments, websitePages])
|
}, [datasource, datasourceType, fileList, handleRun, onlineDocuments, websitePages])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -118,37 +120,29 @@ const TestRunPanel = () => {
|
|||||||
dataSourceNodeId={datasource?.nodeId || ''}
|
dataSourceNodeId={datasource?.nodeId || ''}
|
||||||
onSelect={setDatasource}
|
onSelect={setDatasource}
|
||||||
/>
|
/>
|
||||||
{datasource?.type === DatasourceType.localFile && (
|
{datasourceType === DatasourceType.localFile && (
|
||||||
<LocalFile
|
<LocalFile
|
||||||
files={fileList}
|
files={fileList}
|
||||||
allowedExtensions={datasource?.fileExtensions || []}
|
allowedExtensions={datasource!.nodeData.fileExtensions || []}
|
||||||
updateFile={updateFile}
|
updateFile={updateFile}
|
||||||
updateFileList={updateFileList}
|
updateFileList={updateFileList}
|
||||||
notSupportBatchUpload={false} // only support single file upload in test run
|
notSupportBatchUpload={false} // only support single file upload in test run
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{datasource?.type === DatasourceType.onlineDocument && (
|
{datasourceType === DatasourceType.onlineDocument && (
|
||||||
<OnlineDocuments
|
<OnlineDocuments
|
||||||
nodeId={datasource?.nodeId || ''}
|
nodeId={datasource!.nodeId}
|
||||||
headerInfo={{
|
nodeData={datasource!.nodeData}
|
||||||
title: datasource.description,
|
|
||||||
docTitle: datasource.docTitle || '',
|
|
||||||
docLink: datasource.docLink || '',
|
|
||||||
}}
|
|
||||||
onlineDocuments={onlineDocuments}
|
onlineDocuments={onlineDocuments}
|
||||||
updateOnlineDocuments={updateOnlineDocuments}
|
updateOnlineDocuments={updateOnlineDocuments}
|
||||||
isInPipeline
|
isInPipeline
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{datasource?.type === DatasourceType.websiteCrawl && (
|
{datasourceType === DatasourceType.websiteCrawl && (
|
||||||
<WebsiteCrawl
|
<WebsiteCrawl
|
||||||
nodeId={datasource?.nodeId || ''}
|
nodeId={datasource!.nodeId}
|
||||||
checkedCrawlResult={websitePages}
|
checkedCrawlResult={websitePages}
|
||||||
headerInfo={{
|
nodeData={datasource!.nodeData}
|
||||||
title: datasource.description,
|
|
||||||
docTitle: datasource.docTitle || '',
|
|
||||||
docLink: datasource.docLink || '',
|
|
||||||
}}
|
|
||||||
crawlResult={crawlResult}
|
crawlResult={crawlResult}
|
||||||
setCrawlResult={setCrawlResult}
|
setCrawlResult={setCrawlResult}
|
||||||
step={step}
|
step={step}
|
||||||
@ -157,6 +151,12 @@ const TestRunPanel = () => {
|
|||||||
isInPipeline
|
isInPipeline
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{datasourceType === DatasourceType.onlineDrive && (
|
||||||
|
<OnlineDrive
|
||||||
|
nodeData={datasource!.nodeData}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
{isShowVectorSpaceFull && (
|
{isShowVectorSpaceFull && (
|
||||||
<VectorSpaceFull />
|
<VectorSpaceFull />
|
||||||
)}
|
)}
|
||||||
@ -169,7 +169,7 @@ const TestRunPanel = () => {
|
|||||||
{
|
{
|
||||||
currentStep === 2 && (
|
currentStep === 2 && (
|
||||||
<DocumentProcessing
|
<DocumentProcessing
|
||||||
dataSourceNodeId={datasource?.nodeId || ''}
|
dataSourceNodeId={datasource!.nodeId}
|
||||||
onProcess={handleProcess}
|
onProcess={handleProcess}
|
||||||
onBack={handleBackStep}
|
onBack={handleBackStep}
|
||||||
/>
|
/>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
import type { DataSourceNodeType } from '@/app/components/workflow/nodes/data-source/types'
|
||||||
import type { DatasourceType } from '@/models/pipeline'
|
|
||||||
|
|
||||||
export enum TestRunStep {
|
export enum TestRunStep {
|
||||||
dataSource = 'dataSource',
|
dataSource = 'dataSource',
|
||||||
@ -14,9 +13,5 @@ export type DataSourceOption = {
|
|||||||
|
|
||||||
export type Datasource = {
|
export type Datasource = {
|
||||||
nodeId: string
|
nodeId: string
|
||||||
type: DatasourceType
|
nodeData: DataSourceNodeType
|
||||||
description: string
|
|
||||||
docTitle?: string
|
|
||||||
docLink?: string
|
|
||||||
fileExtensions?: string[]
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user