Merge pull request #1335 from kom-senapati/feature/mongodb-connection-refactor

refactor: use MongoDB singleton for connection management
This commit is contained in:
Alex
2024-10-31 11:36:01 +00:00
committed by GitHub
8 changed files with 36 additions and 13 deletions

View File

@@ -8,18 +8,18 @@ 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 werkzeug.utils import secure_filename
from application.api.user.tasks import ingest, ingest_remote
from application.core.mongo_db import MongoDB
from application.core.settings import settings
from application.extensions import api
from application.utils import check_required_fields
from application.vectorstore.vector_creator import VectorCreator
from application.tts.google_tts import GoogleTTS
mongo = MongoClient(settings.MONGO_URI)
mongo = MongoDB.get_client()
db = mongo["docsgpt"]
conversations_collection = db["conversations"]
sources_collection = db["sources"]