From 35f7ccfbc29b322306983bf800c120ba816e3e8e Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Wed, 03 Jun 2026 14:30:11 +0800
Subject: [PATCH] Add Round 4 Parakeet planning docs
---
privatevoice.src/internal/model/registry.go | 86 ++++++++++++++++++++++++++++++++++++++++--
1 files changed, 81 insertions(+), 5 deletions(-)
diff --git a/privatevoice.src/internal/model/registry.go b/privatevoice.src/internal/model/registry.go
index 9314941..8740133 100644
--- a/privatevoice.src/internal/model/registry.go
+++ b/privatevoice.src/internal/model/registry.go
@@ -1,9 +1,13 @@
package model
-import "fmt"
+import (
+ "fmt"
+ "sort"
+)
const (
BackendSenseVoice = "sensevoice"
+ BackendMoonshine = "moonshine"
)
var modelProfiles = map[string]ModelProfile{
@@ -23,6 +27,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{
@@ -40,15 +48,67 @@
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,
+ },
}
var languageProfiles = map[string]LanguageProfile{
- "zh-CN": {
- ID: "zh-CN",
- DisplayName: "中文",
- UILocale: "zh-CN",
+ DefaultLanguageID: {
+ ID: DefaultLanguageID,
+ DisplayName: "Chinese",
+ NativeName: "中文",
+ UILocale: "zh",
SystemMatchers: []string{"zh", "zh-CN", "zh-Hans", "zh-Hant"},
DefaultModelID: DefaultModelID,
+ },
+ EnglishLanguageID: {
+ ID: EnglishLanguageID,
+ DisplayName: "English",
+ NativeName: "English",
+ UILocale: "en",
+ SystemMatchers: []string{"en", "en-US", "en-GB", "en-AU", "en-CA"},
+ DefaultModelID: MoonshineModelID,
},
}
@@ -95,5 +155,21 @@
for _, profile := range languageProfiles {
profiles = append(profiles, profile)
}
+ sort.Slice(profiles, func(i, j int) bool {
+ if profiles[i].ID == DefaultLanguageID {
+ return true
+ }
+ if profiles[j].ID == DefaultLanguageID {
+ return false
+ }
+ return profiles[i].ID < profiles[j].ID
+ })
return profiles
}
+
+func NormalizeLanguageID(id string) string {
+ if _, err := GetLanguageProfile(id); err != nil {
+ return DefaultLanguageID
+ }
+ return id
+}
--
Gitblit v1.9.3