new file: .env.example new file: Dockerfile new file: app.py new file: blueprints/__init__.py new file: blueprints/auth.py new file: blueprints/chat.py new file: blueprints/context.py new file: blueprints/documents.py new file: blueprints/main.py new file: config.py new file: docker-compose.yml new file: models/__init__.py new file: models/chat_session.py new file: models/document.py new file: models/user.py new file: requirements.txt new file: services/__init__.py new file: services/document_parser.py new file: services/llm_service.py new file: services/rag_service.py new file: services/url_scraper.py new file: static/css/style.css new file: static/js/chat.js new file: static/js/inline_chat.js new file: static/js/main.js new file: templates/base.html new file: templates/document_view.html new file: templates/index.html new file: templates/login.html new file: templates/register.html
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
import os
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
|
|
class Config:
|
|
SECRET_KEY = os.environ.get("SECRET_KEY", "change-me-in-production")
|
|
SQLALCHEMY_DATABASE_URI = os.environ.get(
|
|
"DATABASE_URI", f"sqlite:///{os.path.join(BASE_DIR, 'app.db')}"
|
|
)
|
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
|
|
|
UPLOAD_FOLDER = os.environ.get("UPLOAD_FOLDER", os.path.join(BASE_DIR, "uploads"))
|
|
VECTORDB_PATH = os.environ.get("VECTORDB_PATH", os.path.join(BASE_DIR, "vectordb"))
|
|
TRANSFORMERS_CACHE = os.environ.get(
|
|
"TRANSFORMERS_CACHE", os.path.join(BASE_DIR, ".cache")
|
|
)
|
|
|
|
ALLOWED_EXTENSIONS = {"pdf", "txt", "docx", "md"}
|
|
MAX_CONTENT_LENGTH = 50 * 1024 * 1024 # 50 MB
|
|
|
|
# LLM Provider: "lmstudio" or "openai"
|
|
AI_PROVIDER = os.environ.get("AI_PROVIDER", "lmstudio")
|
|
LM_STUDIO_URL = os.environ.get("LM_STUDIO_URL", "http://localhost:1234")
|
|
LM_STUDIO_MODEL = os.environ.get("LM_STUDIO_MODEL", "local-model")
|
|
OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY", "")
|
|
OPENAI_MODEL = os.environ.get("OPENAI_MODEL", "gpt-4o")
|
|
|
|
RAG_TOP_K = int(os.environ.get("RAG_TOP_K", "5"))
|
|
RAG_CHUNK_SIZE = int(os.environ.get("RAG_CHUNK_SIZE", "500"))
|
|
RAG_CHUNK_OVERLAP = int(os.environ.get("RAG_CHUNK_OVERLAP", "50"))
|