Spaces:
Sleeping
Sleeping
File size: 1,137 Bytes
25f087a 1c312c7 25f087a 1c312c7 25f087a 1c312c7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# 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")
MONGO_PASSWORD = os.getenv("MONGO_PASSWORD")
MONGO_CLUSTER = os.getenv("MONGO_CLUSTER")
# 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")
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")
ACCESS_TOKEN_EXPIRE_MINUTES = int(os.getenv("ACCESS_TOKEN_EXPIRE_MINUTES"))
REFRESH_TOKEN_EXPIRE_DAYS = int(os.getenv("REFRESH_TOKEN_EXPIRE_DAYS"))
|