feat: add explicit managed model download sources

Managed speech and OCR downloads previously used catalog-specific source URLs without a global selection. Platform Features now lets users choose ModelScope by default or Hugging Face, while Main validates and freezes that source for each download.

Verified coverage remains explicit: downloads never mix artifacts or silently switch sources, and installed models plus ZIP imports stay source-independent.

Release note: 可在“设置 → 平台功能 → 通用设置”中选择 ModelScope 或 Hugging Face 作为后续语音输入与 OCR 模型下载源;缺少完整已验证文件或下载失败时不会静默换源。
This commit is contained in:
mesalogo
2026-08-19 13:43:16 +08:00
parent c41d7e8b96
commit 43e1d162dc
44 changed files with 6083 additions and 839 deletions
+214 -155
View File
@@ -2,11 +2,33 @@ import {
speechModelCatalogEntrySchema,
type SpeechModelCatalogEntry
} from '../../shared/speech-model-contracts'
import {
huggingFaceTarget,
modelScopeTarget
} from '../model-download-targets'
const senseVoiceModelScopeRepository =
'pengzhendong/sherpa-onnx-sense-voice-zh-en-ja-ko-yue'
const senseVoiceModelScopeRevision =
'73eca47697f980daa3d16112404174b6b950b514'
const senseVoiceHuggingFaceRepository =
'csukuangfj/sherpa-onnx-sense-voice-zh-en-ja-ko-yue-2024-07-17'
const senseVoiceHuggingFaceRevision =
'2365baeacb507f821a0c8120fcee3d484dba7a07'
const whisperTinyModelScopeRepository =
'pengzhendong/sherpa-onnx-whisper-tiny'
const whisperTinyModelScopeRevision =
'33a655645234f82ce833cf27b689d9c2212e693f'
const whisperTinyHuggingFaceRepository =
'csukuangfj/sherpa-onnx-whisper-tiny'
const whisperTinyHuggingFaceRevision =
'65176e2deb88badc814a94058666cadccc29b61c'
/**
* This catalog intentionally contains metadata only. Model weights are never
* bundled with GoodBuddy. Entries remain manual-only until every downloadable
* file has a pinned revision, byte size, and independently verified SHA-256.
* Model weights are never bundled with GoodBuddy. Canonical file identity is
* source-independent; a source target is included only after its bytes match
* the declared size and SHA-256.
*/
export const SPEECH_MODEL_CATALOG: readonly SpeechModelCatalogEntry[] =
speechModelCatalogEntrySchema.array().parse([
@@ -21,13 +43,16 @@ export const SPEECH_MODEL_CATALOG: readonly SpeechModelCatalogEntry[] =
quality: 'high',
speed: 'fast',
recommended: true,
repositoryUrl:
'https://modelscope.cn/models/pengzhendong/' +
'sherpa-onnx-sense-voice-zh-en-ja-ko-yue',
repositoryUrls: {
modelscope:
`https://modelscope.cn/models/${senseVoiceModelScopeRepository}`,
'hugging-face':
`https://huggingface.co/${senseVoiceHuggingFaceRepository}`
},
license: {
name: '模型仓库自定义许可(Model License',
notice:
'SenseVoiceSmall 权重采用模型仓库声明的自定义 MODEL LICENSE,并非 Apache-2.0 或 MIT;导入和使用前请阅读完整许可条款。',
'SenseVoiceSmall 权重采用上游声明的自定义 MODEL LICENSE,并非 Apache-2.0 或 MIT;导入和使用前请阅读完整许可条款。',
url: 'https://github.com/modelscope/FunASR/blob/main/MODEL_LICENSE'
},
manualOnly: false,
@@ -35,29 +60,39 @@ export const SPEECH_MODEL_CATALOG: readonly SpeechModelCatalogEntry[] =
{
name: 'model.int8.onnx',
role: 'model',
download: {
url:
'https://modelscope.cn/models/pengzhendong/' +
'sherpa-onnx-sense-voice-zh-en-ja-ko-yue/' +
'resolve/73eca47697f980daa3d16112404174b6b950b514/' +
'model.int8.onnx',
size: 239_233_841,
sha256:
'c71f0ce00bec95b07744e116345e33d8cbbe08cef896382cf907bf4b51a2cd51'
size: 239_233_841,
sha256:
'c71f0ce00bec95b07744e116345e33d8cbbe08cef896382cf907bf4b51a2cd51',
targets: {
modelscope: modelScopeTarget(
senseVoiceModelScopeRepository,
senseVoiceModelScopeRevision,
'model.int8.onnx'
),
'hugging-face': huggingFaceTarget(
senseVoiceHuggingFaceRepository,
senseVoiceHuggingFaceRevision,
'model.int8.onnx'
)
}
},
{
name: 'tokens.txt',
role: 'tokens',
download: {
url:
'https://modelscope.cn/models/pengzhendong/' +
'sherpa-onnx-sense-voice-zh-en-ja-ko-yue/' +
'resolve/73eca47697f980daa3d16112404174b6b950b514/' +
'tokens.txt',
size: 315_894,
sha256:
'f449eb28dc567533d7fa59be34e2abca8784f771850c78a47fb731a31429a1dc'
size: 315_894,
sha256:
'f449eb28dc567533d7fa59be34e2abca8784f771850c78a47fb731a31429a1dc',
targets: {
modelscope: modelScopeTarget(
senseVoiceModelScopeRepository,
senseVoiceModelScopeRevision,
'tokens.txt'
),
'hugging-face': huggingFaceTarget(
senseVoiceHuggingFaceRepository,
senseVoiceHuggingFaceRevision,
'tokens.txt'
)
}
}
]
@@ -73,9 +108,12 @@ export const SPEECH_MODEL_CATALOG: readonly SpeechModelCatalogEntry[] =
quality: 'basic',
speed: 'fast',
recommended: false,
repositoryUrl:
'https://modelscope.cn/models/pengzhendong/' +
'sherpa-onnx-whisper-tiny',
repositoryUrls: {
modelscope:
`https://modelscope.cn/models/${whisperTinyModelScopeRepository}`,
'hugging-face':
`https://huggingface.co/${whisperTinyHuggingFaceRepository}`
},
license: {
name: 'MIT License',
notice:
@@ -87,43 +125,58 @@ export const SPEECH_MODEL_CATALOG: readonly SpeechModelCatalogEntry[] =
{
name: 'tiny-encoder.int8.onnx',
role: 'encoder',
download: {
url:
'https://modelscope.cn/models/pengzhendong/' +
'sherpa-onnx-whisper-tiny/resolve/' +
'33a655645234f82ce833cf27b689d9c2212e693f/' +
'tiny-encoder.int8.onnx',
size: 12_937_772,
sha256:
'd24fb083ae3b1041fc24e97971d60e280c9342201fbb67b0ab428a8b4a51a434'
size: 12_937_772,
sha256:
'd24fb083ae3b1041fc24e97971d60e280c9342201fbb67b0ab428a8b4a51a434',
targets: {
modelscope: modelScopeTarget(
whisperTinyModelScopeRepository,
whisperTinyModelScopeRevision,
'tiny-encoder.int8.onnx'
),
'hugging-face': huggingFaceTarget(
whisperTinyHuggingFaceRepository,
whisperTinyHuggingFaceRevision,
'tiny-encoder.int8.onnx'
)
}
},
{
name: 'tiny-decoder.int8.onnx',
role: 'decoder',
download: {
url:
'https://modelscope.cn/models/pengzhendong/' +
'sherpa-onnx-whisper-tiny/resolve/' +
'33a655645234f82ce833cf27b689d9c2212e693f/' +
'tiny-decoder.int8.onnx',
size: 89_855_401,
sha256:
'd2fece8dd42771f1df975c6c0445770d0c292bf7547c2cae04a6c0cc57540925'
size: 89_855_401,
sha256:
'd2fece8dd42771f1df975c6c0445770d0c292bf7547c2cae04a6c0cc57540925',
targets: {
modelscope: modelScopeTarget(
whisperTinyModelScopeRepository,
whisperTinyModelScopeRevision,
'tiny-decoder.int8.onnx'
),
'hugging-face': huggingFaceTarget(
whisperTinyHuggingFaceRepository,
whisperTinyHuggingFaceRevision,
'tiny-decoder.int8.onnx'
)
}
},
{
name: 'tiny-tokens.txt',
role: 'tokens',
download: {
url:
'https://modelscope.cn/models/pengzhendong/' +
'sherpa-onnx-whisper-tiny/resolve/' +
'33a655645234f82ce833cf27b689d9c2212e693f/' +
'tiny-tokens.txt',
size: 816_730,
sha256:
'b34b360dbb493e781e479794586d661700670d65564001f23024971d1f2fa126'
size: 816_730,
sha256:
'b34b360dbb493e781e479794586d661700670d65564001f23024971d1f2fa126',
targets: {
modelscope: modelScopeTarget(
whisperTinyModelScopeRepository,
whisperTinyModelScopeRevision,
'tiny-tokens.txt'
),
'hugging-face': huggingFaceTarget(
whisperTinyHuggingFaceRepository,
whisperTinyHuggingFaceRevision,
'tiny-tokens.txt'
)
}
}
]
@@ -139,9 +192,10 @@ export const SPEECH_MODEL_CATALOG: readonly SpeechModelCatalogEntry[] =
quality: 'high',
speed: 'fast',
recommended: true,
repositoryUrl:
'https://huggingface.co/csukuangfj/' +
'sherpa-onnx-paraformer-bilingual-zh-en',
repositoryUrls: {
'hugging-face':
'https://huggingface.co/csukuangfj/sherpa-onnx-paraformer-bilingual-zh-en'
},
license: {
name: 'MIT License',
notice:
@@ -156,29 +210,29 @@ export const SPEECH_MODEL_CATALOG: readonly SpeechModelCatalogEntry[] =
{
name: 'model.int8.onnx',
role: 'model',
download: {
url:
'https://huggingface.co/csukuangfj/' +
'sherpa-onnx-paraformer-bilingual-zh-en/resolve/' +
'4b891f7b5c73d874e607797a4b0578fd4c35dd4b/' +
'model.int8.onnx',
size: 223_385_835,
sha256:
'9ada9127ca5b82320385ac12340eb8b05dee64fd45cf8cf593ec693826ec2fd7'
size: 223_385_835,
sha256:
'9ada9127ca5b82320385ac12340eb8b05dee64fd45cf8cf593ec693826ec2fd7',
targets: {
'hugging-face': huggingFaceTarget(
'csukuangfj/sherpa-onnx-paraformer-bilingual-zh-en',
'4b891f7b5c73d874e607797a4b0578fd4c35dd4b',
'model.int8.onnx'
)
}
},
{
name: 'tokens.txt',
role: 'tokens',
download: {
url:
'https://huggingface.co/csukuangfj/' +
'sherpa-onnx-paraformer-bilingual-zh-en/resolve/' +
'4b891f7b5c73d874e607797a4b0578fd4c35dd4b/' +
'tokens.txt',
size: 75_756,
sha256:
'59aba8873a2ed1e122c25fee421e25f283b63290efbde85c1f01a853d83cb6e6'
size: 75_756,
sha256:
'59aba8873a2ed1e122c25fee421e25f283b63290efbde85c1f01a853d83cb6e6',
targets: {
'hugging-face': huggingFaceTarget(
'csukuangfj/sherpa-onnx-paraformer-bilingual-zh-en',
'4b891f7b5c73d874e607797a4b0578fd4c35dd4b',
'tokens.txt'
)
}
}
]
@@ -194,9 +248,10 @@ export const SPEECH_MODEL_CATALOG: readonly SpeechModelCatalogEntry[] =
quality: 'high',
speed: 'balanced',
recommended: false,
repositoryUrl:
'https://huggingface.co/csukuangfj/' +
'sherpa-onnx-paraformer-trilingual-zh-cantonese-en',
repositoryUrls: {
'hugging-face':
'https://huggingface.co/csukuangfj/sherpa-onnx-paraformer-trilingual-zh-cantonese-en'
},
license: {
name: 'Apache License 2.0',
notice:
@@ -211,29 +266,29 @@ export const SPEECH_MODEL_CATALOG: readonly SpeechModelCatalogEntry[] =
{
name: 'model.int8.onnx',
role: 'model',
download: {
url:
'https://huggingface.co/csukuangfj/' +
'sherpa-onnx-paraformer-trilingual-zh-cantonese-en/' +
'resolve/8d90151338178bb433354c9fb677bd3acb8023cd/' +
'model.int8.onnx',
size: 244_684_152,
sha256:
'eb3cdd288f535cf73258f491cdd7d68ad5a00aee135c0bba4c0884ea8d926144'
size: 244_684_152,
sha256:
'eb3cdd288f535cf73258f491cdd7d68ad5a00aee135c0bba4c0884ea8d926144',
targets: {
'hugging-face': huggingFaceTarget(
'csukuangfj/sherpa-onnx-paraformer-trilingual-zh-cantonese-en',
'8d90151338178bb433354c9fb677bd3acb8023cd',
'model.int8.onnx'
)
}
},
{
name: 'tokens.txt',
role: 'tokens',
download: {
url:
'https://huggingface.co/csukuangfj/' +
'sherpa-onnx-paraformer-trilingual-zh-cantonese-en/' +
'resolve/8d90151338178bb433354c9fb677bd3acb8023cd/' +
'tokens.txt',
size: 118_931,
sha256:
'8e4593d7a2eb2404ff82976b5494265e9a06283ca4d5e8605bf7b4fed557a492'
size: 118_931,
sha256:
'8e4593d7a2eb2404ff82976b5494265e9a06283ca4d5e8605bf7b4fed557a492',
targets: {
'hugging-face': huggingFaceTarget(
'csukuangfj/sherpa-onnx-paraformer-trilingual-zh-cantonese-en',
'8d90151338178bb433354c9fb677bd3acb8023cd',
'tokens.txt'
)
}
}
]
@@ -249,8 +304,10 @@ export const SPEECH_MODEL_CATALOG: readonly SpeechModelCatalogEntry[] =
quality: 'balanced',
speed: 'balanced',
recommended: false,
repositoryUrl:
'https://huggingface.co/csukuangfj/sherpa-onnx-whisper-small',
repositoryUrls: {
'hugging-face':
'https://huggingface.co/csukuangfj/sherpa-onnx-whisper-small'
},
license: {
name: 'MIT License',
notice:
@@ -262,43 +319,43 @@ export const SPEECH_MODEL_CATALOG: readonly SpeechModelCatalogEntry[] =
{
name: 'small-encoder.int8.onnx',
role: 'encoder',
download: {
url:
'https://huggingface.co/csukuangfj/' +
'sherpa-onnx-whisper-small/resolve/' +
'8f3c18b358db4d1f2fc1eae49d75cd20989e4309/' +
'small-encoder.int8.onnx',
size: 112_442_483,
sha256:
'4cbe7b22fa9026b843b60a68640c747de05bafb1a11b57edc0e66c232d9f33a9'
size: 112_442_483,
sha256:
'4cbe7b22fa9026b843b60a68640c747de05bafb1a11b57edc0e66c232d9f33a9',
targets: {
'hugging-face': huggingFaceTarget(
'csukuangfj/sherpa-onnx-whisper-small',
'8f3c18b358db4d1f2fc1eae49d75cd20989e4309',
'small-encoder.int8.onnx'
)
}
},
{
name: 'small-decoder.int8.onnx',
role: 'decoder',
download: {
url:
'https://huggingface.co/csukuangfj/' +
'sherpa-onnx-whisper-small/resolve/' +
'8f3c18b358db4d1f2fc1eae49d75cd20989e4309/' +
'small-decoder.int8.onnx',
size: 262_226_114,
sha256:
'acad50b5c782696e91b55914cc5ab4f756f1532f76e22aa6fc615f39fb69a8ee'
size: 262_226_114,
sha256:
'acad50b5c782696e91b55914cc5ab4f756f1532f76e22aa6fc615f39fb69a8ee',
targets: {
'hugging-face': huggingFaceTarget(
'csukuangfj/sherpa-onnx-whisper-small',
'8f3c18b358db4d1f2fc1eae49d75cd20989e4309',
'small-decoder.int8.onnx'
)
}
},
{
name: 'small-tokens.txt',
role: 'tokens',
download: {
url:
'https://huggingface.co/csukuangfj/' +
'sherpa-onnx-whisper-small/resolve/' +
'8f3c18b358db4d1f2fc1eae49d75cd20989e4309/' +
'small-tokens.txt',
size: 816_730,
sha256:
'b34b360dbb493e781e479794586d661700670d65564001f23024971d1f2fa126'
size: 816_730,
sha256:
'b34b360dbb493e781e479794586d661700670d65564001f23024971d1f2fa126',
targets: {
'hugging-face': huggingFaceTarget(
'csukuangfj/sherpa-onnx-whisper-small',
'8f3c18b358db4d1f2fc1eae49d75cd20989e4309',
'small-tokens.txt'
)
}
}
]
@@ -314,8 +371,10 @@ export const SPEECH_MODEL_CATALOG: readonly SpeechModelCatalogEntry[] =
quality: 'high',
speed: 'slow',
recommended: false,
repositoryUrl:
'https://huggingface.co/csukuangfj/sherpa-onnx-whisper-medium',
repositoryUrls: {
'hugging-face':
'https://huggingface.co/csukuangfj/sherpa-onnx-whisper-medium'
},
license: {
name: 'MIT License',
notice:
@@ -327,43 +386,43 @@ export const SPEECH_MODEL_CATALOG: readonly SpeechModelCatalogEntry[] =
{
name: 'medium-encoder.int8.onnx',
role: 'encoder',
download: {
url:
'https://huggingface.co/csukuangfj/' +
'sherpa-onnx-whisper-medium/resolve/' +
'8c31d28503847560985df21f90e14f0c736e075e/' +
'medium-encoder.int8.onnx',
size: 374_196_283,
sha256:
'1c54582b4d829de0089f6cb63bbbdb3bf7555398bacaf855fbecf1a84dfd193e'
size: 374_196_283,
sha256:
'1c54582b4d829de0089f6cb63bbbdb3bf7555398bacaf855fbecf1a84dfd193e',
targets: {
'hugging-face': huggingFaceTarget(
'csukuangfj/sherpa-onnx-whisper-medium',
'8c31d28503847560985df21f90e14f0c736e075e',
'medium-encoder.int8.onnx'
)
}
},
{
name: 'medium-decoder.int8.onnx',
role: 'decoder',
download: {
url:
'https://huggingface.co/csukuangfj/' +
'sherpa-onnx-whisper-medium/resolve/' +
'8c31d28503847560985df21f90e14f0c736e075e/' +
'medium-decoder.int8.onnx',
size: 571_059_257,
sha256:
'595d00a338a365a7bfa0ca7f296cabc639583bef770ab6130df90f49a6412747'
size: 571_059_257,
sha256:
'595d00a338a365a7bfa0ca7f296cabc639583bef770ab6130df90f49a6412747',
targets: {
'hugging-face': huggingFaceTarget(
'csukuangfj/sherpa-onnx-whisper-medium',
'8c31d28503847560985df21f90e14f0c736e075e',
'medium-decoder.int8.onnx'
)
}
},
{
name: 'medium-tokens.txt',
role: 'tokens',
download: {
url:
'https://huggingface.co/csukuangfj/' +
'sherpa-onnx-whisper-medium/resolve/' +
'8c31d28503847560985df21f90e14f0c736e075e/' +
'medium-tokens.txt',
size: 816_730,
sha256:
'b34b360dbb493e781e479794586d661700670d65564001f23024971d1f2fa126'
size: 816_730,
sha256:
'b34b360dbb493e781e479794586d661700670d65564001f23024971d1f2fa126',
targets: {
'hugging-face': huggingFaceTarget(
'csukuangfj/sherpa-onnx-whisper-medium',
'8c31d28503847560985df21f90e14f0c736e075e',
'medium-tokens.txt'
)
}
}
]