feat: 翻译记录添加不共享开关功能

- Translation 模型新增 no_share 字段
- 管理后台翻译记录页面添加共享状态列和切换按钮
- 不共享的翻译不会被其他用户使用缓存
- 缓存匹配时检查是否有 no_share 标记
This commit is contained in:
2026-04-16 19:06:43 +08:00
parent 504fed6c3e
commit 44077796f8
4 changed files with 68 additions and 6 deletions

7
app.py
View File

@@ -365,8 +365,11 @@ def upload_pdf():
cache_path = cache_service.get_cache(file_hash)
from_cache = False
if cache_path and ENABLE_CACHE and not instruction:
# 有缓存且无特殊翻译要求,直接使用缓存
# 检查是否有用户设置了不共享此文件
no_share_check = Translation.query.filter_by(file_hash=file_hash, no_share=True).first()
if cache_path and ENABLE_CACHE and not instruction and not no_share_check:
# 有缓存且无特殊翻译要求且无不共享标记,直接使用缓存
from_cache = True
output_path = cache_path
else: