* fix metadata and forbid filter

* team plan init

* sync collection tags

* fix json import

* fix code

* fix
This commit is contained in:
heheer
2025-06-26 10:15:51 +08:00
committed by GitHub
parent f31752ccd0
commit e1819f48ee
4 changed files with 98 additions and 79 deletions

View File

@@ -37,6 +37,7 @@ import {
} from '@fastgpt/global/core/dataset/training/utils';
import { DatasetDataIndexTypeEnum } from '@fastgpt/global/core/dataset/data/constants';
import { clearCollectionImages, removeDatasetImageExpiredTime } from '../image/utils';
import { MongoDatasetCollectionTags } from '../tag/schema';
export const createCollectionAndInsertData = async ({
dataset,
@@ -279,7 +280,7 @@ export async function createOneCollection({ session, ...props }: CreateOneCollec
teamId,
parentId,
datasetId,
tags,
tags: tagIdList,
fileId,
rawLink,
@@ -288,7 +289,18 @@ export async function createOneCollection({ session, ...props }: CreateOneCollec
apiFileId
} = props;
// Create collection tags
const collectionTags = await createOrGetCollectionTags({ tags, teamId, datasetId, session });
const tags = await MongoDatasetCollectionTags.find({
teamId,
datasetId,
_id: { $in: tagIdList }
});
const collectionTags = await createOrGetCollectionTags({
tags: tags.map((item) => item.tag),
teamId,
datasetId,
session
});
// Create collection
const [collection] = await MongoDatasetCollection.create(

View File

@@ -569,17 +569,18 @@ export async function searchDatasetData(
...(filterCollectionIdList
? {
collectionId: {
$in: filterCollectionIdList.map((id) => new Types.ObjectId(id))
$in: filterCollectionIdList
.filter((id) => !forbidCollectionIdList.includes(id))
.map((id) => new Types.ObjectId(id))
}
}
: {}),
...(forbidCollectionIdList && forbidCollectionIdList.length > 0
? {
collectionId: {
$nin: forbidCollectionIdList.map((id) => new Types.ObjectId(id))
: forbidCollectionIdList?.length
? {
collectionId: {
$nin: forbidCollectionIdList.map((id) => new Types.ObjectId(id))
}
}
}
: {})
: {})
}
},
{