4.6.7-alpha commit (#743)

Co-authored-by: Archer <545436317@qq.com>
Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
Archer
2024-01-19 11:17:28 +08:00
committed by GitHub
parent 8ee7407c4c
commit c031e6dcc9
324 changed files with 8509 additions and 4757 deletions

View File

@@ -1,5 +1,5 @@
import { DatasetDataIndexItemType, DatasetSchemaType } from './type';
import { TrainingModeEnum, DatasetCollectionTypeEnum } from './constant';
import { TrainingModeEnum, DatasetCollectionTypeEnum } from './constants';
import type { LLMModelItemType } from '../ai/model.d';
/* ================= dataset ===================== */
@@ -17,27 +17,25 @@ export type DatasetUpdateBody = {
/* ================= collection ===================== */
export type DatasetCollectionChunkMetadataType = {
parentId?: string;
trainingType?: `${TrainingModeEnum}`;
chunkSize?: number;
chunkSplitter?: string;
qaPrompt?: string;
metadata?: Record<string, any>;
};
export type CreateDatasetCollectionParams = DatasetCollectionChunkMetadataType & {
datasetId: string;
parentId?: string;
name: string;
type: `${DatasetCollectionTypeEnum}`;
fileId?: string;
rawLink?: string;
rawTextLength?: number;
hashRawText?: string;
metadata?: Record<string, any>;
};
export type ApiCreateDatasetCollectionParams = DatasetCollectionChunkMetadataType & {
datasetId: string;
parentId?: string;
metadata?: Record<string, any>;
};
export type TextCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
name: string;
@@ -45,16 +43,24 @@ export type TextCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams
};
export type LinkCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
link: string;
chunkSplitter?: string;
};
export type FileCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
name: string;
rawTextLength: number;
hashRawText: string;
trainingType: `${TrainingModeEnum}`;
chunkSize: number;
chunkSplitter: string;
qaPrompt: string;
fileMetadata?: Record<string, any>;
collectionMetadata?: Record<string, any>;
};
/* ================= data ===================== */
export type PgSearchRawType = {
id: string;
team_id: string;
tmb_id: string;
collection_id: string;
data_id: string;
score: number;
};
export type PushDatasetDataChunkProps = {

View File

@@ -6,7 +6,7 @@ export enum DatasetTypeEnum {
}
export const DatasetTypeMap = {
[DatasetTypeEnum.folder]: {
icon: 'core/dataset/folderDataset',
icon: 'common/folderFill',
label: 'core.dataset.Folder Dataset',
collectionLabel: 'common.Folder'
},
@@ -104,10 +104,12 @@ export enum TrainingModeEnum {
export const TrainingTypeMap = {
[TrainingModeEnum.chunk]: {
label: 'core.dataset.training.type chunk'
label: 'core.dataset.training.Chunk mode',
tooltip: 'core.dataset.import.Chunk Split Tip'
},
[TrainingModeEnum.qa]: {
label: 'core.dataset.training.type qa'
label: 'core.dataset.training.QA mode',
tooltip: 'core.dataset.import.QA Import Tip'
}
};
@@ -168,4 +170,8 @@ export const SearchScoreTypeMap = {
}
};
export const FolderAvatarSrc = '/imgs/files/folder.svg';
export const FolderIcon = 'file/fill/folder';
export const FolderImgUrl = '/imgs/files/folder.svg';
export const CustomCollectionIcon = 'common/linkBlue';
export const LinkCollectionIcon = 'common/linkBlue';

View File

@@ -8,7 +8,7 @@ import {
DatasetTypeEnum,
SearchScoreTypeEnum,
TrainingModeEnum
} from './constant';
} from './constants';
/* schema */
export type DatasetSchemaType = {
@@ -55,6 +55,8 @@ export type DatasetCollectionSchemaType = {
hashRawText?: string;
metadata?: {
webPageSelector?: string;
relatedImgId?: string; // The id of the associated image collections
[key: string]: any;
};
};

View File

@@ -1,4 +1,4 @@
import { TrainingModeEnum, DatasetCollectionTypeEnum, DatasetDataIndexTypeEnum } from './constant';
import { TrainingModeEnum, DatasetCollectionTypeEnum, DatasetDataIndexTypeEnum } from './constants';
import { getFileIcon } from '../../common/file/icon';
import { strIsLink } from '../../common/string/tools';
@@ -7,18 +7,13 @@ export function getCollectionIcon(
name = ''
) {
if (type === DatasetCollectionTypeEnum.folder) {
return '/imgs/files/folder.svg';
return 'common/folderFill';
}
if (type === DatasetCollectionTypeEnum.link) {
return '/imgs/files/link.svg';
return 'common/linkBlue';
}
if (type === DatasetCollectionTypeEnum.virtual) {
if (name === '手动录入') {
return '/imgs/files/manual.svg';
} else if (name === '手动标注') {
return '/imgs/files/mark.svg';
}
return '/imgs/files/collection.svg';
return 'file/fill/manual';
}
return getFileIcon(name);
}
@@ -30,19 +25,14 @@ export function getSourceNameIcon({
sourceId?: string;
}) {
if (strIsLink(sourceId)) {
return '/imgs/files/link.svg';
return 'common/linkBlue';
}
const fileIcon = getFileIcon(sourceName, '');
if (fileIcon) {
return fileIcon;
}
if (sourceName === '手动录入') {
return '/imgs/files/manual.svg';
} else if (sourceName === '手动标注') {
return '/imgs/files/mark.svg';
}
return '/imgs/files/collection.svg';
return 'file/fill/manual';
}
export function getDefaultIndex(props?: { q?: string; a?: string; dataId?: string }) {