fix: unify PaddleOCR env var names to match pipeline expectations (API_TOKEN/JOB_URL)

This commit is contained in:
Research Assistant 2026-04-23 00:57:48 +08:00
parent 270e1b8dc6
commit fd7ccb53fc
4 changed files with 15 additions and 12 deletions

View file

@ -72,8 +72,8 @@ ln -s "~/Zotero" "{vault_path}/99_System/Zotero"
创建 `{vault_path}/.env`:
```
PADDLEOCR_API_KEY=your_api_key_here
PADDLEOCR_API_URL=https://api.paddleocr.baidu.com/api/v1/ocr
PADDLEOCR_API_TOKEN=your_api_token_here
PADDLEOCR_JOB_URL=https://paddleocr.aistudio-app.com/api/v2/ocr/jobs
```
### Step 5: 部署脚本

View file

@ -278,8 +278,8 @@ def create_env_file(vault_path: Path, config: dict, paths: dict) -> None:
"# PaperForge Configuration",
f"ZOTERO_DATA_DIR={config['zotero_path']}",
f"ZOTERO_STORAGE_DIR={config.get('storage_path', config['zotero_path'])}",
f"PADDLEOCR_API_KEY={config['ocr_api_key']}",
"PADDLEOCR_API_URL=https://paddleocr.baidu.com/api/v1/ocr",
f"PADDLEOCR_API_TOKEN={config['ocr_api_key']}",
"PADDLEOCR_JOB_URL=https://paddleocr.aistudio-app.com/api/v2/ocr/jobs",
"",
"# Agent Configuration",
f"PAPERFORGE_AGENT={config['agent']}",

View file

@ -89,12 +89,12 @@ def validate_ocr_pipeline(vault_path: str) -> list[tuple[bool, str]]:
results.append((ok, msg))
if ok:
# Check if PADDLEOCR_API_KEY is set
env_content = env_path.read_text(encoding="utf-8")
if "PADDLEOCR_API_KEY" in env_content:
results.append((True, "[OK] PADDLEOCR_API_KEY configured in .env"))
# Check if PADDLEOCR_API_TOKEN is set
env_content = env_path.read_text(encoding='utf-8')
if "PADDLEOCR_API_TOKEN" in env_content:
results.append((True, "[OK] PADDLEOCR_API_TOKEN configured in .env"))
else:
results.append((False, "[FAIL] PADDLEOCR_API_KEY not found in .env"))
results.append((False, "[FAIL] PADDLEOCR_API_TOKEN not found in .env"))
# Check OCR pipeline directory
ocr_dir = vault_dir / "99_System" / "LiteraturePipeline" / "worker"

View file

@ -922,11 +922,14 @@ class DeployStep(StepScreen):
env_path = vault / ".env"
env_content = f"""# PaperForge 配置文件
# PaddleOCR API Key(从 https://paddleocr.baidu.com 获取)
PADDLEOCR_API_KEY={api_key}
# PaddleOCR API Token(从 https://paddleocr.baidu.com 获取)
PADDLEOCR_API_TOKEN={api_key}
# PaddleOCR API 地址
PADDLEOCR_API_URL={api_url}
PADDLEOCR_JOB_URL={api_url}
# PaddleOCR 模型(通常不需要修改)
PADDLEOCR_MODEL=PaddleOCR-VL-1.5
"""
env_path.write_text(env_content, encoding="utf-8")