v4.6.9-alpha (#918)

Co-authored-by: Mufei <327958099@qq.com>
Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
Archer
2024-03-04 00:05:25 +08:00
committed by GitHub
parent f9f0b4bffd
commit 42a8184ea0
153 changed files with 4906 additions and 4307 deletions

View File

@@ -1,4 +1,3 @@
import { startQueue } from './utils/tools';
import { PRICE_SCALE } from '@fastgpt/global/support/wallet/constants';
import { MongoUser } from '@fastgpt/service/support/user/schema';
import { connectMongo } from '@fastgpt/service/common/mongo/init';
@@ -9,22 +8,29 @@ import { initVectorStore } from '@fastgpt/service/common/vectorStore/controller'
import { getInitConfig } from '@/pages/api/common/system/getInitData';
import { startCron } from './common/system/cron';
import { mongoSessionRun } from '@fastgpt/service/common/mongo/sessionRun';
import { initGlobal } from './common/system';
import { startMongoWatch } from './common/system/volumnMongoWatch';
import { startTrainingQueue } from './core/dataset/training/utils';
/**
* connect MongoDB and init data
*/
export function connectToDatabase(): Promise<void> {
return connectMongo({
beforeHook: () => {},
beforeHook: () => {
initGlobal();
},
afterHook: async () => {
initVectorStore();
// start queue
startQueue();
startMongoWatch();
// cron
startCron();
// init system config
getInitConfig();
// cron
startCron();
// init vector database
await initVectorStore();
// start queue
startTrainingQueue(true);
initRootUser();
}
@@ -62,7 +68,7 @@ async function initRootUser() {
rootId = _id;
}
// init root team
await createDefaultTeam({ userId: rootId, maxSize: 1, balance: 9999 * PRICE_SCALE, session });
await createDefaultTeam({ userId: rootId, balance: 9999 * PRICE_SCALE, session });
});
console.log(`root user init:`, {