EduLearnAI / config.py
mominah's picture
Create config.py
25f087a verified
raw
history blame
1.29 kB
# config.py
import os
import urllib.parse
from dotenv import load_dotenv
load_dotenv() # Load variables from a .env file if available
# --- MongoDB configuration ---
MONGO_USERNAME = os.getenv("MONGO_USERNAME", "momina")
MONGO_PASSWORD = os.getenv("MONGO_PASSWORD", "momimaad@123")
MONGO_CLUSTER = os.getenv("MONGO_CLUSTER", "cluster0.8xnch.mongodb.net")
# URL-encode username and password
USERNAME_ENC = urllib.parse.quote_plus(MONGO_USERNAME)
PASSWORD_ENC = urllib.parse.quote_plus(MONGO_PASSWORD)
CONNECTION_STRING = (
f"mongodb+srv://{USERNAME_ENC}:{PASSWORD_ENC}@{MONGO_CLUSTER}/"
"?"
"retryWrites=true&w=majority&appName=Cluster0"
)
# --- ChatGroq and Trainer configuration ---
CHATGROQ_API_KEY = os.getenv("CHATGROQ_API_KEY", "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")
CUSTOM_PROMPT = """
You are a custom intelligent assistant powered by ChatGroq.
Your responses should be concise, accurate, and helpful.
Context: {context}
Chat History: {chat_history}
Question: {question}
Answer:
"""
# --- Authentication configuration ---
SECRET_KEY = os.getenv("SECRET_KEY", "your_secret_key_here")
ACCESS_TOKEN_EXPIRE_MINUTES = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES", "90"))
REFRESH_TOKEN_EXPIRE_DAYS = int(os.getenv("REFRESH_TOKEN_EXPIRE_DAYS", "7"))