mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-18 01:16:01 +00:00
lock (#2063)
* lock * perf: init data * perf: vision model url * fix: chat index
This commit is contained in:
@@ -64,10 +64,13 @@ export const getMongoModel = <T>(name: string, schema: mongoose.Schema) => {
|
||||
addCommonMiddleware(schema);
|
||||
|
||||
const model = connectionMongo.model<T>(name, schema);
|
||||
try {
|
||||
model.syncIndexes();
|
||||
} catch (error) {
|
||||
addLog.error('Create index error', error);
|
||||
|
||||
if (process.env.SYNC_INDEX !== '0') {
|
||||
try {
|
||||
model.syncIndexes({ background: true });
|
||||
} catch (error) {
|
||||
addLog.error('Create index error', error);
|
||||
}
|
||||
}
|
||||
|
||||
return model;
|
||||
|
Reference in New Issue
Block a user