mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-14 07:00:47 +00:00
fix: dataset image will expired (#5021)
This commit is contained in:
@@ -41,7 +41,6 @@ import { clearCollectionImages, removeDatasetImageExpiredTime } from '../image/u
|
||||
export const createCollectionAndInsertData = async ({
|
||||
dataset,
|
||||
rawText,
|
||||
relatedId,
|
||||
imageIds,
|
||||
createCollectionParams,
|
||||
backupParse = false,
|
||||
@@ -50,7 +49,6 @@ export const createCollectionAndInsertData = async ({
|
||||
}: {
|
||||
dataset: DatasetSchemaType;
|
||||
rawText?: string;
|
||||
relatedId?: string;
|
||||
imageIds?: string[];
|
||||
createCollectionParams: CreateOneCollectionParams;
|
||||
|
||||
@@ -258,23 +256,6 @@ export const createCollectionAndInsertData = async ({
|
||||
collectionId,
|
||||
session
|
||||
});
|
||||
if (relatedId) {
|
||||
await MongoImage.updateMany(
|
||||
{
|
||||
teamId,
|
||||
'metadata.relatedId': relatedId
|
||||
},
|
||||
{
|
||||
// Remove expiredTime to avoid ttl expiration
|
||||
$unset: {
|
||||
expiredTime: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
session
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
collectionId: String(collectionId),
|
||||
|
@@ -46,7 +46,6 @@ async function handler(
|
||||
|
||||
const { collectionId, insertResults } = await createCollectionAndInsertData({
|
||||
dataset,
|
||||
relatedId: apiFileId,
|
||||
createCollectionParams: {
|
||||
...body,
|
||||
teamId,
|
||||
|
@@ -31,9 +31,7 @@ async function handler(req: NextApiRequest): CreateCollectionResponse {
|
||||
webPageSelector: body?.metadata?.webPageSelector
|
||||
},
|
||||
rawLink: link
|
||||
},
|
||||
|
||||
relatedId: link
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
|
@@ -62,7 +62,6 @@ async function handler(req: NextApiRequest, res: NextApiResponse<any>): CreateCo
|
||||
// 3. Create collection
|
||||
const { collectionId, insertResults } = await createCollectionAndInsertData({
|
||||
dataset,
|
||||
relatedId: relatedImgId,
|
||||
createCollectionParams: {
|
||||
...collectionData,
|
||||
name: collectionName,
|
||||
|
@@ -44,7 +44,6 @@ async function handler(
|
||||
|
||||
const { collectionId } = await createCollectionAndInsertData({
|
||||
dataset: collection.dataset,
|
||||
relatedId: collection.metadata?.relatedImgId,
|
||||
createCollectionParams: {
|
||||
...collection,
|
||||
...data,
|
||||
|
@@ -30,6 +30,7 @@ import { MongoDatasetCollection } from '@fastgpt/service/core/dataset/collection
|
||||
import { hashStr } from '@fastgpt/global/common/string/tools';
|
||||
import { POST } from '@fastgpt/service/common/api/plusRequest';
|
||||
import { pushLLMTrainingUsage } from '@fastgpt/service/support/wallet/usage/controller';
|
||||
import { MongoImage } from '@fastgpt/service/common/file/image/schema';
|
||||
|
||||
const requestLLMPargraph = async ({
|
||||
rawText,
|
||||
@@ -321,6 +322,26 @@ export const datasetParseQueue = async (): Promise<any> => {
|
||||
session
|
||||
}
|
||||
);
|
||||
|
||||
// 8. Remove image ttl
|
||||
const relatedImgId = collection.metadata?.relatedImgId;
|
||||
if (relatedImgId) {
|
||||
await MongoImage.updateMany(
|
||||
{
|
||||
teamId: collection.teamId,
|
||||
'metadata.relatedId': relatedImgId
|
||||
},
|
||||
{
|
||||
// Remove expiredTime to avoid ttl expiration
|
||||
$unset: {
|
||||
expiredTime: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
session
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
addLog.debug(`[Parse Queue] Finish`, {
|
||||
|
Reference in New Issue
Block a user