Files
bianchengshequ/backend/config.py

66 lines
2.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""应用配置"""
import os
from dotenv import load_dotenv
load_dotenv()
# 数据库配置
DATABASE_URL = os.getenv("DATABASE_URL", "mysql+pymysql://root:root@127.0.0.1:3306/biancheng?charset=utf8mb4")
# JWT配置
SECRET_KEY = os.getenv("SECRET_KEY", "your-secret-key-change-in-production")
ALGORITHM = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES = 60 * 24 * 7 # 7天
# 上传文件配置
UPLOAD_DIR = os.path.join(os.path.dirname(__file__), "uploads")
MAX_UPLOAD_SIZE = 10 * 1024 * 1024 # 10MB
MAX_ATTACHMENT_SIZE = 20 * 1024 * 1024 # 20MB
# 腾讯云COS配置
COS_SECRET_ID = os.getenv("COS_SECRET_ID", "")
COS_SECRET_KEY = os.getenv("COS_SECRET_KEY", "")
COS_BUCKET = os.getenv("COS_BUCKET", "") # 如 bianchengshequ-1250000000
COS_REGION = os.getenv("COS_REGION", "") # 如 ap-beijing
COS_CUSTOM_DOMAIN = os.getenv("COS_CUSTOM_DOMAIN", "") # 可选CDN自定义域名
# 大模型配置
MODEL_CONFIG = {
"multimodal": {
"provider": "google",
"model": "gemini-2.5-pro-preview-06-05",
"description": "图片/草图理解",
},
"reasoning": {
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"description": "需求解读/架构分析",
},
"lightweight": {
"provider": "openai",
"model": "gpt-4o-mini",
"description": "分类/标签/轻量任务",
},
"knowledge_base": {
"provider": "deepseek",
"model": "deepseek-chat",
"description": "知识库文档理解/问答",
},
"embedding": {
"provider": "openai",
"model": "text-embedding-3-large",
"description": "向量化嵌入",
},
}
# API Key 配置
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "")
ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY", "")
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY", "")
DEEPSEEK_API_KEY = os.getenv("DEEPSEEK_API_KEY", "")
# 火山方舟(豆包大模型)配置
ARK_API_KEY = os.getenv("ARK_API_KEY", "")
ARK_ENDPOINT = os.getenv("ARK_ENDPOINT", "ep-20260411180700-z6nll")
ARK_BASE_URL = "https://ark.cn-beijing.volces.com/api/v3"