Skip to content

Fix Sherpa local ASR state sync#523

Open
weikeyi wants to merge 2 commits into
Open-Less:betafrom
weikeyi:fix/sherpa-local-asr-state-sync-v2
Open

Fix Sherpa local ASR state sync#523
weikeyi wants to merge 2 commits into
Open-Less:betafrom
weikeyi:fix/sherpa-local-asr-state-sync-v2

Conversation

@weikeyi
Copy link
Copy Markdown
Contributor

@weikeyi weikeyi commented May 22, 2026

User description

摘要

  • 在设置变更和 Windows 启动时,将持久化的 active ASR provider 同步到后端运行时的 credentials vault,避免前端偏好与实际听写 provider 状态不一致。
  • 让 Sherpa ONNX catalog/download 状态与已解压的 release archive 资源保持一致,包括 Qwen3 tokenizer/ 目录校验和 downloadedBytes 统计。
  • 更新前端 Sherpa ONNX 状态展示与删除可用性:Overview 会在 ASR/LLM provider 变化时刷新 credentials 状态,Sherpa 模型存在部分下载或已解压资源时允许删除。
  • 已基于最新 beta 解决设置页重构冲突:旧 Settings.tsx 不再进入本 PR,新版 settings/ProvidersSection.tsx 中已包含 sherpa-onnx-local 的本地 provider 识别逻辑。

验证

  • git diff --check upstream/beta...HEAD
  • cargo check --manifest-path openless-all/app/src-tauri/Cargo.toml
  • npm run build
  • cargo test --manifest-path openless-all/app/src-tauri/Cargo.toml sherpa --lib -- --nocapture
  • cargo test --manifest-path openless-all/app/src-tauri/Cargo.toml persist_settings --lib -- --nocapture

PR Type

Bug fix, Enhancement, Tests


Description

  • Sync active ASR provider on save/startup

  • Verify extracted Sherpa assets and bytes

  • Refresh credentials on provider changes

  • Expand deletion logic and API typings


Diagram Walkthrough

flowchart LR
  prefs["User preferences"] -- "save/startup sync" --> vault["Credentials vault"]
  vault -- "active ASR provider" --> runtime["ASR runtime"]
  archive["Sherpa release archive"] -- "download/verify/extract" --> cache["Local model cache"]
  cache -- "catalog snapshot" --> ui["Local ASR / Overview UI"]
Loading

File Walkthrough

Relevant files
Enhancement
4 files
sherpa.rs
Treat tokenizer as a directory asset                                         
+15/-1   
sherpa_runtime.rs
Track Sherpa cache and download bytes                                       
+9/-2     
coordinator.rs
Add credentials vault provider sync helpers                           
+10/-0   
localAsr.ts
Update Sherpa API shapes and mocks                                             
+20/-18 
Bug fix
5 files
sherpa_download.rs
Verify archives and count extracted bytes                               
+114/-24
commands.rs
Sync active ASR provider during save                                         
+138/-2 
lib.rs
Restore provider state during startup                                       
+4/-0     
LocalAsr.tsx
Allow deleting partial Sherpa downloads                                   
+5/-2     
Overview.tsx
Refresh credentials after provider changes                             
+11/-2   

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 22, 2026

PR Reviewer Guide 🔍

(Review updated until commit cd9696d)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Incomplete dir check

The special case for qwen3-asr-0.6b-int8 only checks path.is_dir(), so any empty or partially extracted tokenizer/ directory is treated as valid. That can mark a broken install as cached and allow the UI/download logic to skip re-downloading even though the model is unusable.

fn required_path_is_dir(alias: &str, required: &str) -> bool {
    matches!((alias, required), ("qwen3-asr-0.6b-int8", "tokenizer"))
}

@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit cd9696d

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant