feat: 实现多 OCR 提供商架构和完整设置页面

## 主要变更

### OCR 架构
- 新增多提供商 OCR 系统 (Tesseract.js, Baidu OCR, RapidOCR)
- 添加 Provider 基类接口和工厂模式
- 支持 provider 自动选择和降级处理
- 新增 RapidOCR Python HTTP 服务 (端口 8080)

### 路径修复
- 修复 Windows 平台路径解析问题
- 统一路径处理工具 (lib/path.ts)
- 修复 uploads 目录定位问题

### 设置页面重构
- 三个标签页:API 配置、OCR 配置、AI 配置
- API 服务器地址配置
- OCR 服务商配置(Tesseract.js, RapidOCR, 百度 OCR)
- AI 服务商配置(智谱 GLM, MiniMax, DeepSeek, Kimi, OpenAI, Anthropic)

### 端口配置
- 前端端口: 13056
- 后端端口: 13057

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
锦麟 王
2026-02-26 14:00:22 +08:00
parent 813df6c738
commit f8472987f0
23 changed files with 2321 additions and 275 deletions

View File

@@ -13,9 +13,27 @@ NODE_ENV="development"
CORS_ORIGIN="http://localhost:3000"
# OCR
OCR_PROVIDER="local"
# OCR Provider: tesseract | baidu | rapidocr | auto
# - tesseract: 本地轻量,需要安装 tesseract.js
# - baidu: 云端准确,需要配置 API Key (有免费额度)
# - rapidocr: 本地快速准确,需要启动 RapidOCR 服务
# - auto: 自动选择可用的 provider
OCR_PROVIDER="auto"
OCR_CONFIDENCE_THRESHOLD="0.3"
# Tesseract.js (本地 OCR无需额外配置)
# 安装: npm install tesseract.js
# Baidu OCR (云端 OCR需要申请密钥)
# 获取地址: https://cloud.baidu.com/product/ocr
BAIDU_OCR_API_KEY=""
BAIDU_OCR_SECRET_KEY=""
# RapidOCR (本地快速 OCR需要启动服务)
# Docker: docker run -d -p 8080:8080 cshgg/rapidocr
# 或参考: https://github.com/RapidAI/RapidOCR
RAPIDOCR_API_URL="http://localhost:8080"
# AI (GLM)
GLM_API_KEY=""
GLM_API_URL="https://open.bigmodel.cn/api/paas/v4/chat/completions"