fix collection tags create (#5117)

This commit is contained in:
heheer
2025-06-30 13:15:45 +08:00
committed by GitHub
parent 1eb98ef0fe
commit 58160409a9
3 changed files with 13 additions and 11 deletions

View File

@@ -37,7 +37,6 @@ 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,
@@ -280,7 +279,7 @@ export async function createOneCollection({ session, ...props }: CreateOneCollec
teamId,
parentId,
datasetId,
tags: tagIdList,
tags,
fileId,
rawLink,
@@ -288,15 +287,9 @@ export async function createOneCollection({ session, ...props }: CreateOneCollec
externalFileUrl,
apiFileId
} = props;
// Create collection tags
const tags = await MongoDatasetCollectionTags.find({
teamId,
datasetId,
_id: { $in: tagIdList }
});
const collectionTags = await createOrGetCollectionTags({
tags: tags.map((item) => item.tag),
tags,
teamId,
datasetId,
session

View File

@@ -194,7 +194,11 @@ export const syncCollection = async (collection: CollectionWithDatasetType) => {
createCollectionParams: {
...collection,
name: title || collection.name,
updateTime: new Date()
updateTime: new Date(),
tags: await collectionTagsToTagLabel({
datasetId: collection.datasetId,
tags: collection.tags
})
}
});
});