perf: unlogin user fetch data (#3775)

* model config

* feat: normalization embedding

* perf: unlogin user fetch data
This commit is contained in:
Archer
2025-02-13 13:36:33 +08:00
committed by GitHub
parent 1094c65f2b
commit d3641c877c
13 changed files with 104 additions and 43 deletions

View File

@@ -16,7 +16,7 @@ export const bucketNameMap = {
}
};
export const ReadFileBaseUrl = `${process.env.FE_DOMAIN || ''}${process.env.NEXT_PUBLIC_BASE_URL || ''}/api/common/file/read`;
export const ReadFileBaseUrl = `${process.env.FILE_DOMAIN || process.env.FE_DOMAIN || ''}${process.env.NEXT_PUBLIC_BASE_URL || ''}/api/common/file/read`;
export const documentFileType = '.txt, .docx, .csv, .xlsx, .pdf, .md, .html, .pptx';
export const imageFileType =

View File

@@ -5,6 +5,7 @@ import { ClientSession, Types } from '../../../common/mongo';
import { guessBase64ImageType } from '../utils';
import { readFromSecondary } from '../../mongo/utils';
import { addHours } from 'date-fns';
import { imageFileType } from '@fastgpt/global/common/file/constants';
export const maxImgSize = 1024 * 1024 * 12;
const base64MimeRegex = /data:image\/([^\)]+);base64/;
@@ -32,6 +33,10 @@ export async function uploadMongoImg({
const binary = Buffer.from(base64Data, 'base64');
const extension = mime.split('/')[1];
if (!imageFileType.includes(`.${extension}`)) {
return Promise.reject('Invalid image file type');
}
const { _id } = await MongoImage.create({
teamId,
binary,