refactor: Use MongoDB singleton for connection management

This commit is contained in:
kom-senapati
2024-10-18 09:18:15 +05:30
parent 7bf79675c1
commit 83f2fb1e62
6 changed files with 35 additions and 10 deletions

View File

@@ -8,7 +8,7 @@ from bson.dbref import DBRef
from bson.objectid import ObjectId
from flask import Blueprint, jsonify, make_response, request
from flask_restx import inputs, fields, Namespace, Resource
from pymongo import MongoClient
from core.mongo_db import MongoDB
from werkzeug.utils import secure_filename
from application.api.user.tasks import ingest, ingest_remote
@@ -18,7 +18,7 @@ from application.extensions import api
from application.utils import check_required_fields
from application.vectorstore.vector_creator import VectorCreator
mongo = MongoClient(settings.MONGO_URI)
mongo = MongoDB.get_client()
db = mongo["docsgpt"]
conversations_collection = db["conversations"]
sources_collection = db["sources"]