mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00

* feat: dataset controllers feat: dataset schema fix: add missing type to dataset schema Signed-off-by: FinleyGe <m13203533462@163.com> * chore: use new auth method Signed-off-by: FinleyGe <m13203533462@163.com> * feat: finish the dataset permission fix: ts errors Signed-off-by: FinleyGe <m13203533462@163.com> * chore: adjust the code * chore: adjust the code * chore: dataset fe adjusting * fix: double delete confirm --------- Signed-off-by: FinleyGe <m13203533462@163.com>
106 lines
2.9 KiB
TypeScript
106 lines
2.9 KiB
TypeScript
import { DatasetDataIndexItemType, DatasetSchemaType } from './type';
|
|
import { TrainingModeEnum, DatasetCollectionTypeEnum } from './constants';
|
|
import type { LLMModelItemType } from '../ai/model.d';
|
|
import { ParentIdType } from 'common/parentFolder/type';
|
|
|
|
/* ================= dataset ===================== */
|
|
export type DatasetUpdateBody = {
|
|
id: string;
|
|
parentId?: ParentIdType;
|
|
name?: string;
|
|
avatar?: string;
|
|
intro?: string;
|
|
permission?: DatasetSchemaType['permission']; // TODO: Should be deleted.
|
|
agentModel?: LLMModelItemType;
|
|
status?: DatasetSchemaType['status'];
|
|
|
|
websiteConfig?: DatasetSchemaType['websiteConfig'];
|
|
externalReadUrl?: DatasetSchemaType['externalReadUrl'];
|
|
defaultPermission?: DatasetSchemaType['defaultPermission'];
|
|
};
|
|
|
|
/* ================= collection ===================== */
|
|
export type DatasetCollectionChunkMetadataType = {
|
|
parentId?: string;
|
|
trainingType?: TrainingModeEnum;
|
|
chunkSize?: number;
|
|
chunkSplitter?: string;
|
|
qaPrompt?: string;
|
|
metadata?: Record<string, any>;
|
|
};
|
|
|
|
// create collection params
|
|
export type CreateDatasetCollectionParams = DatasetCollectionChunkMetadataType & {
|
|
datasetId: string;
|
|
name: string;
|
|
type: DatasetCollectionTypeEnum;
|
|
|
|
tags?: string[];
|
|
|
|
fileId?: string;
|
|
rawLink?: string;
|
|
externalFileId?: string;
|
|
|
|
externalFileUrl?: string;
|
|
rawTextLength?: number;
|
|
hashRawText?: string;
|
|
};
|
|
|
|
export type ApiCreateDatasetCollectionParams = DatasetCollectionChunkMetadataType & {
|
|
datasetId: string;
|
|
tags?: string[];
|
|
};
|
|
export type TextCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
|
|
name: string;
|
|
text: string;
|
|
};
|
|
export type LinkCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
|
|
link: string;
|
|
};
|
|
export type FileIdCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
|
|
fileId: string;
|
|
};
|
|
export type FileCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
|
|
fileMetadata?: Record<string, any>;
|
|
collectionMetadata?: Record<string, any>;
|
|
};
|
|
export type CsvTableCreateDatasetCollectionParams = {
|
|
datasetId: string;
|
|
parentId?: string;
|
|
fileId: string;
|
|
};
|
|
export type ExternalFileCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
|
|
externalFileId?: string;
|
|
externalFileUrl: string;
|
|
filename?: string;
|
|
};
|
|
|
|
/* ================= data ===================== */
|
|
export type PgSearchRawType = {
|
|
id: string;
|
|
collection_id: string;
|
|
score: number;
|
|
};
|
|
export type PushDatasetDataChunkProps = {
|
|
q: string; // embedding content
|
|
a?: string; // bonus content
|
|
chunkIndex?: number;
|
|
indexes?: Omit<DatasetDataIndexItemType, 'dataId'>[];
|
|
};
|
|
|
|
export type PostWebsiteSyncParams = {
|
|
datasetId: string;
|
|
billId: string;
|
|
};
|
|
|
|
export type PushDatasetDataProps = {
|
|
collectionId: string;
|
|
data: PushDatasetDataChunkProps[];
|
|
trainingMode: TrainingModeEnum;
|
|
prompt?: string;
|
|
billId?: string;
|
|
};
|
|
export type PushDatasetDataResponse = {
|
|
insertLen: number;
|
|
};
|