merge origin/feat/parent-child-retrival

pull/12097/head
NFish 1 year ago
parent eead099c5e
commit fa3f8c5bb0

@ -15,7 +15,7 @@ export const ChunkLabel: FC<ChunkLabelProps> = (props) => {
{label} {label}
</span> </span>
<span> <span>
· ·
</span> </span>
<span> <span>
{`${characterCount} characters`} {`${characterCount} characters`}
@ -29,9 +29,9 @@ export const ChunkContainer: FC<ChunkContainerProps> = (props) => {
const { label, characterCount, children } = props const { label, characterCount, children } = props
return <div className='space-y-2'> return <div className='space-y-2'>
<ChunkLabel label={label} characterCount={characterCount} /> <ChunkLabel label={label} characterCount={characterCount} />
<div className='text-text-secondary text-sm tracking-[-0.0005em]'> <p className='text-text-secondary body-md-regular'>
{children} {children}
</div> </p>
</div> </div>
} }

@ -1,6 +1,6 @@
.filePreview { .filePreview {
@apply flex flex-col border-l border-gray-200 shrink-0; @apply flex flex-col border-l border-gray-200 shrink-0;
width: 50%; width: 100%;
background-color: #fcfcfd; background-color: #fcfcfd;
} }

@ -44,7 +44,7 @@ const FilePreview = ({
}, [file]) }, [file])
return ( return (
<div className={cn(s.filePreview)}> <div className={cn(s.filePreview, 'h-full')}>
<div className={cn(s.previewHeader)}> <div className={cn(s.previewHeader)}>
<div className={cn(s.title)}> <div className={cn(s.title)}>
<span>{t('datasetCreation.stepOne.filePreview')}</span> <span>{t('datasetCreation.stepOne.filePreview')}</span>

@ -122,31 +122,29 @@ const DatasetUpdateForm = ({ datasetId }: DatasetUpdateFormProps) => {
return <AppUnavailable code={500} unknownReason={t('datasetCreation.error.unavailable') as string} /> return <AppUnavailable code={500} unknownReason={t('datasetCreation.error.unavailable') as string} />
return ( return (
<div className='flex flex-col' style={{ height: 'calc(100vh - 56px)' }}> <div className='flex flex-col bg-components-panel-bg' style={{ height: 'calc(100vh - 56px)' }}>
<div className="grow bg-components-panel-bg flex flex-col max-h-full h-full"> <Topbar activeIndex={step - 1} />
<Topbar activeIndex={step - 1} /> <div style={{ height: 'calc(100% - 52px)' }}>
<div className={step === 1 ? 'block h-full max-h-full overflow-auto' : 'hidden'}> {step === 1 && <StepOne
<StepOne hasConnection={hasConnection}
hasConnection={hasConnection} onSetting={() => setShowAccountSettingModal({ payload: 'data-source' })}
onSetting={() => setShowAccountSettingModal({ payload: 'data-source' })} datasetId={datasetId}
datasetId={datasetId} dataSourceType={dataSourceType}
dataSourceType={dataSourceType} dataSourceTypeDisable={!!detail?.data_source_type}
dataSourceTypeDisable={!!detail?.data_source_type} changeType={setDataSourceType}
changeType={setDataSourceType} files={fileList}
files={fileList} updateFile={updateFile}
updateFile={updateFile} updateFileList={updateFileList}
updateFileList={updateFileList} notionPages={notionPages}
notionPages={notionPages} updateNotionPages={updateNotionPages}
updateNotionPages={updateNotionPages} onStepChange={nextStep}
onStepChange={nextStep} websitePages={websitePages}
websitePages={websitePages} updateWebsitePages={setWebsitePages}
updateWebsitePages={setWebsitePages} onWebsiteCrawlProviderChange={setWebsiteCrawlProvider}
onWebsiteCrawlProviderChange={setWebsiteCrawlProvider} onWebsiteCrawlJobIdChange={setWebsiteCrawlJobId}
onWebsiteCrawlJobIdChange={setWebsiteCrawlJobId} crawlOptions={crawlOptions}
crawlOptions={crawlOptions} onCrawlOptionsChange={setCrawlOptions}
onCrawlOptionsChange={setCrawlOptions} />}
/>
</div>
{(step === 2 && (!datasetId || (datasetId && !!detail))) && <StepTwo {(step === 2 && (!datasetId || (datasetId && !!detail))) && <StepTwo
isAPIKeySet={!!embeddingsDefaultModel} isAPIKeySet={!!embeddingsDefaultModel}
onSetting={() => setShowAccountSettingModal({ payload: 'provider' })} onSetting={() => setShowAccountSettingModal({ payload: 'provider' })}

@ -44,7 +44,7 @@ const NotionPagePreview = ({
}, [currentPage]) }, [currentPage])
return ( return (
<div className={cn(s.filePreview)}> <div className={cn(s.filePreview, 'h-full')}>
<div className={cn(s.previewHeader)}> <div className={cn(s.previewHeader)}>
<div className={cn(s.title)}> <div className={cn(s.title)}>
<span>{t('datasetCreation.stepOne.pagePreview')}</span> <span>{t('datasetCreation.stepOne.pagePreview')}</span>

@ -127,7 +127,7 @@ const StepOne = ({
return ( return (
<div className='flex w-full h-full'> <div className='flex w-full h-full'>
<div className='w-1/2 overflow-y-auto relative'> <div className='w-1/2 h-full overflow-y-auto relative'>
<div className='flex justify-end'> <div className='flex justify-end'>
<div className={classNames(s.form)}> <div className={classNames(s.form)}>
{ {
@ -285,9 +285,11 @@ const StepOne = ({
<EmptyDatasetCreationModal show={showModal} onHide={modalCloseHandle} /> <EmptyDatasetCreationModal show={showModal} onHide={modalCloseHandle} />
</div> </div>
</div> </div>
{currentFile && <FilePreview file={currentFile} hidePreview={hideFilePreview} />} <div className='w-1/2 h-full overflow-y-auto'>
{currentNotionPage && <NotionPagePreview currentPage={currentNotionPage} hidePreview={hideNotionPagePreview} />} {currentFile && <FilePreview file={currentFile} hidePreview={hideFilePreview} />}
{currentWebsite && <WebsitePreview payload={currentWebsite} hidePreview={hideWebsitePreview} />} {currentNotionPage && <NotionPagePreview currentPage={currentNotionPage} hidePreview={hideNotionPagePreview} />}
{currentWebsite && <WebsitePreview payload={currentWebsite} hidePreview={hideWebsitePreview} />}
</div>
</div> </div>
) )
} }

@ -577,7 +577,7 @@ const StepTwo = ({
const isHoveringEconomy = useHover(economyDomRef) const isHoveringEconomy = useHover(economyDomRef)
return ( return (
<div className='flex w-full max-h-full h-full'> <div className='flex w-full h-full'>
<div className={cn('relative h-full w-1/2 py-6 overflow-y-auto', isMobile ? 'px-4' : 'px-12')}> <div className={cn('relative h-full w-1/2 py-6 overflow-y-auto', isMobile ? 'px-4' : 'px-12')}>
<div className={'system-md-semibold mb-1'}>{t('datasetCreation.stepTwo.segmentation')}</div> <div className={'system-md-semibold mb-1'}>{t('datasetCreation.stepTwo.segmentation')}</div>
{(!datasetId || [ChuckingMode.text, ChuckingMode.qa].includes(currentDataset!.doc_form)) {(!datasetId || [ChuckingMode.text, ChuckingMode.qa].includes(currentDataset!.doc_form))
@ -986,9 +986,9 @@ const StepTwo = ({
<FloatRightContainer isMobile={isMobile} isOpen={true} onClose={() => { }} footer={null}> <FloatRightContainer isMobile={isMobile} isOpen={true} onClose={() => { }} footer={null}>
<PreviewContainer <PreviewContainer
header={<PreviewHeader header={<PreviewHeader
title='Preview' title={t('datasetCreation.stepTwo.preview')}
> >
<div className='flex items-center gap-2'> <div className='flex items-center gap-1'>
{dataSourceType === DataSourceType.FILE {dataSourceType === DataSourceType.FILE
&& <PreviewDocumentPicker && <PreviewDocumentPicker
files={files as Array<Required<CustomFile>>} files={files as Array<Required<CustomFile>>}
@ -1052,7 +1052,7 @@ const StepTwo = ({
}) as string} /> }) as string} />
</div> </div>
</PreviewHeader>} </PreviewHeader>}
className={cn('flex shrink-0 w-1/2 relative h-full overflow-y-scroll', isMobile && 'w-full max-w-[524px]')} className={cn('flex shrink-0 w-1/2 p-4 pr-0 relative h-full', isMobile && 'w-full max-w-[524px]')}
mainClassName='space-y-6' mainClassName='space-y-6'
> >
{docForm === ChuckingMode.qa && estimate?.qa_preview && ( {docForm === ChuckingMode.qa && estimate?.qa_preview && (

@ -18,7 +18,7 @@ const STEP_T_MAP: Record<number, string> = {
export const Topbar: FC<TopbarProps> = (props) => { export const Topbar: FC<TopbarProps> = (props) => {
const { className, ...rest } = props const { className, ...rest } = props
const { t } = useTranslation() const { t } = useTranslation()
return <div className={classNames('flex h-[52px] items-center justify-between relative border-b border-b-divider-subtle', className)}> return <div className={classNames('flex shrink-0 h-[52px] items-center justify-between relative border-b border-b-divider-subtle', className)}>
<Link href={'/datasets'} className="h-12 pl-2 pr-6 py-2 justify-start items-center gap-1 inline-flex"> <Link href={'/datasets'} className="h-12 pl-2 pr-6 py-2 justify-start items-center gap-1 inline-flex">
<div className='p-2'> <div className='p-2'>
<RiArrowLeftLine className='size-4 text-text-primary' /> <RiArrowLeftLine className='size-4 text-text-primary' />

@ -18,7 +18,7 @@ const WebsitePreview = ({
const { t } = useTranslation() const { t } = useTranslation()
return ( return (
<div className={cn(s.filePreview)}> <div className={cn(s.filePreview, 'h-full')}>
<div className={cn(s.previewHeader)}> <div className={cn(s.previewHeader)}>
<div className={cn(s.title)}> <div className={cn(s.title)}>
<span>{t('datasetCreation.stepOne.pagePreview')}</span> <span>{t('datasetCreation.stepOne.pagePreview')}</span>

@ -9,20 +9,21 @@ export type PreviewContainerProps = ComponentProps<'div'> & {
export const PreviewContainer: FC<PreviewContainerProps> = forwardRef((props, ref) => { export const PreviewContainer: FC<PreviewContainerProps> = forwardRef((props, ref) => {
const { children, className, header, mainClassName, ...rest } = props const { children, className, header, mainClassName, ...rest } = props
return <div return <div className={className}>
{...rest} <div
ref={ref} {...rest}
className={classNames( ref={ref}
'flex flex-col rounded-xl border-t-[0.5px] border-l-[0.5px] border-components-panel-border bg-background-default-lighter shadow shadow-shadow-shadow-5', className={classNames(
className, 'flex flex-col w-full h-full overflow-y-auto rounded-l-xl border-t-[0.5px] border-l-[0.5px] border-components-panel-border bg-background-default-lighter shadow shadow-shadow-shadow-5',
)} )}
> >
<header className='py-4 pl-5 pr-3 border-b border-divider-subtle'> <header className='pl-5 pt-4 pr-4 pb-3 border-b border-divider-subtle'>
{header} {header}
</header> </header>
<main className={classNames('py-5 px-6 w-full h-full', mainClassName)}> <main className={classNames('py-5 px-6 w-full', mainClassName)}>
{children} {children}
</main> </main>
</div>
</div> </div>
}) })
PreviewContainer.displayName = 'PreviewContainer' PreviewContainer.displayName = 'PreviewContainer'

@ -14,7 +14,7 @@ export const PreviewHeader: FC<PreviewHeaderProps> = (props) => {
)} )}
> >
<div <div
className='text-text-accent text-2xs font-semibold leading-3 uppercase' className='text-text-accent system-2xs-semibold-uppercase uppercase px-1 mb-1'
> >
{title} {title}
</div> </div>

@ -122,7 +122,7 @@ const translation = {
removeExtraSpaces: 'Replace consecutive spaces, newlines and tabs', removeExtraSpaces: 'Replace consecutive spaces, newlines and tabs',
removeUrlEmails: 'Delete all URLs and email addresses', removeUrlEmails: 'Delete all URLs and email addresses',
removeStopwords: 'Remove stopwords such as "a", "an", "the"', removeStopwords: 'Remove stopwords such as "a", "an", "the"',
preview: 'Confirm & Preview', preview: 'Preview',
previewChunk: 'Preview Chunk', previewChunk: 'Preview Chunk',
reset: 'Reset', reset: 'Reset',
indexMode: 'Index mode', indexMode: 'Index mode',

@ -122,7 +122,7 @@ const translation = {
removeExtraSpaces: '替换掉连续的空格、换行符和制表符', removeExtraSpaces: '替换掉连续的空格、换行符和制表符',
removeUrlEmails: '删除所有 URL 和电子邮件地址', removeUrlEmails: '删除所有 URL 和电子邮件地址',
removeStopwords: '去除停用词,例如 “a”“an”“the” 等', removeStopwords: '去除停用词,例如 “a”“an”“the” 等',
preview: '确认并预览', preview: '预览',
previewChunk: '预览块', previewChunk: '预览块',
reset: '重置', reset: '重置',
indexMode: '索引方式', indexMode: '索引方式',

@ -100,7 +100,7 @@ const translation = {
removeExtraSpaces: '替換掉連續的空格、換行符和製表符', removeExtraSpaces: '替換掉連續的空格、換行符和製表符',
removeUrlEmails: '刪除所有 URL 和電子郵件地址', removeUrlEmails: '刪除所有 URL 和電子郵件地址',
removeStopwords: '去除停用詞,例如 “a”“an”“the” 等', removeStopwords: '去除停用詞,例如 “a”“an”“the” 等',
preview: '確認並預覽', preview: '預覽',
reset: '重置', reset: '重置',
indexMode: '索引方式', indexMode: '索引方式',
qualified: '高質量', qualified: '高質量',

Loading…
Cancel
Save