perf: backup import (#4866)
* i18n * remove invalid code * perf: backup import * backup tip * fix: indexsize invalid
This commit is contained in:
@@ -23,9 +23,11 @@ const reloadConfigWatch = () => {
|
||||
changeStream.on('change', async (change) => {
|
||||
try {
|
||||
if (
|
||||
change.operationType === 'update' ||
|
||||
(change.operationType === 'insert' &&
|
||||
change.fullDocument.type === SystemConfigsTypeEnum.fastgptPro) ||
|
||||
change.operationType === 'update'
|
||||
[SystemConfigsTypeEnum.fastgptPro, SystemConfigsTypeEnum.license].includes(
|
||||
change.fullDocument.type
|
||||
))
|
||||
) {
|
||||
await initSystemConfig();
|
||||
console.log('refresh system config');
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
type DatasetDataIndexItemType,
|
||||
type DatasetDataItemType
|
||||
} from '@fastgpt/global/core/dataset/type';
|
||||
import { getEmbeddingModel, getLLMModel } from '@fastgpt/service/core/ai/model';
|
||||
import { getEmbeddingModel } from '@fastgpt/service/core/ai/model';
|
||||
import { mongoSessionRun } from '@fastgpt/service/common/mongo/sessionRun';
|
||||
import { type ClientSession } from '@fastgpt/service/common/mongo';
|
||||
import { MongoDatasetDataText } from '@fastgpt/service/core/dataset/data/dataTextSchema';
|
||||
@@ -93,13 +93,15 @@ const formatIndexes = async ({
|
||||
return item;
|
||||
}
|
||||
});
|
||||
indexes = indexes.filter((item) => item.type !== DatasetDataIndexTypeEnum.default);
|
||||
indexes.push(...concatDefaultIndexes);
|
||||
|
||||
// Remove same text
|
||||
// 其他索引不能与默认索引相同,且不能自己有重复
|
||||
indexes = indexes.filter(
|
||||
(item, index, self) => index === self.findIndex((t) => t.text === item.text)
|
||||
(item, index, self) =>
|
||||
item.type !== DatasetDataIndexTypeEnum.default &&
|
||||
!concatDefaultIndexes.find((t) => t.text === item.text) &&
|
||||
index === self.findIndex((t) => t.text === item.text)
|
||||
);
|
||||
indexes.push(...concatDefaultIndexes);
|
||||
|
||||
const chekcIndexes = (
|
||||
await Promise.all(
|
||||
|
||||
@@ -262,6 +262,7 @@ const insertData = async ({
|
||||
q: trainingData.q,
|
||||
a: trainingData.a,
|
||||
chunkIndex: trainingData.chunkIndex,
|
||||
indexSize: trainingData.indexSize,
|
||||
indexes: trainingData.indexes,
|
||||
embeddingModel: trainingData.model,
|
||||
session
|
||||
|
||||
Reference in New Issue
Block a user