refactor: 重构为纯云端版本,移除所有本地ML库依赖

重大更改:
1. requirements.txt - 移除 paddleocr/paddlepaddle,使用纯 API 版本
2. src/core/ocr.py - 完全重写
   - 移除 PaddleOCREngine 和 ensure_paddleocr()
   - 移除 numpy 依赖(不再需要)
   - 实现完整的 CloudOCREngine
   - 支持百度/腾讯/阿里云 OCR API
   - 添加自定义 API 支持
3. src/config/settings.py - 简化 OCR 配置
   - OCRMode 枚举仅保留 CLOUD
   - OCRConfig 添加 provider 字段
4. src/core/__init__.py - 移除 PaddleOCREngine 导出
5. src/gui/main_window.py - 移除 ensure_paddleocr 导入
6. build.bat/build.sh - 简化构建参数
   - 移除所有 ML 库的 --exclude-module
   - 移除 pyi_hooks 依赖
   - 添加 openai/anthropic hidden-import

测试:
- ✓ 所有核心模块导入成功
- ✓ 没有 PaddleOCR 相关错误

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
congsh
2026-02-12 13:42:46 +08:00
parent 6fc126b0fe
commit 313e1f40d8
7 changed files with 312 additions and 351 deletions

View File

@@ -21,7 +21,6 @@ from PyQt6.QtWidgets import (
)
from PyQt6.QtCore import Qt, QSize, pyqtSignal, QThread, QTimer
from PyQt6.QtGui import QIcon, QShortcut, QKeySequence
from src.core.ocr import ensure_paddleocr
from src.gui.styles import ThemeStyles
from src.gui.widgets import (
@@ -349,8 +348,8 @@ class MainWindow(QMainWindow):
# OCR 配置卡片
ocr_card = self._create_card("""
<h3>🔍 OCR 配置</h3>
<p>选择本地或云端 OCR 服务。</p>
<p>本地PaddleOCR | 云端:自定义 API</p>
<p>配置云端 OCR 服务。</p>
<p>支持:百度 OCR、腾讯云 OCR、阿里云 OCR、自定义 API</p>
""")
scroll_layout.addWidget(ocr_card)