Ariver
2026-06-03 b94a79dc7c9cfcdf72605289d0b89e85238c7d02
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
package model
 
import (
    "fmt"
    "sort"
)
 
const (
    BackendSenseVoice     = "sensevoice"
    BackendMoonshine      = "moonshine"
    BackendNemoTransducer = "nemo_transducer"
    BackendQwen3ASR       = "qwen3_asr"
)
 
var modelProfiles = map[string]ModelProfile{
    DefaultModelID: {
        ID:          DefaultModelID,
        DisplayName: "SenseVoice",
        BackendKind: BackendSenseVoice,
        Tier:        "default",
        SupportedLanguageIDs: []string{
            "zh-CN",
            "zh-Hans",
            "zh-Hant",
            "yue",
            "en",
            "ja",
            "ko",
        },
        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{
            {
                Role:     "model",
                AnyOf:    []string{"model.int8.onnx", "model.onnx"},
                Required: true,
            },
            {
                Role:     "tokens",
                AllOf:    []string{"tokens.txt"},
                Required: true,
            },
        },
        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,
    },
    Qwen3ASRModelID: {
        ID:                   Qwen3ASRModelID,
        DisplayName:          "Qwen3-ASR",
        BackendKind:          BackendQwen3ASR,
        Tier:                 "advanced",
        SupportedLanguageIDs: []string{DefaultLanguageID, "zh-Hans", "zh-Hant", "yue"},
        RecommendedFor:       []string{DefaultLanguageID},
        Description:          "高质量中文离线模型,适合中文长句、技术词和中英混输准确率需求。",
        ApproxSize:           "约 838 MiB 下载包,解压后约 1.9 GiB",
        DownloadURLs: []string{
            "https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-qwen3-asr-0.6B-int8-2026-03-25.tar.bz2",
        },
        InstallDirName: "qwen3-asr-0.6b",
        RequiredFiles: []RequiredFileRule{
            {
                Role:     "conv_frontend",
                AllOf:    []string{"conv_frontend.onnx"},
                Required: true,
            },
            {
                Role:     "encoder",
                AllOf:    []string{"encoder.int8.onnx"},
                Required: true,
            },
            {
                Role:     "decoder",
                AllOf:    []string{"decoder.int8.onnx"},
                Required: true,
            },
            {
                Role:      "tokenizer",
                AllOf:     []string{"tokenizer"},
                Required:  true,
                Directory: true,
            },
            {
                Role:     "tokenizer_merges",
                AllOf:    []string{"tokenizer/merges.txt"},
                Required: true,
            },
            {
                Role:     "tokenizer_vocab",
                AllOf:    []string{"tokenizer/vocab.json"},
                Required: true,
            },
        },
        ProviderOrder: []string{"cpu"},
        NumThreads:    4,
    },
}
 
var languageProfiles = map[string]LanguageProfile{
    DefaultLanguageID: {
        ID:              DefaultLanguageID,
        DisplayName:     "Chinese",
        NativeName:      "中文",
        UILocale:        "zh",
        SystemMatchers:  []string{"zh", "zh-CN", "zh-Hans", "zh-Hant"},
        DefaultModelID:  DefaultModelID,
        UpgradeModelIDs: []string{Qwen3ASRModelID},
    },
    EnglishLanguageID: {
        ID:              EnglishLanguageID,
        DisplayName:     "English",
        NativeName:      "English",
        UILocale:        "en",
        SystemMatchers:  []string{"en", "en-US", "en-GB", "en-AU", "en-CA"},
        DefaultModelID:  MoonshineModelID,
        UpgradeModelIDs: []string{ParakeetModelID},
    },
}
 
func GetModelProfile(id string) (ModelProfile, error) {
    if id == "" {
        id = DefaultModelID
    }
    profile, ok := modelProfiles[id]
    if !ok {
        return ModelProfile{}, fmt.Errorf("unknown model profile: %s", id)
    }
    return profile, nil
}
 
func DefaultModelProfile() ModelProfile {
    return modelProfiles[DefaultModelID]
}
 
func ListModelProfiles() []ModelProfile {
    profiles := make([]ModelProfile, 0, len(modelProfiles))
    for _, profile := range modelProfiles {
        profiles = append(profiles, profile)
    }
    return profiles
}
 
func NormalizeModelID(id string) string {
    if _, err := GetModelProfile(id); err != nil {
        return DefaultModelID
    }
    return id
}
 
func GetLanguageProfile(id string) (LanguageProfile, error) {
    profile, ok := languageProfiles[id]
    if !ok {
        return LanguageProfile{}, fmt.Errorf("unknown language profile: %s", id)
    }
    return profile, nil
}
 
func ListLanguageProfiles() []LanguageProfile {
    profiles := make([]LanguageProfile, 0, len(languageProfiles))
    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
}