Files
pdf-translate-web/config.py
coder 9a36b9245a feat: 拆分邮件通知选项,根据会员权益显示
- 翻译完成邮件通知(所有用户)
- 鮮件带附件发送(VIP专属,free用户显示需VIP)
- 会员到期提醒(仅VIP用户显示)
- 添加 notify_with_attachment 字段
- 更新各等级权益:email_notify/email_attachment
2026-04-15 01:10:59 +08:00

93 lines
3.0 KiB
Python

"""
PDF翻译网站配置文件
"""
# ==================== 基础配置 ====================
APP_NAME = "PDF翻译助手"
APP_VERSION = "1.0.0"
SECRET_KEY = "pdf-translate-secret-key-change-in-production"
# 数据库
DATABASE_URL = "sqlite:///pdf_translate.db"
# 文件存储
UPLOAD_DIR = "uploads"
CACHE_DIR = "cache"
OUTPUT_DIR = "outputs"
MAX_FILE_SIZE = 50 * 1024 * 1024 # 50MB
# ==================== LLM配置 ====================
LLM_CONFIG = {
"api_base": "http://192.168.2.5:1234/v1",
"api_key": "sk-lm-fuP5tGU8:Hi7YU87jHyDP6Ay8Tl2j",
"model": "qwen/qwen3.5-35b-a3b",
"max_tokens": 8000,
"chunk_size": 2000,
"timeout": 180,
}
# ==================== 用户权限配置 ====================
# 不同用户类型的限制
USER_LIMITS = {
"guest": { # 未登录访客
"daily_translations": 3, # 每日翻译次数
"max_pages": 20, # 单个PDF最大页数
"max_file_size": 10 * 1024 * 1024, # 10MB
"features": ["basic_translate"],
},
"free": { # 免费注册用户
"daily_translations": 10,
"max_pages": 50,
"max_file_size": 30 * 1024 * 1024, # 30MB
"features": ["basic_translate", "retranslate", "export_pdf", "history", "email_notify"],
},
"vip_basic": { # 基础会员 (月付 ¥29)
"daily_translations": 50,
"max_pages": 100,
"max_file_size": 50 * 1024 * 1024,
"features": ["basic_translate", "compare_view", "retranslate", "history", "priority_queue", "export_pdf", "email_notify", "email_attachment"],
},
"vip_pro": { # 专业会员 (月付 ¥99)
"daily_translations": 200,
"max_pages": 500,
"max_file_size": 100 * 1024 * 1024,
"features": ["basic_translate", "compare_view", "retranslate", "history", "priority_queue", "export_pdf", "batch_translate", "custom_terms", "email_notify", "email_attachment"],
},
"vip_enterprise": { # 企业会员 (年付 ¥999)
"daily_translations": -1, # 无限制
"max_pages": -1, # 无限制
"max_file_size": 200 * 1024 * 1024,
"features": ["all"],
},
}
# 会员套餐定价
MEMBERSHIP_PLANS = {
"vip_basic": {
"name": "基础会员",
"price": 29,
"period": "month",
"description": "适合个人轻度使用",
},
"vip_pro": {
"name": "专业会员",
"price": 99,
"period": "month",
"description": "适合学术研究和专业翻译",
},
"vip_enterprise": {
"name": "企业会员",
"price": 999,
"period": "year",
"description": "适合企业和团队使用",
},
}
# ==================== Redis缓存配置 ====================
REDIS_URL = "redis://localhost:6379/0"
CACHE_EXPIRE_DAYS = 30 # 缓存有效期30天
# ==================== 功能配置 ====================
ENABLE_EMAIL_VERIFY = False # 是否启用邮箱验证
ENABLE_CACHE = True # 是否启用翻译缓存
ENABLE_HISTORY = True # 是否保存翻译历史