mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
doc gpt V0.2
This commit is contained in:
23
src/service/mongo.ts
Normal file
23
src/service/mongo.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import mongoose from 'mongoose';
|
||||
import type { Mongoose } from 'mongoose';
|
||||
|
||||
let cachedClient: Mongoose;
|
||||
|
||||
export async function connectToDatabase() {
|
||||
if (cachedClient && cachedClient.connection.readyState === 1) {
|
||||
return cachedClient;
|
||||
}
|
||||
|
||||
cachedClient = await mongoose.connect(process.env.MONGODB_UR as string, {
|
||||
dbName: 'doc_gpt'
|
||||
});
|
||||
|
||||
return cachedClient;
|
||||
}
|
||||
|
||||
export * from './models/authCode';
|
||||
export * from './models/chat';
|
||||
export * from './models/model';
|
||||
export * from './models/user';
|
||||
export * from './models/training';
|
||||
export * from './models/chatWindow';
|
Reference in New Issue
Block a user