feat(mac): add Qwen3 MLX streaming dictation

Replace the Sherpa offline pipeline with native MLX streaming, resilient model downloads, live transcript previews, and supporting tests and documentation.
This commit is contained in:
Rocky
2026-07-23 14:34:56 +08:00
parent f1a811fbf0
commit c0c9dad149
35 changed files with 1373 additions and 764 deletions
@@ -16,24 +16,43 @@ final class LocalASRDownloadSourceSorterTests: XCTestCase {
)
}
func testChinaMainlandPrefersModelScope() {
func testChinaMainlandPrefersHFMirror() {
let sources = [
source("github"),
source("huggingface"),
source("hfmirror"),
source("modelscope"),
]
let sorted = LocalASRDownloadSourceSorter.sorted(sources, region: Locale.Region("CN"))
XCTAssertEqual(sorted.map(\.type), ["modelscope", "huggingface", "github"])
XCTAssertEqual(sorted.map(\.type), ["hfmirror", "huggingface", "modelscope", "github"])
}
func testGlobalPrefersHuggingFace() {
let sources = [
source("github"),
source("huggingface"),
source("hfmirror"),
source("modelscope"),
]
let sorted = LocalASRDownloadSourceSorter.sorted(sources, region: Locale.Region("US"))
XCTAssertEqual(sorted.map(\.type), ["huggingface", "github", "modelscope"])
XCTAssertEqual(sorted.map(\.type), ["huggingface", "hfmirror", "github", "modelscope"])
}
func testUnknownRegionFallsBackToMirror() {
let sources = [source("huggingface"), source("hfmirror")]
let sorted = LocalASRDownloadSourceSorter.sorted(sources, region: nil)
XCTAssertEqual(sorted.map(\.type), ["hfmirror", "huggingface"])
}
func testManualPreferenceOverridesRegion() {
let sources = [source("hfmirror"), source("huggingface")]
// Even in China, an explicit HF preference wins.
let sorted = LocalASRDownloadSourceSorter.sorted(
sources,
region: Locale.Region("CN"),
preferred: .huggingface
)
XCTAssertEqual(sorted.map(\.type), ["huggingface", "hfmirror"])
}
func testSameTypeUsesPriority() {