lllin000_PaperForge/command/lp-ocr.md
Research Assistant 2a3295ed38 feat(02-03): add ocr doctor CLI dispatch, tests, and docs
- Convert ocr parser to sub-subcommands (run, doctor)
- Add _cmd_ocr_doctor() with formatted tiered report output
- Update dispatch logic to route ocr doctor subcommand
- Add CLI dispatch test for doctor command
- Update command/lp-ocr.md with doctor documentation
2026-04-23 12:59:04 +08:00

43 lines
1 KiB
Markdown

# /lp-ocr
处理 library-records 中 `do_ocr: true` 的 PDF OCR 队列。
## Command
```bash
paperforge ocr run
```
## 说明
`paperforge ocr run` 会自动读取 `paperforge.json` 定位 ocr 目录和 worker 脚本。
如需使用 Python 直接调用(备选方式):
```bash
python $(paperforge paths --json | python -c "import json,sys; print(json.load(sys.stdin)['worker_script'])") --vault . ocr
```
## OCR Doctor
Validate OCR configuration before queueing jobs:
```bash
paperforge ocr doctor
```
Run full diagnostics including live PDF test:
```bash
paperforge ocr doctor --live
```
### Diagnostic Levels
| Level | Check | Failure Meaning |
|-------|-------|-----------------|
| L1 | API token presence | `PADDLEOCR_API_TOKEN` missing or empty |
| L2 | URL reachability | Cannot connect to PaddleOCR service |
| L3 | API schema validation | Service reachable but response format unexpected |
| L4 | Live PDF round-trip | Full submission and result retrieval fails |
Exit code `0` = all checks passed. Exit code `1` = at least one check failed.