4.6.7-alpha commit (#743)

Co-authored-by: Archer <545436317@qq.com>
Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
Archer
2024-01-19 11:17:28 +08:00
committed by GitHub
parent 8ee7407c4c
commit c031e6dcc9
324 changed files with 8509 additions and 4757 deletions

View File

@@ -1,9 +1,9 @@
export const fileImgs = [
{ suffix: 'pdf', src: '/imgs/files/pdf.svg' },
{ suffix: 'csv', src: '/imgs/files/csv.svg' },
{ suffix: '(doc|docs)', src: '/imgs/files/doc.svg' },
{ suffix: 'txt', src: '/imgs/files/txt.svg' },
{ suffix: 'md', src: '/imgs/files/markdown.svg' }
{ suffix: 'pdf', src: 'file/fill/pdf' },
{ suffix: 'csv', src: 'file/fill/csv' },
{ suffix: '(doc|docs)', src: 'file/fill/doc' },
{ suffix: 'txt', src: 'file/fill/txt' },
{ suffix: 'md', src: 'file/fill/markdown' }
// { suffix: '.', src: '/imgs/files/file.svg' }
];

View File

@@ -9,7 +9,7 @@ export enum MongoImageTypeEnum {
teamAvatar = 'teamAvatar',
chatImage = 'chatImage',
docImage = 'docImage'
collectionImage = 'collectionImage'
}
export const mongoImageTypeMap = {
[MongoImageTypeEnum.systemAvatar]: {
@@ -41,8 +41,8 @@ export const mongoImageTypeMap = {
label: 'common.file.type.chatImage',
unique: false
},
[MongoImageTypeEnum.docImage]: {
label: 'common.file.type.docImage',
[MongoImageTypeEnum.collectionImage]: {
label: 'common.file.type.collectionImage',
unique: false
}
};

View File

@@ -1,11 +1,14 @@
import { MongoImageTypeEnum } from './constants';
export type MongoImageSchemaType = {
_id: string;
teamId: string;
binary: Buffer;
createTime: Date;
expiredTime?: Date;
type: `${MongoImageTypeEnum}`;
metadata?: { fileId?: string };
metadata?: {
relatedId?: string; // This id is associated with a set of images
};
};

View File

@@ -13,13 +13,12 @@ export const splitText2Chunks = (props: {
chunkLen: number;
overlapRatio?: number;
customReg?: string[];
countTokens?: boolean;
}): {
chunks: string[];
tokens: number;
chars: number;
overlapRatio?: number;
} => {
let { text = '', chunkLen, overlapRatio = 0.2, customReg = [], countTokens = true } = props;
let { text = '', chunkLen, overlapRatio = 0.2, customReg = [] } = props;
const splitMarker = 'SPLIT_HERE_SPLIT_HERE';
const codeBlockMarker = 'CODE_BLOCK_LINE_MARKER';
const overlapLen = Math.round(chunkLen * overlapRatio);
@@ -240,13 +239,11 @@ export const splitText2Chunks = (props: {
mdTitle: ''
}).map((chunk) => chunk?.replaceAll(codeBlockMarker, '\n') || ''); // restore code block
const tokens = countTokens
? chunks.reduce((sum, chunk) => sum + countPromptTokens(chunk, 'system'), 0)
: 0;
const chars = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
return {
chunks,
tokens
chars
};
} catch (err) {
throw new Error(getErrText(err));

View File

@@ -55,6 +55,8 @@ export type FastGPTFeConfigsType = {
datasetStoreFreeSize?: number;
datasetStorePrice?: number;
};
uploadFileMaxSize?: number;
};
export type SystemEnvType = {