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 urllib.parse import urljoin
import requests
from bson.objectid import ObjectId
from pymongo import MongoClient
from core.mongo_db import MongoDB
from application.core.settings import settings
from application.parser.file.bulk import SimpleDirectoryReader
@@ -18,7 +18,7 @@ from application.parser.schema.base import Document
from application.parser.token_func import group_split
from application.utils import count_tokens_docs
mongo = MongoClient(settings.MONGO_URI)
mongo = MongoDB.get_client()
db = mongo["docsgpt"]
sources_collection = db["sources"]