feat: 新增 pdf_translate 命令行工具

- 支持命令: translate/list/status/download/config
- 支持用户认证: --user --password 参数
- 翻译进度实时显示,结果可在网页查看
- 新增 /api/config 和 /api/translations 接口
- 修复异步翻译任务的配置获取逻辑
This commit is contained in:
2026-04-16 21:50:24 +08:00
parent 44077796f8
commit ed3d8e095e
3 changed files with 345 additions and 2 deletions

View File

@@ -279,12 +279,14 @@ class TranslationTask:
with app.app_context():
from admin import get_llm_config
llm_config = get_llm_config()
config['LLM_CONFIG'] = llm_config
config = {'LLM_CONFIG': llm_config}
service = TranslationService(config)
task['status'] = 'processing'
task['started_at'] = datetime.now().isoformat()
print(f"[翻译任务] 开始翻译,使用配置: {config.get('LLM_CONFIG', {}).get('api_base', '未知')}")
# 更新数据库状态为 processing
if app and translation_id:
with app.app_context():