Restore code and save recent updates

This commit is contained in:
2026-01-25 03:31:01 +00:00
parent bae861c71f
commit 5ce0b4d278
54 changed files with 2963 additions and 2899 deletions

View File

@@ -1,21 +1,21 @@
import os
from pymongo import MongoClient
from dotenv import load_dotenv
import os
from pymongo import MongoClient
from dotenv import load_dotenv
script_dir = os.path.dirname(os.path.abspath(__file__))
env_path = os.path.join(script_dir, '..', 'rag', '.env')
load_dotenv(env_path)
script_dir =os .path .dirname (os .path .abspath (__file__ ))
env_path =os .path .join (script_dir ,'..','rag','.env')
load_dotenv (env_path )
def get_database():
uri = os.getenv("MONGO_URI")
try:
client = MongoClient(uri)
db = client["my_rag_app"]
print("SUCCESS: Connected to MongoDB Atlas!")
return db
except Exception as e:
print(f"ERROR: Could not connect to MongoDB: {e}")
return None
def get_database ():
uri =os .getenv ("MONGO_URI")
try :
client =MongoClient (uri )
db =client ["my_rag_app"]
print ("SUCCESS: Connected to MongoDB Atlas!")
return db
except Exception as e :
print (f"ERROR: Could not connect to MongoDB: {e }")
return None
if __name__ == "__main__":
get_database()
if __name__ =="__main__":
get_database ()