From ce96a0e5272d6bcdf732dd0fc1ff8a9d9c834a0c Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Wed, 03 Jun 2026 15:00:58 +0800
Subject: [PATCH] Fix Round 4 model download QA issues

---
 privatevoice.src/internal/model/registry.go |  102 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 95 insertions(+), 7 deletions(-)

diff --git a/privatevoice.src/internal/model/registry.go b/privatevoice.src/internal/model/registry.go
index c9db604..3d305c3 100644
--- a/privatevoice.src/internal/model/registry.go
+++ b/privatevoice.src/internal/model/registry.go
@@ -6,7 +6,9 @@
 )
 
 const (
-	BackendSenseVoice = "sensevoice"
+	BackendSenseVoice     = "sensevoice"
+	BackendMoonshine      = "moonshine"
+	BackendNemoTransducer = "nemo_transducer"
 )
 
 var modelProfiles = map[string]ModelProfile{
@@ -26,6 +28,10 @@
 		},
 		RecommendedFor: []string{"zh-CN"},
 		Description:    "轻量中文模型,适合中文和中英混输。",
+		DownloadURLs: []string{
+			"http://www.maikami.com/voicesnap/sensevoice.zip",
+			"https://modelscope.cn/models/sherpa-onnx/sherpa-onnx-sense-voice-zh-en-ja-ko-yue/resolve/master/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-int8-2024-07-17.tar.bz2",
+		},
 		InstallDirName: "sensevoice-zh",
 		LegacyDirNames: []string{"sensevoice"},
 		RequiredFiles: []RequiredFileRule{
@@ -43,6 +49,87 @@
 		ProviderOrder: []string{"coreml", "cpu"},
 		NumThreads:    4,
 	},
+	MoonshineModelID: {
+		ID:                   MoonshineModelID,
+		DisplayName:          "Moonshine English",
+		BackendKind:          BackendMoonshine,
+		Tier:                 "default",
+		SupportedLanguageIDs: []string{EnglishLanguageID},
+		RecommendedFor:       []string{EnglishLanguageID},
+		Description:          "轻量英文离线模型,适合英文听写和英文日常输入。",
+		ApproxSize:           "约 239 MiB 下载包,解压后约 270-280 MiB",
+		DownloadURLs: []string{
+			"https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-moonshine-base-en-int8.tar.bz2",
+		},
+		InstallDirName: "moonshine-en",
+		RequiredFiles: []RequiredFileRule{
+			{
+				Role:     "preprocessor",
+				AllOf:    []string{"preprocess.onnx"},
+				Required: true,
+			},
+			{
+				Role:     "encoder",
+				AllOf:    []string{"encode.int8.onnx"},
+				Required: true,
+			},
+			{
+				Role:     "uncached_decoder",
+				AllOf:    []string{"uncached_decode.int8.onnx"},
+				Required: true,
+			},
+			{
+				Role:     "cached_decoder",
+				AllOf:    []string{"cached_decode.int8.onnx"},
+				Required: true,
+			},
+			{
+				Role:     "tokens",
+				AllOf:    []string{"tokens.txt"},
+				Required: true,
+			},
+		},
+		ProviderOrder: []string{"cpu"},
+		NumThreads:    4,
+	},
+	ParakeetModelID: {
+		ID:                   ParakeetModelID,
+		DisplayName:          "Parakeet English",
+		BackendKind:          BackendNemoTransducer,
+		Tier:                 "advanced",
+		SupportedLanguageIDs: []string{EnglishLanguageID},
+		RecommendedFor:       []string{EnglishLanguageID},
+		Description:          "高质量英文离线模型,适合英文长句、技术词和更高准确率需求。",
+		ApproxSize:           "约 478 MiB 下载包",
+		DownloadURLs: []string{
+			"https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-nemo-parakeet-unified-en-0.6b-int8-non-streaming.tar.bz2",
+		},
+		InstallDirName: "parakeet-en",
+		RequiredFiles: []RequiredFileRule{
+			{
+				Role:     "encoder",
+				AllOf:    []string{"encoder.int8.onnx"},
+				Required: true,
+			},
+			{
+				Role:     "decoder",
+				AllOf:    []string{"decoder.int8.onnx"},
+				Required: true,
+			},
+			{
+				Role:     "joiner",
+				AllOf:    []string{"joiner.int8.onnx"},
+				Required: true,
+			},
+			{
+				Role:     "tokens",
+				AllOf:    []string{"tokens.txt"},
+				Required: true,
+			},
+		},
+		ProviderOrder: []string{"cpu"},
+		NumThreads:    4,
+	},
 }
 
 var languageProfiles = map[string]LanguageProfile{
@@ -55,12 +142,13 @@
 		DefaultModelID: DefaultModelID,
 	},
 	EnglishLanguageID: {
-		ID:             EnglishLanguageID,
-		DisplayName:    "English",
-		NativeName:     "English",
-		UILocale:       "en",
-		SystemMatchers: []string{"en", "en-US", "en-GB", "en-AU", "en-CA"},
-		DefaultModelID: DefaultModelID,
+		ID:              EnglishLanguageID,
+		DisplayName:     "English",
+		NativeName:      "English",
+		UILocale:        "en",
+		SystemMatchers:  []string{"en", "en-US", "en-GB", "en-AU", "en-CA"},
+		DefaultModelID:  MoonshineModelID,
+		UpgradeModelIDs: []string{ParakeetModelID},
 	},
 }
 

--
Gitblit v1.9.3