Merge branch 'feat/rag-pipeline' into deploy/rag-dev

feat/datasource
twwu 11 months ago
commit b25b284d7f

@ -82,7 +82,19 @@ const ItemComponent = ({ index, style, data }: ListChildComponentProps<{
pagesMap: DataSourceNotionPageMap pagesMap: DataSourceNotionPageMap
}>) => { }>) => {
const { t } = useTranslation() 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 current = dataList[index]
const currentWithChildrenAndDescendants = listMapWithChildrenAndDescendants[current.page_id] const currentWithChildrenAndDescendants = listMapWithChildrenAndDescendants[current.page_id]
const hasChild = currentWithChildrenAndDescendants.descendants.size > 0 const hasChild = currentWithChildrenAndDescendants.descendants.size > 0

@ -122,7 +122,7 @@ export const useLocalFile = () => {
export const useOnlineDocuments = () => { export const useOnlineDocuments = () => {
const [onlineDocuments, setOnlineDocuments] = useState<NotionPage[]>([]) const [onlineDocuments, setOnlineDocuments] = useState<NotionPage[]>([])
const [currentDocuments, setCurrentDocuments] = useState<NotionPage | undefined>() const [currentDocument, setCurrentDocument] = useState<NotionPage | undefined>()
const previewOnlineDocument = useRef<NotionPage>(onlineDocuments[0]) const previewOnlineDocument = useRef<NotionPage>(onlineDocuments[0])
@ -131,18 +131,18 @@ export const useOnlineDocuments = () => {
} }
const updateCurrentPage = useCallback((page: NotionPage) => { const updateCurrentPage = useCallback((page: NotionPage) => {
setCurrentDocuments(page) setCurrentDocument(page)
}, []) }, [])
const hideOnlineDocumentPreview = useCallback(() => { const hideOnlineDocumentPreview = useCallback(() => {
setCurrentDocuments(undefined) setCurrentDocument(undefined)
}, []) }, [])
return { return {
onlineDocuments, onlineDocuments,
previewOnlineDocument, previewOnlineDocument,
updateOnlineDocuments, updateOnlineDocuments,
currentDocuments, currentDocument,
updateCurrentPage, updateCurrentPage,
hideOnlineDocumentPreview, hideOnlineDocumentPreview,
} }

@ -63,7 +63,7 @@ const CreateFormPipeline = () => {
onlineDocuments, onlineDocuments,
previewOnlineDocument, previewOnlineDocument,
updateOnlineDocuments, updateOnlineDocuments,
currentDocuments, currentDocument,
updateCurrentPage, updateCurrentPage,
hideOnlineDocumentPreview, hideOnlineDocumentPreview,
} = useOnlineDocuments() } = useOnlineDocuments()
@ -324,7 +324,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'>
{currentFile && <FilePreview file={currentFile} hidePreview={hideFilePreview} />} {currentFile && <FilePreview file={currentFile} hidePreview={hideFilePreview} />}
{currentDocuments && <OnlineDocumentPreview currentPage={currentDocuments} hidePreview={hideOnlineDocumentPreview} />} {currentDocument && <OnlineDocumentPreview currentPage={currentDocument} hidePreview={hideOnlineDocumentPreview} />}
{currentWebsite && <WebsitePreview payload={currentWebsite} hidePreview={hideWebsitePreview} />} {currentWebsite && <WebsitePreview payload={currentWebsite} hidePreview={hideWebsitePreview} />}
</div> </div>
</div> </div>

@ -147,34 +147,38 @@ const PipelineSettings = ({
<div <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' 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'> <div className='h-full min-w-0 flex-1'>
<LeftHeader title={t('datasetPipeline.documentSettings.title')} /> <div className='flex h-full flex-col px-14'>
<div className='grow overflow-y-auto'> <LeftHeader title={t('datasetPipeline.documentSettings.title')} />
<ProcessDocuments <div className='grow overflow-y-auto'>
ref={formRef} <ProcessDocuments
lastRunInputData={lastRunData!.input_data} ref={formRef}
datasourceNodeId={lastRunData!.datasource_node_id} lastRunInputData={lastRunData!.input_data}
onProcess={onClickProcess} datasourceNodeId={lastRunData!.datasource_node_id}
onPreview={onClickPreview} onProcess={onClickProcess}
onSubmit={handleSubmit} onPreview={onClickPreview}
/> onSubmit={handleSubmit}
/>
</div>
</div> </div>
</div> </div>
{/* Preview */} {/* Preview */}
<div className='flex h-full flex-1 pl-2 pt-2'> <div className='h-full min-w-0 flex-1'>
<ChunkPreview <div className='flex h-full flex-col pl-2 pt-2'>
dataSourceType={lastRunData!.datasource_type} <ChunkPreview
files={files} dataSourceType={lastRunData!.datasource_type}
onlineDocuments={onlineDocuments} files={files}
websitePages={websitePages} onlineDocuments={onlineDocuments}
isIdle={isIdle} websitePages={websitePages}
isPending={isPending && isPreview.current} isIdle={isIdle}
estimateData={estimateData} isPending={isPending && isPreview.current}
onPreview={onClickPreview} estimateData={estimateData}
handlePreviewFileChange={noop} onPreview={onClickPreview}
handlePreviewOnlineDocumentChange={noop} handlePreviewFileChange={noop}
handlePreviewWebsitePageChange={noop} handlePreviewOnlineDocumentChange={noop}
/> handlePreviewWebsitePageChange={noop}
/>
</div>
</div> </div>
</div> </div>
) )

@ -166,6 +166,8 @@ const DocumentList: FC<IDocumentListProps> = ({
const [e] = await asyncRunSafe<CommonResponse>(opApi({ datasetId, documentIds: selectedIds }) as Promise<CommonResponse>) const [e] = await asyncRunSafe<CommonResponse>(opApi({ datasetId, documentIds: selectedIds }) as Promise<CommonResponse>)
if (!e) { if (!e) {
if (actionName === DocumentActionType.delete)
onSelectedIdChange([])
Toast.notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') }) Toast.notify({ type: 'success', message: t('common.actionMsg.modifiedSuccessfully') })
onUpdate() onUpdate()
} }

@ -63,6 +63,7 @@ export const usePreviewNotionPage = (params: NotionPagePreviewRequest) => {
queryKey: [NAME_SPACE, 'preview-notion-page'], queryKey: [NAME_SPACE, 'preview-notion-page'],
queryFn: () => get<NotionPagePreviewResponse>(`notion/workspaces/${workspaceID}/pages/${pageID}/${pageType}/preview`), queryFn: () => get<NotionPagePreviewResponse>(`notion/workspaces/${workspaceID}/pages/${pageID}/${pageType}/preview`),
enabled: !!workspaceID && !!pageID && !!pageType, enabled: !!workspaceID && !!pageID && !!pageType,
staleTime: 0,
}) })
} }

Loading…
Cancel
Save