feat(training): 完善安全培训题库与考试交互

修复 PDF 导入判断和填空题解析,支持文本题判分、回顾改答及安全培训三级流程校验。
This commit is contained in:
runny committed 2026-08-18 01:12:04 +08:00
1 parent ec4ed9b67d
commit e62e4961d4
19 files changed
+721 -48

No files matched your search

+14
View File
@@ -30,6 +30,20 @@ def get_document_version_source_file(version_id: int):
return send_file(source_path, as_attachment=as_attachment, download_name=filename)
@knowledge_base_bp.route('/document-versions/<int:version_id>/training-preview-file', methods=['GET'])
def get_training_preview_file(version_id: int):
"""
返回员工培训资料的可预览文件。
用途:培训配置文件预览使用与聊天源文件相同的受保护同源访问方式;原始文件缺失时由服务层回退清洗预览文件。
参数约束:仅允许已登录用户访问,不改变原始文件下载接口语义。
"""
require_user()
preview_path, filename = document_service.resolve_training_preview_file_path(version_id)
as_attachment = str(request.args.get('download') or '').strip() == '1'
return send_file(preview_path, as_attachment=as_attachment, download_name=filename)
@knowledge_base_bp.route('/documents/<int:document_id>/sync-records', methods=['GET'])
def list_document_sync_records(document_id: int):
require_user()