Nhận PDF upload trực tiếp qua POST /parse

API trước đây chỉ nhận đường dẫn HDFS từ Airflow. Thêm endpoint
multipart/form-data nhận thẳng file PDF, vẫn chạy bất đồng bộ: trả 202 kèm
job_id và result_url, worker xử lý nền, client lấy dla-document-bundle ở
GET /jobs/{job_id}/result hoặc qua callback.

- File upload ghi xuống IDP_DATA_DIR/uploads theo sha256 nội dung nên gửi lại
  cùng request_id trả cùng job_id; file được xoá khi không còn job nào dùng.
- Thêm cột filename/source_kind để bundle giữ đúng tên file gốc thay vì tên
  đã băm.
- IDP_RUN_WORKER=1 chạy worker trong process API cho triển khai một host.
- IDP_OCR_BACKEND=pdf_text dựng bundle từ text layer của PDF để chạy thử toàn
  bộ luồng khi chưa serve được model.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-21 14:51:19 +00:00
parent 939e3bc8c1
commit c79ea9f05f
11 changed files with 343 additions and 31 deletions

View File

@@ -30,6 +30,8 @@ pydantic-core==2.46.5
# via pydantic
pymupdf==1.28.2
# via idp-parsing-service
python-multipart==0.0.32
# via idp-parsing-service
requests==2.34.2
# via hdfs
six==1.17.0