mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-14 15:11:13 +00:00

* add dynamic inputRender (#5127) * dynamic input component * fix * fix * fix * perf: dynamic render input * update doc * perf: error catch * num input ui * fix form render (#5177) * perf: i18n check * add log * doc * Sync dataset (#5181) * perf: api dataset create (#5047) * Sync dataset (#5120) * add * wait * restructure dataset sync, update types and APIs, add sync hints, and remove legacy logic * feat: add function to retrieve real file ID from third-party doc library and rename team permission check function for clarity * fix come console * refactor: rename team dataset limit check functions for clarity, update API dataset sync limit usage, and rename root directory to "ROOT_FOLDER" * frat: update sync dataset login * fix delete.ts * feat: update pnpm-lock.yaml to include bullmq, fix comments in api.d.ts and type.d.ts, rename API file ID field, optimize dataset sync logic, and add website sync feature with related APIs * feat: update CollectionCard to support site dataset sync, add API root ID constant and init sync API * feat: add RootCollectionId constant to replace hardcoded root ID --------- Co-authored-by: dreamer6680 <146868355@qq.com> * perf: code * feat: update success message for dataset sync, revise related i18n texts, and optimize file selection logic (#5166) Co-authored-by: dreamer6680 <146868355@qq.com> * perf: select file * Sync dataset (#5180) * feat: update success message for dataset sync, revise related i18n texts, and optimize file selection logic * fix: make listfile function return rawid string --------- Co-authored-by: dreamer6680 <146868355@qq.com> * init sh * fix: ts --------- Co-authored-by: dreamer6680 <1468683855@qq.com> Co-authored-by: dreamer6680 <146868355@qq.com> * update doc * i18n --------- Co-authored-by: heheer <heheer@sealos.io> Co-authored-by: dreamer6680 <1468683855@qq.com> Co-authored-by: dreamer6680 <146868355@qq.com>
167 lines
4.2 KiB
TypeScript
167 lines
4.2 KiB
TypeScript
import type {
|
|
ChunkSettingsType,
|
|
DatasetDataIndexItemType,
|
|
DatasetDataFieldType,
|
|
DatasetSchemaType
|
|
} from './type';
|
|
import type {
|
|
DatasetCollectionTypeEnum,
|
|
DatasetCollectionDataProcessModeEnum,
|
|
ChunkSettingModeEnum,
|
|
DataChunkSplitModeEnum,
|
|
ChunkTriggerConfigTypeEnum,
|
|
ParagraphChunkAIModeEnum
|
|
} from './constants';
|
|
import type { ParentIdType } from '../../common/parentFolder/type';
|
|
import type { APIFileItemType } from './apiDataset/type';
|
|
|
|
/* ================= dataset ===================== */
|
|
export type DatasetUpdateBody = {
|
|
id: string;
|
|
|
|
apiDatasetServer?: DatasetSchemaType['apiDatasetServer'];
|
|
|
|
parentId?: ParentIdType;
|
|
name?: string;
|
|
avatar?: string;
|
|
intro?: string;
|
|
|
|
agentModel?: string;
|
|
vlmModel?: string;
|
|
|
|
websiteConfig?: DatasetSchemaType['websiteConfig'];
|
|
externalReadUrl?: DatasetSchemaType['externalReadUrl'];
|
|
defaultPermission?: DatasetSchemaType['defaultPermission'];
|
|
chunkSettings?: DatasetSchemaType['chunkSettings'];
|
|
|
|
// sync schedule
|
|
autoSync?: boolean;
|
|
};
|
|
|
|
/* ================= collection ===================== */
|
|
// Input + store params
|
|
type DatasetCollectionStoreDataType = ChunkSettingsType & {
|
|
parentId?: string;
|
|
metadata?: Record<string, any>;
|
|
|
|
customPdfParse?: boolean;
|
|
};
|
|
|
|
// create collection params
|
|
export type CreateDatasetCollectionParams = DatasetCollectionStoreDataType & {
|
|
datasetId: string;
|
|
name: string;
|
|
type: DatasetCollectionTypeEnum;
|
|
|
|
fileId?: string;
|
|
rawLink?: string;
|
|
externalFileId?: string;
|
|
externalFileUrl?: string;
|
|
apiFileId?: string;
|
|
apiFileParentId?: string; //when file is imported by folder, the parentId is the folderId
|
|
|
|
rawTextLength?: number;
|
|
hashRawText?: string;
|
|
|
|
tags?: string[];
|
|
|
|
createTime?: Date;
|
|
updateTime?: Date;
|
|
};
|
|
|
|
export type ApiCreateDatasetCollectionParams = DatasetCollectionStoreDataType & {
|
|
datasetId: string;
|
|
tags?: string[];
|
|
};
|
|
export type TextCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
|
|
name: string;
|
|
text: string;
|
|
};
|
|
export type LinkCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
|
|
link: string;
|
|
};
|
|
export type ApiDatasetCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
|
|
name: string;
|
|
apiFileId: string;
|
|
};
|
|
export type ApiDatasetCreateDatasetCollectionV2Params = ApiCreateDatasetCollectionParams & {
|
|
apiFiles: APIFileItemType[];
|
|
};
|
|
export type FileIdCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
|
|
fileId: string;
|
|
};
|
|
export type reTrainingDatasetFileCollectionParams = DatasetCollectionStoreDataType & {
|
|
datasetId: string;
|
|
collectionId: 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;
|
|
};
|
|
export type ImageCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
|
|
collectionName: string;
|
|
};
|
|
|
|
/* ================= tag ===================== */
|
|
export type CreateDatasetCollectionTagParams = {
|
|
datasetId: string;
|
|
tag: string;
|
|
};
|
|
export type AddTagsToCollectionsParams = {
|
|
originCollectionIds: string[];
|
|
collectionIds: string[];
|
|
datasetId: string;
|
|
tag: string;
|
|
};
|
|
export type UpdateDatasetCollectionTagParams = {
|
|
datasetId: string;
|
|
tagId: string;
|
|
tag: string;
|
|
};
|
|
|
|
/* ================= data ===================== */
|
|
export type PgSearchRawType = {
|
|
id: string;
|
|
collection_id: string;
|
|
score: number;
|
|
};
|
|
export type PushDatasetDataChunkProps = {
|
|
q?: string;
|
|
a?: string;
|
|
imageId?: string;
|
|
chunkIndex?: number;
|
|
indexes?: Omit<DatasetDataIndexItemType, 'dataId'>[];
|
|
};
|
|
|
|
export type PostDatasetSyncParams = {
|
|
datasetId: string;
|
|
};
|
|
|
|
export type PushDatasetDataProps = {
|
|
collectionId: string;
|
|
data: PushDatasetDataChunkProps[];
|
|
trainingType?: DatasetCollectionDataProcessModeEnum;
|
|
indexSize?: number;
|
|
autoIndexes?: boolean;
|
|
imageIndex?: boolean;
|
|
prompt?: string;
|
|
|
|
billId?: string;
|
|
|
|
// Abandon
|
|
trainingMode?: DatasetCollectionDataProcessModeEnum;
|
|
};
|
|
export type PushDatasetDataResponse = {
|
|
insertLen: number;
|
|
};
|