Add bill of training and rate of file upload (#339)

This commit is contained in:
Archer
2023-09-21 21:02:44 +08:00
committed by GitHub
parent e7e0677291
commit 814c5b3d3c
41 changed files with 401 additions and 263 deletions

View File

@@ -10,7 +10,7 @@ import { TrainingModeEnum } from '@/constants/plugin';
import FileSelect, { type FileItemType } from './FileSelect';
import { useRouter } from 'next/router';
import { useDatasetStore } from '@/store/dataset';
import { updateDatasetFile } from '@/api/core/dataset/file';
import { putMarkFilesUsed } from '@/api/core/dataset/file';
import { chunksUpload } from '@/utils/web/core/dataset';
const fileExtension = '.csv';
@@ -39,14 +39,7 @@ const CsvImport = ({ kbId }: { kbId: string }) => {
const { mutate: onclickUpload, isLoading: uploading } = useMutation({
mutationFn: async () => {
// mark the file is used
await Promise.all(
files.map((file) =>
updateDatasetFile({
id: file.id,
datasetUsed: true
})
)
);
await putMarkFilesUsed({ fileIds: files.map((file) => file.id) });
const chunks = files
.map((file) => file.chunks)