初始提交: PDF翻译网站
功能: - 上传PDF自动翻译成中文 - 不登录可用(次数限制) - 登录后获得更多次数 - 会员等级制度(不同权益) - 智能缓存(相同文件秒出结果) - 原文译文对比查看 - 支持重新翻译(自定义要求) - 翻译历史记录 技术栈: Flask + SQLAlchemy + Bootstrap5
This commit is contained in:
93
config.py
Normal file
93
config.py
Normal file
@@ -0,0 +1,93 @@
|
||||
"""
|
||||
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", "compare_view", "retranslate", "history"],
|
||||
},
|
||||
"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"],
|
||||
},
|
||||
"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"],
|
||||
},
|
||||
"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 # 是否保存翻译历史
|
||||
Reference in New Issue
Block a user