merge origin/feat/parent-child-retrival

This commit is contained in:
NFish 2024-12-18 16:44:51 +08:00
parent eead099c5e
commit fa3f8c5bb0
14 changed files with 60 additions and 59 deletions

View File

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

View File

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

View File

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

View File

@ -122,11 +122,10 @@ const DatasetUpdateForm = ({ datasetId }: DatasetUpdateFormProps) => {
return <AppUnavailable code={500} unknownReason={t('datasetCreation.error.unavailable') as string} />
return (
<div className='flex flex-col' style={{ height: 'calc(100vh - 56px)' }}>
<div className="grow bg-components-panel-bg flex flex-col max-h-full h-full">
<div className='flex flex-col bg-components-panel-bg' style={{ height: 'calc(100vh - 56px)' }}>
<Topbar activeIndex={step - 1} />
<div className={step === 1 ? 'block h-full max-h-full overflow-auto' : 'hidden'}>
<StepOne
<div style={{ height: 'calc(100% - 52px)' }}>
{step === 1 && <StepOne
hasConnection={hasConnection}
onSetting={() => setShowAccountSettingModal({ payload: 'data-source' })}
datasetId={datasetId}
@ -145,8 +144,7 @@ const DatasetUpdateForm = ({ datasetId }: DatasetUpdateFormProps) => {
onWebsiteCrawlJobIdChange={setWebsiteCrawlJobId}
crawlOptions={crawlOptions}
onCrawlOptionsChange={setCrawlOptions}
/>
</div>
/>}
{(step === 2 && (!datasetId || (datasetId && !!detail))) && <StepTwo
isAPIKeySet={!!embeddingsDefaultModel}
onSetting={() => setShowAccountSettingModal({ payload: 'provider' })}

View File

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

View File

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

View File

@ -577,7 +577,7 @@ const StepTwo = ({
const isHoveringEconomy = useHover(economyDomRef)
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={'system-md-semibold mb-1'}>{t('datasetCreation.stepTwo.segmentation')}</div>
{(!datasetId || [ChuckingMode.text, ChuckingMode.qa].includes(currentDataset!.doc_form))
@ -986,9 +986,9 @@ const StepTwo = ({
<FloatRightContainer isMobile={isMobile} isOpen={true} onClose={() => { }} footer={null}>
<PreviewContainer
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
&& <PreviewDocumentPicker
files={files as Array<Required<CustomFile>>}
@ -1052,7 +1052,7 @@ const StepTwo = ({
}) as string} />
</div>
</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'
>
{docForm === ChuckingMode.qa && estimate?.qa_preview && (

View File

@ -18,7 +18,7 @@ const STEP_T_MAP: Record<number, string> = {
export const Topbar: FC<TopbarProps> = (props) => {
const { className, ...rest } = props
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">
<div className='p-2'>
<RiArrowLeftLine className='size-4 text-text-primary' />

View File

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

View File

@ -9,20 +9,21 @@ export type PreviewContainerProps = ComponentProps<'div'> & {
export const PreviewContainer: FC<PreviewContainerProps> = forwardRef((props, ref) => {
const { children, className, header, mainClassName, ...rest } = props
return <div
return <div className={className}>
<div
{...rest}
ref={ref}
className={classNames(
'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,
'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>
<main className={classNames('py-5 px-6 w-full h-full', mainClassName)}>
<main className={classNames('py-5 px-6 w-full', mainClassName)}>
{children}
</main>
</div>
</div>
})
PreviewContainer.displayName = 'PreviewContainer'

View File

@ -14,7 +14,7 @@ export const PreviewHeader: FC<PreviewHeaderProps> = (props) => {
)}
>
<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}
</div>

View File

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

View File

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

View File

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