feat: expand local speech models

This commit is contained in:
lofyer
2026-08-11 01:34:28 +08:00
parent f16ef993bc
commit c8050f4a9a
10 changed files with 855 additions and 117 deletions
@@ -39,6 +39,28 @@ function whisperModel(): SelectedSpeechRuntimeModel {
}
}
function paraformerModel(): SelectedSpeechRuntimeModel {
return {
id: 'paraformer-bilingual-zh-en-int8',
family: 'paraformer',
directory: 'C:\\models\\paraformer',
files: [
{
name: 'model.int8.onnx',
role: 'model',
size: 1,
sha256: 'a'.repeat(64)
},
{
name: 'tokens.txt',
role: 'tokens',
size: 1,
sha256: 'b'.repeat(64)
}
]
}
}
function input(): SpeechTranscriptionInput {
return {
requestId,
@@ -72,6 +94,15 @@ describe('SpeechTranscriptionService', () => {
).toBe('')
})
it('wires an offline Paraformer model to local inference', () => {
expect(
createSherpaRecognizerConfig(paraformerModel()).modelConfig
.paraformer
).toEqual({
model: 'C:\\models\\paraformer\\model.int8.onnx'
})
})
it('requires an installed selected model and rejects oversized audio', async () => {
const service = new SpeechTranscriptionService(
{