refactor: 升级OCR依赖与适配rapidocr v3+,补充业务字段展示

主要变更:
1. 统一替换rapidocr-onnxruntime为rapidocr+onnxruntime依赖包
2. 适配rapidocr v3+ API变更:调整OCR结果解析逻辑
3. 补充展示员工岗位信息到OA审批通知
4. 优化OA详情链接格式为Markdown可点击样式
5. 修复OCR图片EXIF旋转问题与文件名解码
6. 新增RPA开发提成评分规则文档
7. 重构OA登录入口参数,简化调用逻辑
8. 删除临时测试脚本
This commit is contained in:
2026-08-27 13:32:48 +08:00
parent 76d7459515
commit 05842f36d5
12 changed files with 209 additions and 158 deletions
+6 -6
View File
@@ -22,7 +22,7 @@
依赖(影刀「Python包管理」安装;启动校验不懒加载):
pip install pyautogui pywin32 pyperclip psutil
pip install Pillow numpy rapidocr-onnxruntime
pip install Pillow numpy rapidocr onnxruntime
入口:
main(messages) 影刀自定义指令调用入口,直接传列表,每项为 (search_keyword, text, verify_keyword) 元组:
@@ -58,13 +58,13 @@ try:
import psutil
from PIL import Image, ImageGrab
import numpy as np
from rapidocr_onnxruntime import RapidOCR
from rapidocr import RapidOCR
except ImportError as _import_err:
raise RuntimeError(
"缺少必需依赖,无法启动(钉钉推送指令要求所有库在启动前装齐,不懒加载)。\n"
"请先执行安装:\n"
" pip install pyautogui pywin32 pyperclip psutil\n"
" pip install Pillow numpy rapidocr-onnxruntime\n"
" pip install Pillow numpy rapidocr onnxruntime\n"
f"缺失依赖详情: {_import_err}"
)
@@ -379,10 +379,10 @@ def _dt_ocr_image(img):
if img is None:
return []
img_np = np.array(img)
result, _ = _dt_get_ocr()(img_np)
result = _dt_get_ocr()(img_np)
ocr_data = []
if result is not None:
for box, text, score in result:
if result is not None and result.boxes is not None:
for box, text, score in zip(result.boxes, result.txts, result.scores):
xs = [p[0] for p in box]
ys = [p[1] for p in box]
x1, y1 = min(xs), min(ys)
+5 -8
View File
@@ -32,8 +32,8 @@
pip install DrissionPage requests python-dotenv
入口:
main(args) 影刀自定义指令调用入口,args 传 {"force": true|false},返回 JSON 安全 dict
python oa_login.py 独立运行(等价于 main({"force": true}))
main(force=True) 影刀自定义指令调用入口,force 传 True/False(是否强制重新登录),返回 JSON 安全 dict
python oa_login.py 独立运行(等价于 main(force=True))
"""
import os
import json
@@ -221,15 +221,12 @@ def ensure_login(force=False):
# ================== 影刀自定义指令入口 ==================
def main(args):
def main(force=True):
"""
影刀自定义指令「37duOA登录」调用入口。
args: dict,可选字段 force(bool) 是否强制重新登录
force: bool 是否强制重新登录(默认 True,便于本地独立运行直接刷新登录态)
返回: dict {success, cookie_path, message, relogin}
"""
if not args:
args = {}
force = bool(args.get("force", False))
try:
return ensure_login(force=force)
except Exception as e:
@@ -238,5 +235,5 @@ def main(args):
if __name__ == "__main__":
result = main({"force": True})
result = main(force=True)
print("最终结果:", result)