Skip to content

New pic #4858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
May 30, 2025
Merged

New pic #4858

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
23eb075
更新数据集相关类型,添加图像文件ID和预览URL支持;优化数据集导入功能,新增图像数据集处理组件;修复部分国际化文本;更新文件上传逻辑以支…
ctrlz526 May 19, 2025
558079c
与原先代码的差别
ctrlz526 May 19, 2025
78f0908
新增 V4.9.10 更新说明,支持 PG 设置`systemEnv.hnswMaxScanTuples`参数,优化 LLM stream…
c121914yu May 19, 2025
7919199
更换成fileId_image逻辑,并增加训练队列匹配的逻辑
ctrlz526 May 21, 2025
fe90ca0
新增图片集合判断逻辑,优化预览URL生成流程,确保仅在数据集为图片集合时生成预览URL,并添加相关日志输出以便调试。
ctrlz526 May 21, 2025
eaa88a2
Refactor Docker Compose configuration to comment out exposed ports fo…
ctrlz526 May 22, 2025
6b141d7
Enhance TrainingStates component by adding internationalization suppo…
ctrlz526 May 22, 2025
8b413f8
Enhance dataset import context by adding additional steps for image d…
ctrlz526 May 22, 2025
aa4b794
Update DatasetImportContext to conditionally render MyStep component …
ctrlz526 May 22, 2025
5c5eb6a
Refactor image dataset handling by improving internationalization str…
ctrlz526 May 22, 2025
1f0c7a2
图片上传到新建的 dataset_collection_images 表,逻辑跟随更改
ctrlz526 May 26, 2025
d257c24
修改了除了controller的其他部分问题
ctrlz526 May 27, 2025
5217cb4
把图片数据集的逻辑整合到controller里面
ctrlz526 May 27, 2025
f71cd52
补充i18n
ctrlz526 May 27, 2025
688c7bb
补充i18n
ctrlz526 May 27, 2025
7c655b6
resolve评论:主要是上传逻辑的更改和组件复用
ctrlz526 May 28, 2025
a317a1e
图片名称的图标显示
ctrlz526 May 28, 2025
641d49e
修改编译报错的命名问题
ctrlz526 May 28, 2025
9c7e7a2
删除不需要的collectionid部分
ctrlz526 May 28, 2025
dc6c2ac
多余文件的处理和改动一个删除按钮
ctrlz526 May 28, 2025
e2e7b7b
除了loading和统一的imageId,其他都resolve掉的
ctrlz526 May 29, 2025
69459cb
处理图标报错
ctrlz526 May 29, 2025
7eb2b19
复用了MyPhotoView并采用全部替换的方式将imageFileId变成imageId
ctrlz526 May 29, 2025
6ee6897
去除不必要文件修改
ctrlz526 May 29, 2025
869ba22
报错和字段修改
ctrlz526 May 29, 2025
6c811ce
增加上传成功后删除临时文件的逻辑以及回退一些修改
ctrlz526 May 29, 2025
8148348
删除path字段,将图片保存到gridfs内,并修改增删等操作的代码
ctrlz526 May 30, 2025
6f16b0b
修正编译错误
ctrlz526 May 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/global/common/file/icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export const fileImgs = [
{ suffix: '(doc|docs)', src: 'file/fill/doc' },
{ suffix: 'txt', src: 'file/fill/txt' },
{ suffix: 'md', src: 'file/fill/markdown' },
{ suffix: 'html', src: 'file/fill/html' }
{ suffix: 'html', src: 'file/fill/html' },
{ suffix: '(jpg|jpeg|png|gif|bmp|webp|svg|ico|tiff|tif)', src: 'image' }

// { suffix: '.', src: '/imgs/files/file.svg' }
];
Expand Down
3 changes: 3 additions & 0 deletions packages/global/core/dataset/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export type CreateDatasetCollectionParams = DatasetCollectionStoreDataType & {
hashRawText?: string;

tags?: string[];
imageIdList?: string[];

createTime?: Date;
updateTime?: Date;
Expand Down Expand Up @@ -127,6 +128,7 @@ export type PgSearchRawType = {
export type PushDatasetDataChunkProps = {
q: string; // embedding content
a?: string; // bonus content
imageId?: string; //file id preview
chunkIndex?: number;
indexes?: Omit<DatasetDataIndexItemType, 'dataId'>[];
};
Expand All @@ -151,4 +153,5 @@ export type PushDatasetDataProps = {
};
export type PushDatasetDataResponse = {
insertLen: number;
message?: string;
};
17 changes: 14 additions & 3 deletions packages/global/core/dataset/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export enum DatasetCollectionTypeEnum {
file = 'file',
link = 'link', // one link
externalFile = 'externalFile',
apiFile = 'apiFile'
apiFile = 'apiFile',
images = 'images'
}
export const DatasetCollectionTypeMap = {
[DatasetCollectionTypeEnum.folder]: {
Expand All @@ -97,6 +98,9 @@ export const DatasetCollectionTypeMap = {
},
[DatasetCollectionTypeEnum.apiFile]: {
name: i18nT('common:core.dataset.apiFile')
},
[DatasetCollectionTypeEnum.images]: {
name: i18nT('dataset:core.dataset.Image collection')
}
};

Expand All @@ -120,6 +124,7 @@ export const DatasetCollectionSyncResultMap = {
export enum DatasetCollectionDataProcessModeEnum {
chunk = 'chunk',
qa = 'qa',
imageParse = 'imageParse',
backup = 'backup',

auto = 'auto' // abandon
Expand All @@ -133,6 +138,10 @@ export const DatasetCollectionDataProcessModeMap = {
label: i18nT('common:core.dataset.training.QA mode'),
tooltip: i18nT('common:core.dataset.import.QA Import Tip')
},
[DatasetCollectionDataProcessModeEnum.imageParse]: {
label: i18nT('dataset:training.Image mode'),
tooltip: i18nT('common:core.dataset.import.Chunk Split Tip')
},
[DatasetCollectionDataProcessModeEnum.backup]: {
label: i18nT('dataset:backup_mode'),
tooltip: i18nT('dataset:backup_mode')
Expand Down Expand Up @@ -172,14 +181,16 @@ export enum ImportDataSourceEnum {
fileCustom = 'fileCustom',
externalFile = 'externalFile',
apiDataset = 'apiDataset',
reTraining = 'reTraining'
reTraining = 'reTraining',
imageDataset = 'imageDataset'
}

export enum TrainingModeEnum {
chunk = 'chunk',
qa = 'qa',
auto = 'auto',
image = 'image'
image = 'image',
imageParse = 'imageParse'
}

/* ------------ search -------------- */
Expand Down
2 changes: 2 additions & 0 deletions packages/global/core/dataset/controller.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type CreateDatasetDataProps = {
chunkIndex?: number;
q: string;
a?: string;
imageId?: string;
indexes?: Omit<DatasetDataIndexItemType, 'dataId'>[];
};

Expand All @@ -19,6 +20,7 @@ export type UpdateDatasetDataProps = {
indexes?: (Omit<DatasetDataIndexItemType, 'dataId'> & {
dataId?: string; // pg data id
})[];
imageId?: string;
};

export type PatchIndexesProps =
Expand Down
19 changes: 19 additions & 0 deletions packages/global/core/dataset/image/type.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export type DatasetImageSchema = {
_id: string;
teamId: string;
datasetId: string;
collectionId?: string;
name: string;
contentType: string;
size: number;
metadata?: Record<string, any>;
expiredTime?: Date;
createdAt: Date;
updatedAt: Date;
};

// API请求参数类型
export type UploadDatasetImageProps = {
datasetId: string;
collectionId?: string;
};
4 changes: 3 additions & 1 deletion packages/global/core/dataset/type.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export type DatasetDataSchemaType = {
updateTime: Date;
q: string; // large chunks or question
a: string; // answer or custom content
imageId?: string;
history?: {
q: string;
a: string;
Expand Down Expand Up @@ -179,6 +180,7 @@ export type DatasetTrainingSchemaType = {
dataId?: string;
q: string;
a: string;
imageId?: string;
chunkIndex: number;
indexSize?: number;
weight: number;
Expand Down Expand Up @@ -254,10 +256,10 @@ export type DatasetDataItemType = {
sourceId?: string;
q: string;
a: string;
imageId?: string;
chunkIndex: number;
indexes: DatasetDataIndexItemType[];
isOwner: boolean;
// permission: DatasetPermission;
};

/* --------------- file ---------------------- */
Expand Down
9 changes: 8 additions & 1 deletion packages/global/core/dataset/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { TrainingModeEnum, DatasetCollectionTypeEnum } from './constants';
import {
TrainingModeEnum,
DatasetCollectionTypeEnum,
DatasetCollectionDataProcessModeEnum
} from './constants';
import { getFileIcon } from '../../common/file/icon';
import { strIsLink } from '../../common/string/tools';

Expand All @@ -15,6 +19,9 @@ export function getCollectionIcon(
if (type === DatasetCollectionTypeEnum.virtual) {
return 'file/fill/manual';
}
if (type === DatasetCollectionTypeEnum.images) {
return 'image';
}
return getFileIcon(name);
}
export function getSourceNameIcon({
Expand Down
4 changes: 4 additions & 0 deletions packages/service/core/ai/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export const getVlmModel = (model?: string) => {
?.find((item) => item.model === model || item.name === model);
};

export const getVlmModelList = () => {
return Array.from(global.llmModelMap.values())?.filter((item) => item.vision) || [];
};

export const getDefaultEmbeddingModel = () => global?.systemDefaultModel.embedding!;
export const getEmbeddingModel = (model?: string) => {
if (!model) return getDefaultEmbeddingModel();
Expand Down
Loading