feat: enhance file uploader and test run panel with batch upload limits and tooltips

This commit is contained in:
twwu 2025-05-28 14:51:10 +08:00
parent b9214ca76b
commit 9e763c9e87
8 changed files with 24 additions and 7 deletions

View File

@ -322,6 +322,7 @@ const FileUploader = ({
<div>{t('datasetCreation.stepOne.uploader.tip', {
size: fileUploadConfig.file_size_limit,
supportTypes: supportTypesShowNames,
batchCount: fileUploadConfig.batch_count_limit,
})}</div>
{dragging && <div ref={dragRef} className='absolute left-0 top-0 h-full w-full' />}
</div>

View File

@ -25,6 +25,7 @@ import ProcessDocuments from './process-documents'
import ChunkPreview from './preview/chunk-preview'
import Processing from './processing'
import { DatasourceType } from '@/models/pipeline'
import { TransferMethod } from '@/types/app'
const TestRunPanel = () => {
const { t } = useTranslation()
@ -137,12 +138,14 @@ const TestRunPanel = () => {
if (datasource.type === DatasourceType.localFile) {
const { id, name, type, size, extension, mime_type } = previewFile.current as File
const documentInfo = {
upload_file_id: id,
related_id: id,
name,
type,
size,
extension,
mime_type,
url: '',
transfer_method: TransferMethod.local_file,
}
datasourceInfoList.push(documentInfo)
}
@ -183,12 +186,14 @@ const TestRunPanel = () => {
fileList.forEach((file) => {
const { id, name, type, size, extension, mime_type } = file.file
const documentInfo = {
upload_file_id: id,
related_id: id,
name,
type,
size,
extension,
mime_type,
url: '',
transfer_method: TransferMethod.local_file,
}
datasourceInfoList.push(documentInfo)
})

View File

@ -274,6 +274,7 @@ const FileUploader = ({
<div>{t('datasetCreation.stepOne.uploader.tip', {
size: fileUploadConfig.file_size_limit,
supportTypes: supportTypesShowNames,
batchCount: fileUploadConfig.batch_count_limit,
})}</div>
{dragging && <div ref={dragRef} className='absolute left-0 top-0 h-full w-full' />}
</div>

View File

@ -18,6 +18,8 @@ import { useTranslation } from 'react-i18next'
import { usePipelineRun } from '../../../hooks'
import type { Datasource } from './types'
import { DatasourceType } from '@/models/pipeline'
import { TransferMethod } from '@/types/app'
import Tooltip from '@/app/components/base/tooltip'
const TestRunPanel = () => {
const { t } = useTranslation()
@ -96,12 +98,14 @@ const TestRunPanel = () => {
if (datasource.type === DatasourceType.localFile) {
const { id, name, type, size, extension, mime_type } = fileList[0].file
const documentInfo = {
upload_file_id: id,
related_id: id,
name,
type,
size,
extension,
mime_type,
url: '',
transfer_method: TransferMethod.local_file,
}
datasourceInfoList.push(documentInfo)
}
@ -140,8 +144,12 @@ const TestRunPanel = () => {
<RiCloseLine className='size-4 text-text-tertiary' />
</button>
<div className='flex flex-col gap-y-0.5 px-3 pb-2 pt-3.5'>
<div className='system-md-semibold-uppercase flex items-center justify-between pl-1 pr-8 text-text-primary'>
{t('datasetPipeline.testRun.title')}
<div className='flex items-center gap-x-1 pl-1 pr-8'>
<span className='system-md-semibold-uppercase text-text-primary'>{t('datasetPipeline.testRun.title')}</span>
<Tooltip
popupContent={t('datasetPipeline.testRun.tooltip')}
popupClassName='max-w-[240px]'
/>
</div>
<StepIndicator steps={steps} currentStep={currentStep} />
</div>

View File

@ -37,7 +37,7 @@ const translation = {
title: 'Upload file',
button: 'Drag and drop file or folder, or',
browse: 'Browse',
tip: 'Supports {{supportTypes}}. Max {{size}}MB each.',
tip: 'Supports {{supportTypes}}. Max {{batchCount}} in a batch and {{size}} MB each.',
validation: {
typeError: 'File type not supported',
size: 'File too large. Maximum is {{size}}MB',

View File

@ -49,6 +49,7 @@ const translation = {
},
testRun: {
title: 'Test Run',
tooltip: 'In Test Run mode, only one file upload at a time is allowed for easier debugging and observation.',
steps: {
dataSource: 'Data Source',
documentProcessing: 'Document Processing',

View File

@ -37,7 +37,7 @@ const translation = {
title: '上传文本文件',
button: '拖拽文件或文件夹至此,或者',
browse: '选择文件',
tip: '已支持 {{supportTypes}},每个文件不超过 {{size}}MB。',
tip: '已支持 {{supportTypes}},每批最多 {{batchCount}} 个文件,每个文件不超过 {{size}} MB。',
validation: {
typeError: '文件类型不支持',
size: '文件太大了,不能超过 {{size}}MB',

View File

@ -49,6 +49,7 @@ const translation = {
},
testRun: {
title: '测试运行',
tooltip: '在测试运行模式下,每次只能上传一个文件,便于调试和观察。',
steps: {
dataSource: '数据源',
documentProcessing: '文档处理',