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

@@ -1,10 +1,10 @@
import sys
from pymongo import MongoClient
from core.mongo_db import MongoDB
from datetime import datetime
from application.core.settings import settings
from application.utils import num_tokens_from_string
mongo = MongoClient(settings.MONGO_URI)
mongo = MongoDB.get_client()
db = mongo["docsgpt"]
usage_collection = db["token_usage"]