Commit Graph

17 Commits

Author SHA1 Message Date
FFFFFFpy e21a5da422 feat: add EPUB and MHTML document support 2026-06-16 11:25:27 +08:00
wizardchen ef1047bf67 feat(parser): add OpenDataLoader, PaddleOCR-VL engines, and parser improvements
Introduce opendataloader and PaddleOCR-VL parser engines with tenant-level
settings UI, replace liteparse, and harden Excel/PPT/Markdown parsing.
Optional odl-hybrid sidecar stays local-build only and is excluded from
default dev-start and full profiles.
2026-06-03 12:29:13 +08:00
wizardchen 7b1bb1054f feat(docreader): speed up scanned-PDF parsing, stream image results, isolate heavy async queues
Large scanned PDFs (hundreds of pages) were slow and fragile end-to-end.
This change addresses the parse, transport, and task-scheduling layers:

docreader (parse + transport):
- Parallelize per-page scanned rendering across processes (forkserver/fork),
  with serial fallback. ~4-7x faster on large scanned PDFs; pdfium is not
  thread-safe so we fan out across processes. Configurable via
  DOCREADER_PDF_RENDER_PARALLELISM.
- Add server-streaming ReadStream RPC: emit one meta frame then one frame per
  image, so documents with many page images are no longer capped by the unary
  gRPC message-size limit (a 874-page PDF produced ~193MiB of images, far over
  the 50MB cap) and memory is bounded on both ends. Unary Read is kept for
  backward compatibility; the Go production reader switches to ReadStream.

VLM:
- Make the VLM HTTP timeout configurable (VLM_HTTP_TIMEOUT_SECONDS) and raise
  the default 90s -> 180s so dense scanned-page OCR does not time out with
  "context deadline exceeded".

Async task queues:
- Isolate high-volume, model-heavy fan-out tasks into dedicated asynq queues so
  a single large document cannot saturate the shared worker pool and block
  user-facing document parsing:
    image:multimodal  -> "multimodal"
    chunk:extract     -> "graph"
    question:generation -> "question"
- Register the new queues in the server weight map and the cancel inspector's
  scanned-queue set (so cancelling a knowledge still purges its pending tasks).
2026-06-03 12:29:13 +08:00
taoyang f30e9ccd0f fix(docreader): bump grpcio floor to 1.78.0 to match generated proto
docreader fails to start on a fresh `uv sync` of main:

    $ uv sync --frozen
    $ uv run python -m docreader.main
    Traceback (most recent call last):
      ...
      File ".../docreader/proto/docreader_pb2_grpc.py", line 19, in <module>
        raise RuntimeError(...)
    RuntimeError: The grpc package installed is at version 1.76.0, but the
    generated code in docreader_pb2_grpc.py depends on grpcio>=1.78.0.
    Please upgrade your grpc module to grpcio>=1.78.0 or downgrade your
    generated code using grpcio-tools<=1.76.0.

`docreader_pb2_grpc.py:8` was regenerated with grpcio-tools 1.78+ and
hardcodes `GRPC_GENERATED_VERSION = '1.78.0'`, then at import time runs
`first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)` and
raises if the installed runtime is older. But `pyproject.toml` still
pins:

    "grpcio>=1.76.0",
    "grpcio-health-checking>=1.76.0",
    "grpcio-tools>=1.76.0",

…and `uv.lock` resolves to grpcio 1.76.0. So every fresh clone +
`uv sync` ends up with a docreader that crashes on import, and a
WeKnora backend that thinks docreader is "not connected" — silently
falling back to the Go-side static engine registry only.

Downstream user-visible symptom: `/api/v1/system/parser-engines`
returns just the Go-side engines. Python-only engines (e.g.
markitdown, plus any custom Python parsers) never appear in the KB
create/edit form. Document parsing falls back to mineru/builtin even
when the user intended to use docreader-backed engines.

Reproduce on main (before this commit):

    cd docreader
    uv sync --frozen
    uv run python -m docreader.main
    # → RuntimeError at import, server never starts

After this commit:

    Resolved 79 packages
    Updated grpcio v1.76.0 -> v1.80.0
    Updated grpcio-health-checking v1.76.0 -> v1.80.0
    Updated grpcio-tools v1.76.0 -> v1.80.0
    ...
    $ uv run python -c "from docreader.proto import docreader_pb2_grpc; print('ok')"
    ok

Fix is the minimum-floor bump on the three grpcio packages, plus the
lockfile update uv emits as a result (all 1.76.0 → 1.80.0, newest
stable matching the proto's floor). No proto regen, no code change —
just aligning the dep declaration with what the generated client
already requires.

The next regen of docreader_pb2_grpc.py (e.g. with grpcio-tools 1.80+)
would raise the floor again; pinning at the proto's declared floor is
the conservative choice that keeps this in sync.
2026-05-17 15:17:09 +08:00
dependabot[bot] b1ea90490f chore(deps): update pypdfium2 requirement in /docreader
Updates the requirements on [pypdfium2](https://github.com/pypdfium2-team/pypdfium2) to permit the latest version.
- [Release notes](https://github.com/pypdfium2-team/pypdfium2/releases)
- [Commits](https://github.com/pypdfium2-team/pypdfium2/compare/5.0.0...5.8.0)

---
updated-dependencies:
- dependency-name: pypdfium2
  dependency-version: 5.8.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-12 14:29:29 +08:00
dependabot[bot] 7ef37c8502 chore(deps): update pydantic requirement in /docreader
Updates the requirements on [pydantic](https://github.com/pydantic/pydantic) to permit the latest version.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/v2.13.4/HISTORY.md)
- [Commits](https://github.com/pydantic/pydantic/compare/v2.12.3...v2.13.4)

---
updated-dependencies:
- dependency-name: pydantic
  dependency-version: 2.13.4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-12 14:29:13 +08:00
wizardchen d65e647f95 chore: bump Go to 1.26 and slim docreader dependencies
- Bump base image in docker/Dockerfile.app from golang:1.24 to golang:1.26
  to match `go 1.26` declared in go.mod (fixes CI build failure on
  `go mod download`).
- Drop unused docreader components and their dependencies:
  - Remove `docreader/ocr/` package (paddle/vlm/dummy backends are
    unreferenced by the main flow; OCR/VLM is handled by the Go App).
  - Remove `docreader/parser/storage.py` (dead code; image persistence
    happens in the Go App via inline ImageRef bytes).
  - Remove `docreader/scripts/download_deps.py` (PaddleOCR pre-download).
  - Drop deps: paddleocr, paddlepaddle, openai, ollama, minio,
    cos-python-sdk-v5, oss2, asyncio, pypdf2, markdown, mistletoe,
    goose3, markdownify, pdfplumber, antiword, urllib3.
- Re-lock uv.lock: 145 -> 79 packages.
- Update docreader/README.md to reflect that OCR/VLM/storage are no
  longer configured at the docreader level.
2026-05-09 13:32:40 +08:00
dependabot[bot] c17a128298 chore(deps): update paddlepaddle requirement in /docreader
Updates the requirements on [paddlepaddle](https://github.com/paddlepaddle/paddle) to permit the latest version.
- [Release notes](https://github.com/paddlepaddle/paddle/releases)
- [Changelog](https://github.com/PaddlePaddle/Paddle/blob/develop/RELEASE.md)
- [Commits](https://github.com/paddlepaddle/paddle/compare/v3.0.0...v3.3.1)

---
updated-dependencies:
- dependency-name: paddlepaddle
  dependency-version: 3.3.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-09 12:59:05 +08:00
dependabot[bot] 856054e424 chore(deps): update cos-python-sdk-v5 requirement in /docreader
Updates the requirements on [cos-python-sdk-v5](https://github.com/tencentyun/cos-python-sdk-v5) to permit the latest version.
- [Release notes](https://github.com/tencentyun/cos-python-sdk-v5/releases)
- [Changelog](https://github.com/tencentyun/cos-python-sdk-v5/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tencentyun/cos-python-sdk-v5/compare/V1.9.38...V1.9.42)

---
updated-dependencies:
- dependency-name: cos-python-sdk-v5
  dependency-version: 1.9.42
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-09 12:57:30 +08:00
dependabot[bot] f5571e7b2c chore(deps): update oss2 requirement in /docreader
Updates the requirements on [oss2](https://github.com/aliyun/aliyun-oss-python-sdk) to permit the latest version.
- [Release notes](https://github.com/aliyun/aliyun-oss-python-sdk/releases)
- [Changelog](https://github.com/aliyun/aliyun-oss-python-sdk/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/aliyun/aliyun-oss-python-sdk/commits)

---
updated-dependencies:
- dependency-name: oss2
  dependency-version: 2.19.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-09 12:57:18 +08:00
dependabot[bot] 81d8a3967c chore(deps): update lxml requirement in /docreader
Updates the requirements on [lxml](https://github.com/lxml/lxml) to permit the latest version.
- [Release notes](https://github.com/lxml/lxml/releases)
- [Changelog](https://github.com/lxml/lxml/blob/master/CHANGES.txt)
- [Commits](https://github.com/lxml/lxml/compare/lxml-6.0.2...lxml-6.1.0)

---
updated-dependencies:
- dependency-name: lxml
  dependency-version: 6.1.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-09 12:57:05 +08:00
dependabot[bot] 2276d38ca4 chore(deps): update minio requirement in /docreader
Updates the requirements on [minio](https://github.com/minio/minio-py) to permit the latest version.
- [Release notes](https://github.com/minio/minio-py/releases)
- [Commits](https://github.com/minio/minio-py/compare/7.2.18...7.2.20)

---
updated-dependencies:
- dependency-name: minio
  dependency-version: 7.2.20
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-09 12:56:40 +08:00
wolfkill 450a5bd2dd fix(docreader): throttle heavy parser concurrency 2026-05-07 17:36:09 +08:00
bingxiang.cheng fd13fa7350 chore(docreader): add oss2 dependency for Alibaba Cloud OSS
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 15:34:28 +08:00
begoniezhao 4fdbec17a7 feat: 新增网页解析类,优化依赖及图片编码支持 2025-11-18 22:37:01 +08:00
begoniezhao 2d66abedf0 feat: 新增文档模型类,调整配置与解析逻辑,优化日志及导入
移除日志设置与冗余代码,优化导入、类型提示及OCR后端管理
统一调整各文件模块导入路径为绝对导入
调整导入路径,移除部分导入,优化日志及注释
升级文档解析器为 Docx2Parser,优化超时与图片处理逻辑
2025-11-18 22:37:01 +08:00
begoniezhao c1f731e026 chore(docreader): 重新组织模块文件 2025-11-05 12:07:39 +08:00