mirror of https://github.com/langgenius/dify.git
Merge branch 'feat/rag-pipeline' into deploy/rag-dev
This commit is contained in:
commit
b25b284d7f
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ export const useLocalFile = () => {
|
|||
|
||||
export const useOnlineDocuments = () => {
|
||||
const [onlineDocuments, setOnlineDocuments] = useState<NotionPage[]>([])
|
||||
const [currentDocuments, setCurrentDocuments] = useState<NotionPage | undefined>()
|
||||
const [currentDocument, setCurrentDocument] = useState<NotionPage | undefined>()
|
||||
|
||||
const previewOnlineDocument = useRef<NotionPage>(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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ const CreateFormPipeline = () => {
|
|||
onlineDocuments,
|
||||
previewOnlineDocument,
|
||||
updateOnlineDocuments,
|
||||
currentDocuments,
|
||||
currentDocument,
|
||||
updateCurrentPage,
|
||||
hideOnlineDocumentPreview,
|
||||
} = useOnlineDocuments()
|
||||
|
|
@ -324,7 +324,7 @@ const CreateFormPipeline = () => {
|
|||
<div className='h-full min-w-0 flex-1'>
|
||||
<div className='flex h-full flex-col pl-2 pt-2'>
|
||||
{currentFile && <FilePreview file={currentFile} hidePreview={hideFilePreview} />}
|
||||
{currentDocuments && <OnlineDocumentPreview currentPage={currentDocuments} hidePreview={hideOnlineDocumentPreview} />}
|
||||
{currentDocument && <OnlineDocumentPreview currentPage={currentDocument} hidePreview={hideOnlineDocumentPreview} />}
|
||||
{currentWebsite && <WebsitePreview payload={currentWebsite} hidePreview={hideWebsitePreview} />}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -147,34 +147,38 @@ const PipelineSettings = ({
|
|||
<div
|
||||
className='relative flex h-[calc(100vh-56px)] min-w-[1024px] overflow-x-auto rounded-t-2xl border-t border-effects-highlight bg-background-default-subtle'
|
||||
>
|
||||
<div className='flex h-full flex-1 flex-col px-14'>
|
||||
<LeftHeader title={t('datasetPipeline.documentSettings.title')} />
|
||||
<div className='grow overflow-y-auto'>
|
||||
<ProcessDocuments
|
||||
ref={formRef}
|
||||
lastRunInputData={lastRunData!.input_data}
|
||||
datasourceNodeId={lastRunData!.datasource_node_id}
|
||||
onProcess={onClickProcess}
|
||||
onPreview={onClickPreview}
|
||||
onSubmit={handleSubmit}
|
||||
/>
|
||||
<div className='h-full min-w-0 flex-1'>
|
||||
<div className='flex h-full flex-col px-14'>
|
||||
<LeftHeader title={t('datasetPipeline.documentSettings.title')} />
|
||||
<div className='grow overflow-y-auto'>
|
||||
<ProcessDocuments
|
||||
ref={formRef}
|
||||
lastRunInputData={lastRunData!.input_data}
|
||||
datasourceNodeId={lastRunData!.datasource_node_id}
|
||||
onProcess={onClickProcess}
|
||||
onPreview={onClickPreview}
|
||||
onSubmit={handleSubmit}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* Preview */}
|
||||
<div className='flex h-full flex-1 pl-2 pt-2'>
|
||||
<ChunkPreview
|
||||
dataSourceType={lastRunData!.datasource_type}
|
||||
files={files}
|
||||
onlineDocuments={onlineDocuments}
|
||||
websitePages={websitePages}
|
||||
isIdle={isIdle}
|
||||
isPending={isPending && isPreview.current}
|
||||
estimateData={estimateData}
|
||||
onPreview={onClickPreview}
|
||||
handlePreviewFileChange={noop}
|
||||
handlePreviewOnlineDocumentChange={noop}
|
||||
handlePreviewWebsitePageChange={noop}
|
||||
/>
|
||||
<div className='h-full min-w-0 flex-1'>
|
||||
<div className='flex h-full flex-col pl-2 pt-2'>
|
||||
<ChunkPreview
|
||||
dataSourceType={lastRunData!.datasource_type}
|
||||
files={files}
|
||||
onlineDocuments={onlineDocuments}
|
||||
websitePages={websitePages}
|
||||
isIdle={isIdle}
|
||||
isPending={isPending && isPreview.current}
|
||||
estimateData={estimateData}
|
||||
onPreview={onClickPreview}
|
||||
handlePreviewFileChange={noop}
|
||||
handlePreviewOnlineDocumentChange={noop}
|
||||
handlePreviewWebsitePageChange={noop}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -166,6 +166,8 @@ const DocumentList: FC<IDocumentListProps> = ({
|
|||
const [e] = await asyncRunSafe<CommonResponse>(opApi({ datasetId, documentIds: selectedIds }) as Promise<CommonResponse>)
|
||||
|
||||
if (!e) {
|
||||
if (actionName === DocumentActionType.delete)
|
||||
onSelectedIdChange([])
|
||||
Toast.notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
|
||||
onUpdate()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ export const usePreviewNotionPage = (params: NotionPagePreviewRequest) => {
|
|||
queryKey: [NAME_SPACE, 'preview-notion-page'],
|
||||
queryFn: () => get<NotionPagePreviewResponse>(`notion/workspaces/${workspaceID}/pages/${pageID}/${pageType}/preview`),
|
||||
enabled: !!workspaceID && !!pageID && !!pageType,
|
||||
staleTime: 0,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue