|
|
|
@ -63,7 +63,7 @@ import CustomDialog from '@/app/components/base/dialog'
|
|
|
|
import { PortalToFollowElem, PortalToFollowElemContent, PortalToFollowElemTrigger } from '@/app/components/base/portal-to-follow-elem'
|
|
|
|
import { PortalToFollowElem, PortalToFollowElemContent, PortalToFollowElemTrigger } from '@/app/components/base/portal-to-follow-elem'
|
|
|
|
|
|
|
|
|
|
|
|
const TextLabel: FC<PropsWithChildren> = (props) => {
|
|
|
|
const TextLabel: FC<PropsWithChildren> = (props) => {
|
|
|
|
return <label className='text-text-secondary text-xs font-semibold leading-none'>{props.children}</label>
|
|
|
|
return <label className='text-text-secondary system-sm-semibold'>{props.children}</label>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type StepTwoProps = {
|
|
|
|
type StepTwoProps = {
|
|
|
|
@ -578,14 +578,12 @@ const StepTwo = ({
|
|
|
|
const isHoveringEconomy = useHover(economyDomRef)
|
|
|
|
const isHoveringEconomy = useHover(economyDomRef)
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className='flex w-full max-h-full h-full overflow-y-auto'>
|
|
|
|
<div className='flex w-full max-h-full h-full'>
|
|
|
|
<div className='relative h-full w-full overflow-y-scroll'>
|
|
|
|
<div className={cn('relative h-full w-1/2 py-6 overflow-y-auto', isMobile ? 'px-4' : 'px-12')}>
|
|
|
|
<div className={cn(s.form, isMobile && '!px-4')}>
|
|
|
|
<div className={'system-md-semibold mb-1'}>{t('datasetCreation.stepTwo.segmentation')}</div>
|
|
|
|
<div className={s.label}>{t('datasetCreation.stepTwo.segmentation')}</div>
|
|
|
|
|
|
|
|
<div className='max-w-[640px]'>
|
|
|
|
|
|
|
|
<div className='space-y-4'>
|
|
|
|
|
|
|
|
{(!datasetId || [ChuckingMode.text, ChuckingMode.qa].includes(currentDataset!.doc_form))
|
|
|
|
{(!datasetId || [ChuckingMode.text, ChuckingMode.qa].includes(currentDataset!.doc_form))
|
|
|
|
&& <OptionCard
|
|
|
|
&& <OptionCard
|
|
|
|
|
|
|
|
className='bg-background-section mb-2'
|
|
|
|
title={t('datasetCreation.stepTwo.general')}
|
|
|
|
title={t('datasetCreation.stepTwo.general')}
|
|
|
|
icon={<Image src={SettingCog} alt={t('datasetCreation.stepTwo.general')} />}
|
|
|
|
icon={<Image src={SettingCog} alt={t('datasetCreation.stepTwo.general')} />}
|
|
|
|
activeHeaderClassName='bg-dataset-option-card-blue-gradient'
|
|
|
|
activeHeaderClassName='bg-dataset-option-card-blue-gradient'
|
|
|
|
@ -611,7 +609,7 @@ const StepTwo = ({
|
|
|
|
}
|
|
|
|
}
|
|
|
|
noHighlight={Boolean(datasetId)}
|
|
|
|
noHighlight={Boolean(datasetId)}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<div className='space-y-4'>
|
|
|
|
<div className='flex flex-col gap-y-4'>
|
|
|
|
<div className='flex gap-3'>
|
|
|
|
<div className='flex gap-3'>
|
|
|
|
<DelimiterInput
|
|
|
|
<DelimiterInput
|
|
|
|
value={segmentIdentifier}
|
|
|
|
value={segmentIdentifier}
|
|
|
|
@ -627,10 +625,14 @@ const StepTwo = ({
|
|
|
|
onChange={setOverlap}
|
|
|
|
onChange={setOverlap}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className='space-y-2'>
|
|
|
|
|
|
|
|
<div className='w-full flex flex-col'>
|
|
|
|
<div className='w-full flex flex-col'>
|
|
|
|
|
|
|
|
<div className='flex items-center gap-x-2'>
|
|
|
|
|
|
|
|
<div className='inline-flex shrink-0'>
|
|
|
|
<TextLabel>{t('datasetCreation.stepTwo.rules')}</TextLabel>
|
|
|
|
<TextLabel>{t('datasetCreation.stepTwo.rules')}</TextLabel>
|
|
|
|
<div className='mt-4 space-y-2'>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<Divider className='grow' bgStyle='gradient'/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className='mt-1'>
|
|
|
|
{rules.map(rule => (
|
|
|
|
{rules.map(rule => (
|
|
|
|
<div key={rule.id} className={s.ruleItem} onClick={() => {
|
|
|
|
<div key={rule.id} className={s.ruleItem} onClick={() => {
|
|
|
|
ruleChangeHandle(rule.id)
|
|
|
|
ruleChangeHandle(rule.id)
|
|
|
|
@ -638,12 +640,9 @@ const StepTwo = ({
|
|
|
|
<Checkbox
|
|
|
|
<Checkbox
|
|
|
|
checked={rule.enabled}
|
|
|
|
checked={rule.enabled}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<label className="ml-2 text-sm font-normal cursor-pointer text-text-secondary">{getRuleName(rule.id)}</label>
|
|
|
|
<label className="ml-2 system-sm-regular cursor-pointer text-text-secondary">{getRuleName(rule.id)}</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{IS_CE_EDITION && <>
|
|
|
|
{IS_CE_EDITION && <>
|
|
|
|
<div className='flex items-center'>
|
|
|
|
<div className='flex items-center'>
|
|
|
|
<Checkbox
|
|
|
|
<Checkbox
|
|
|
|
@ -654,12 +653,11 @@ const StepTwo = ({
|
|
|
|
else
|
|
|
|
else
|
|
|
|
handleChangeDocform(ChuckingMode.qa)
|
|
|
|
handleChangeDocform(ChuckingMode.qa)
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
className='mr-2'
|
|
|
|
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<div className='flex items-center gap-1'>
|
|
|
|
<div className='flex items-center gap-1'>
|
|
|
|
<TextLabel>
|
|
|
|
<label className="ml-2 system-sm-regular cursor-pointer text-text-secondary">
|
|
|
|
{t('datasetCreation.stepTwo.QALanguage')}
|
|
|
|
{t('datasetCreation.stepTwo.QALanguage')}
|
|
|
|
</TextLabel>
|
|
|
|
</label>
|
|
|
|
<div className='z-50 relative'>
|
|
|
|
<div className='z-50 relative'>
|
|
|
|
<LanguageSelect
|
|
|
|
<LanguageSelect
|
|
|
|
currentLanguage={docLanguage || locale}
|
|
|
|
currentLanguage={docLanguage || locale}
|
|
|
|
@ -675,16 +673,18 @@ const StepTwo = ({
|
|
|
|
style={{
|
|
|
|
style={{
|
|
|
|
background: 'linear-gradient(92deg, rgba(247, 144, 9, 0.1) 0%, rgba(255, 255, 255, 0.00) 100%)',
|
|
|
|
background: 'linear-gradient(92deg, rgba(247, 144, 9, 0.1) 0%, rgba(255, 255, 255, 0.00) 100%)',
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
className='h-10 flex items-center gap-2 rounded-xl border-components-panel-border border shadow-shadow-shadow-3 px-3 text-xs'
|
|
|
|
className='h-10 mt-2 flex items-center gap-2 rounded-xl backdrop-blur-[5px] border-components-panel-border border shadow-xs px-3 text-xs'
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<RiAlertFill className='size-4 text-text-warning-secondary' />
|
|
|
|
<RiAlertFill className='size-4 text-text-warning-secondary' />
|
|
|
|
<span className='text-sm font-medium text-text-primary'>
|
|
|
|
<span className='system-xs-medium text-text-primary'>
|
|
|
|
{t('datasetCreation.stepTwo.QATip')}
|
|
|
|
{t('datasetCreation.stepTwo.QATip')}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
</>}
|
|
|
|
</>}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</OptionCard>}
|
|
|
|
</OptionCard>}
|
|
|
|
{
|
|
|
|
{
|
|
|
|
(!datasetId || currentDataset!.doc_form === ChuckingMode.parentChild)
|
|
|
|
(!datasetId || currentDataset!.doc_form === ChuckingMode.parentChild)
|
|
|
|
@ -813,17 +813,15 @@ const StepTwo = ({
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</OptionCard>}
|
|
|
|
</OptionCard>}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<Divider className='my-5' />
|
|
|
|
<Divider className='my-5' />
|
|
|
|
<div className={s.label}>{t('datasetCreation.stepTwo.indexMode')}</div>
|
|
|
|
<div className={'system-md-semibold mb-1'}>{t('datasetCreation.stepTwo.indexMode')}</div>
|
|
|
|
<div className='max-w-[640px]'>
|
|
|
|
<div className='flex items-center gap-2 flex-wrap sm:flex-nowrap'>
|
|
|
|
<div className='flex items-center gap-3 flex-wrap sm:flex-nowrap'>
|
|
|
|
|
|
|
|
{(!hasSetIndexType || (hasSetIndexType && indexingType === IndexingType.QUALIFIED)) && (
|
|
|
|
{(!hasSetIndexType || (hasSetIndexType && indexingType === IndexingType.QUALIFIED)) && (
|
|
|
|
<OptionCard
|
|
|
|
<OptionCard
|
|
|
|
title={<p className='flex items-center'>
|
|
|
|
title={<p className='flex items-center'>
|
|
|
|
{t('datasetCreation.stepTwo.qualified')}
|
|
|
|
{t('datasetCreation.stepTwo.qualified')}
|
|
|
|
{!hasSetIndexType && <Badge className='ml-1' uppercase>{t('datasetCreation.stepTwo.recommend')}</Badge>}
|
|
|
|
{!hasSetIndexType
|
|
|
|
|
|
|
|
&& <Badge className={cn('ml-1', (!hasSetIndexType && indexType === IndexingType.QUALIFIED) ? 'border-text-accent-secondary text-text-accent-secondary' : '')} uppercase>{t('datasetCreation.stepTwo.recommend')}</Badge>}
|
|
|
|
<span className='ml-auto'>
|
|
|
|
<span className='ml-auto'>
|
|
|
|
{!hasSetIndexType && <span className={cn(s.radio)} />}
|
|
|
|
{!hasSetIndexType && <span className={cn(s.radio)} />}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
@ -905,8 +903,8 @@ const StepTwo = ({
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
{/* Embedding model */}
|
|
|
|
{/* Embedding model */}
|
|
|
|
{indexType === IndexingType.QUALIFIED && (
|
|
|
|
{indexType === IndexingType.QUALIFIED && (
|
|
|
|
<div className='mt-6 my-2'>
|
|
|
|
<div className='mt-5'>
|
|
|
|
<div className={cn(s.label, datasetId && 'flex justify-between items-center')}>{t('datasetSettings.form.embeddingModel')}</div>
|
|
|
|
<div className={cn('system-md-semibold mb-1', datasetId && 'flex justify-between items-center')}>{t('datasetSettings.form.embeddingModel')}</div>
|
|
|
|
<ModelSelector
|
|
|
|
<ModelSelector
|
|
|
|
readonly={!!datasetId}
|
|
|
|
readonly={!!datasetId}
|
|
|
|
defaultModel={embeddingModel}
|
|
|
|
defaultModel={embeddingModel}
|
|
|
|
@ -928,21 +926,21 @@ const StepTwo = ({
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
{!datasetId
|
|
|
|
{!datasetId
|
|
|
|
? (
|
|
|
|
? (
|
|
|
|
<div className={s.label}>
|
|
|
|
<div className={'mb-1'}>
|
|
|
|
<div className='shrink-0 mr-4'>{t('datasetSettings.form.retrievalSetting.title')}</div>
|
|
|
|
<div className='system-md-semibold mb-0.5'>{t('datasetSettings.form.retrievalSetting.title')}</div>
|
|
|
|
<div className='leading-[18px] text-xs font-normal text-gray-500'>
|
|
|
|
<div className='body-xs-regular text-text-tertiary'>
|
|
|
|
<a target='_blank' rel='noopener noreferrer' href='https://docs.dify.ai/guides/knowledge-base/create-knowledge-and-upload-documents#id-4-retrieval-settings' className='text-text-accent'>{t('datasetSettings.form.retrievalSetting.learnMore')}</a>
|
|
|
|
<a target='_blank' rel='noopener noreferrer' href='https://docs.dify.ai/guides/knowledge-base/create-knowledge-and-upload-documents#id-4-retrieval-settings' className='text-text-accent'>{t('datasetSettings.form.retrievalSetting.learnMore')}</a>
|
|
|
|
{t('datasetSettings.form.retrievalSetting.longDescription')}
|
|
|
|
{t('datasetSettings.form.retrievalSetting.longDescription')}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
: (
|
|
|
|
: (
|
|
|
|
<div className={cn(s.label, 'flex justify-between items-center')}>
|
|
|
|
<div className={cn('system-md-semibold mb-0.5', 'flex justify-between items-center')}>
|
|
|
|
<div>{t('datasetSettings.form.retrievalSetting.title')}</div>
|
|
|
|
<div>{t('datasetSettings.form.retrievalSetting.title')}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
<div className='max-w-[640px]'>
|
|
|
|
<div className=''>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
getIndexing_technique() === IndexingType.QUALIFIED
|
|
|
|
getIndexing_technique() === IndexingType.QUALIFIED
|
|
|
|
? (
|
|
|
|
? (
|
|
|
|
@ -978,8 +976,6 @@ const StepTwo = ({
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<FloatRightContainer isMobile={isMobile} isOpen={true} onClose={() => { }} footer={null}>
|
|
|
|
<FloatRightContainer isMobile={isMobile} isOpen={true} onClose={() => { }} footer={null}>
|
|
|
|
<PreviewContainer
|
|
|
|
<PreviewContainer
|
|
|
|
header={<PreviewHeader
|
|
|
|
header={<PreviewHeader
|
|
|
|
@ -1049,7 +1045,7 @@ const StepTwo = ({
|
|
|
|
}) as string} />
|
|
|
|
}) as string} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</PreviewHeader>}
|
|
|
|
</PreviewHeader>}
|
|
|
|
className={cn(s.previewWrap, isMobile && s.isMobile, 'relative h-full overflow-y-scroll')}
|
|
|
|
className={cn('flex shrink-0 w-1/2 relative h-full overflow-y-scroll', 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 && (
|
|
|
|
|