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

@@ -1,3 +1,4 @@
import { postCreateTrainingBill } from '@/api/common/bill';
import { postChunks2Dataset } from '@/api/core/dataset/data';
import { TrainingModeEnum } from '@/constants/plugin';
import type { DatasetDataItemType } from '@/types/core/dataset/data';
@@ -8,7 +9,7 @@ export async function chunksUpload({
mode,
chunks,
prompt,
rate = 200,
rate = 50,
onUploading
}: {
kbId: string;
@@ -18,12 +19,16 @@ export async function chunksUpload({
rate?: number;
onUploading?: (insertLen: number, total: number) => void;
}) {
// create training bill
const billId = await postCreateTrainingBill({ name: 'dataset.Training Name' });
async function upload(data: DatasetDataItemType[]) {
return postChunks2Dataset({
kbId,
data,
mode,
prompt
prompt,
billId
});
}