Skip to content

fix: correct Sparkle minimum system version#51

Merged
hubo1989 merged 12 commits into
mainfrom
feat/paddleocr-vlm-provider
Mar 2, 2026
Merged

fix: correct Sparkle minimum system version#51
hubo1989 merged 12 commits into
mainfrom
feat/paddleocr-vlm-provider

Conversation

@hubo1989
Copy link
Copy Markdown
Owner

@hubo1989 hubo1989 commented Mar 2, 2026

Fix minimumSystemVersion from 26.0 to 14.0 so Sparkle can detect updates correctly.

Summary by CodeRabbit

发行说明

  • 新功能

    • 添加 MLX-VLM 后端支持,用于 PaddleOCR,包括服务器配置和本地模型目录选项。
    • 新增 MLX-VLM 服务器状态检查和刷新功能。
  • Bug 修复

    • 改进了汉字及 CJK 文本的检测和识别精度。
    • 增强了屏幕录制权限验证流程。
  • 文档

    • 补充了 MLX-VLM 相关的本地化字符串。
  • Chores

    • 调整部署目标至 macOS 14.0,扩展系统兼容性。

Hubert and others added 12 commits February 28, 2026 14:13
- Add PaddleOCRVLMProvider implementing VLMProviderProtocol
- Support two modes:
  - Fast mode: paddleocr ocr command (~1s)
  - Precise mode: paddleocr doc_parser VL-1.5 (~12s)
- Add PaddleOCRMode enum with settings UI
- Add cloud API configuration options (baseURL, API key)
- Fix JSON parsing for numpy arrays and float formats
- Update localization (en/zh-Hans)
- Fix screen recording permission check using SCShareableContent

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Remove redundant raw values from PaddleOCRMode enum
- Add PaddleOCR settings reset in resetToDefaults()
- Remove redundant MainActor.run wrapper in SettingsViewModel
- Add static defaultBaseURL constant to avoid force unwrap
- Add CJK-aware separator in merged(with:) for proper spacing
- Replace window counting heuristic with async SCShareableContent check in OnboardingViewModel

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- testPaddleOCRConnection: check cloud mode first with URL/API validation
- checkPermissions: use permissionCheckTask to avoid race conditions
- paddleOCRCloudAPIKey: store in Keychain instead of UserDefaults
- analyze(image:): check PaddleOCREngine availability only for local mode
- isAvailable: mode-aware check (cloud checks URL, local checks installation)
- weightedConfidence: handle divide-by-zero edge case

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Fix concurrency violation: capture paddleOCRCloudAPIKey before Task.detached
- Extract Keychain constants: add serviceIdentifier and paddleOCRAccount to KeychainService
- Fix CJK separator: check last char of first string and first char of second string
- Update AppSettings to use shared KeychainService constants

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Add paddleOCRUseMLXVLM, paddleOCRMLXVLMServerURL, paddleOCRMLXVLMModelName settings
- Update PaddleOCREngine.Configuration with MLX-VLM fields
- Add --vl_rec_backend, --vl_rec_server_url, --vl_rec_api_model_name args
- Add UI settings (visible when precise mode and not using cloud)
- Add English and Chinese localizations

Usage:
1. Install: pip install "mlx-vlm>=0.3.11"
2. Start server: mlx_vlm.server --port 8111
3. Enable in Settings > PaddleOCR > Use MLX-VLM

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Add isMLXVLMServerRunning and isCheckingMLXVLMServer state
- Add checkMLXVLMServerStatus() method to verify server connectivity
- Add UI with status indicator and refresh button
- Add English and Chinese localizations for status messages

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Add MLX-VLM check in refreshPaddleOCRStatus()
- Add onAppear handler in PaddleOCRStatusSection

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Keys should not include format specifier %@

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Add localVLModelDir configuration to PaddleOCREngine.Configuration
- Support native backend with --vl_rec_model_dir when MLX-VLM is disabled
- Add UI input field for local model directory (shows when MLX-VLM unchecked in precise mode)
- Fix error message to show correct model info based on provider type
- Fix localization key from error.ocr.recognition.failed to error.ocr.failed
- Add localization strings for local model directory in EN/CN

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Fix ScreenDetector.hasPermission to use SCShareableContent.current
- Fix health-check to only accept 2xx responses (not <500)
- Add error logging for keychain deletion failures
- Remove no-op replacingOccurrences in PaddleOCREngine
- Add tilde expansion for localVLModelDir path
- Localize PaddleOCR not installed error message
- Extend isCJKChar with CJK punctuation, fullwidth forms, extensions B-F
- Extract saveCredentialsInternal helper to eliminate duplicate keychain logic

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Sparkle was unable to detect updates because minimumSystemVersion was
set to 26.0, which doesn't exist. Changed to macOS 14.0 (Sonoma).

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@hubo1989 hubo1989 merged commit 87928b7 into main Mar 2, 2026
1 check was pending
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 2, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc5ff5c and a90a94e.

📒 Files selected for processing (13)
  • .github/workflows/release.yml
  • .omd/project-memory.json
  • .omd/sessions/0c203f54-c10d-4417-8115-005c18e9036b.json
  • ScreenTranslate/Features/Capture/ScreenDetector.swift
  • ScreenTranslate/Features/Settings/EngineSettingsTab.swift
  • ScreenTranslate/Features/Settings/SettingsViewModel.swift
  • ScreenTranslate/Features/TranslationFlow/TranslationFlowController.swift
  • ScreenTranslate/Models/AppSettings.swift
  • ScreenTranslate/Resources/en.lproj/Localizable.strings
  • ScreenTranslate/Resources/zh-Hans.lproj/Localizable.strings
  • ScreenTranslate/Services/PaddleOCREngine.swift
  • ScreenTranslate/Services/PaddleOCRVLMProvider.swift
  • ScreenTranslate/Services/Security/KeychainService.swift

📝 Walkthrough

概览

本次更改引入了MLX-VLM后端支持以优化Apple Silicon性能,涵盖UI设置、配置管理、服务层集成和本地化更新。同时调整了macOS最低系统版本、改进了屏幕权限验证逻辑、重构了凭证存储机制,并添加了项目元数据文件。

变更

内聚体 / 文件 摘要
发布与部署配置
.github/workflows/release.yml
macOS部署目标从26.0降低至14.0,包括Xcode构建步骤和Sparkle appcast的minimumSystemVersion
项目元数据
.omd/project-memory.json, .omd/sessions/...
新增项目内存快照和会话记录文件,用于工具驱动的项目导航和状态追踪
屏幕权限管理
ScreenTranslate/Features/Capture/ScreenDetector.swift
将单步权限检查重构为两阶段验证:先执行CGPreflight快速检查,再通过SCShareableContent实际访问确认权限,并增强了日志记录
MLX-VLM UI设置
ScreenTranslate/Features/Settings/EngineSettingsTab.swift
在PaddleOCR设置下添加MLX-VLM集成UI,支持切换本地/服务器后端,包括服务器状态检查、URL配置和模型名称设置
设置视图模型
ScreenTranslate/Features/Settings/SettingsViewModel.swift
添加MLX-VLM相关属性绑定(useMLXVLM、serverURL、modelName、localVLModelDir)和异步服务器状态检查方法,支持自动状态刷新
应用设置持久化
ScreenTranslate/Models/AppSettings.swift
新增四个MLX-VLM配置属性,包括初始化、重置逻辑及UserDefaults存储管理
错误处理流程
ScreenTranslate/Features/TranslationFlow/TranslationFlowController.swift
增强分析失败时的错误详情构建,根据OCR提供程序类型和MLX-VLM启用状态条件地包含模型信息
PaddleOCR引擎后端
ScreenTranslate/Services/PaddleOCREngine.swift
扩展Configuration结构体以支持MLX-VLM和本地VL模型,修改precise模式的参数构建逻辑支持多后端选择,更新错误消息键
VLM提供程序集成
ScreenTranslate/Services/PaddleOCRVLMProvider.swift
将硬编码错误字符串国际化,扩展配置以传递MLX-VLM选项,增强CJK字符检测以支持更宽泛的Unicode范围以改进行分组
凭证存储重构
ScreenTranslate/Services/Security/KeychainService.swift
引入saveCredentialsInternal内部辅助方法集中化凭证持久化逻辑,统一日志记录以使用标签而非引擎标识符
本地化字符串
ScreenTranslate/Resources/*/Localizable.strings
添加MLX-VLM相关UI文本的新本地化键(英文和简体中文),重构translationFlow错误键将格式符从键名移至值中

序列图

sequenceDiagram
    participant User as 用户
    participant Settings as SettingsViewModel
    participant Engine as PaddleOCREngine
    participant Server as MLX-VLM服务器
    participant Status as UI(状态)

    User->>Settings: 启用paddleOCRUseMLXVLM
    Settings->>Settings: 触发checkMLXVLMServerStatus()
    Settings->>Engine: 获取mlxVLMServerURL
    Settings->>Server: 发送HTTP ping请求(3s超时)
    alt 服务器响应
        Server-->>Settings: 200 OK
        Settings->>Settings: isMLXVLMServerRunning = true
        Settings->>Status: 更新UI:运行中
    else 连接失败/超时
        Settings->>Settings: isMLXVLMServerRunning = false
        Settings->>Status: 更新UI:离线
    end
    Settings->>Settings: isCheckingMLXVLMServer = false
    Status-->>User: 显示服务器状态
Loading

预估代码审查工作量

🎯 4 (复杂) | ⏱️ ~45 分钟

可能相关的PR

🐰 MLX-VLM闪闪发光,Apple Silicon翼下翔,
权限检查两步走,凭证存储焕新装。
本地云端任君选,翻译引擎更强劲✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/paddleocr-vlm-provider

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant