Commit Graph
2 Commits
Author SHA1 Message Date
blumia b37b9eb779 fix(asr): do not call InputFinished for a never-ending stream
A live caption stream never ends: the boundary of an utterance is silence,
not end-of-input, so InputFinished (which means "no more audio ever") does
not apply. Drop it and rely on the trailing audio alone; keep a short
silence padding as a safety net for end-of-file cases. Verified that the
file path still emits the final character without InputFinished.

实时字幕的音频流永不结束,一句话的边界是"静音"而不是"输入结束",所以
不该调用语义为"再也不会有音频"的 InputFinished。改为只补一小段静音兜底,
实测文件模式的结果依然完整。文档也一并更正。
2026-10-12 16:10:59 +08:00
blumia bd921b1ac5 feat(asr): add pluggable ONNX streaming backend and model registry
Add a second backend (sherpa-onnx) alongside llama.cpp, so native
streaming models can be selected by ID from a JSON registry. All such
models share one adapter: only the model files and a few options differ.
Models now live under the app data directory and are fetched by
scripts/fetch-models.sh. Adding a model is a data change, not code.

Measured on the same audio: the streaming backend is ~35x cheaper in CPU
than Qwen3-ASR (0.10-0.12 vs 4.27 core-seconds per audio second), shows
the first caption at 0.48-1.44s, and matches its accuracy for zh/en.

新增 sherpa-onnx 流式后端,与 llama.cpp 并存;模型按注册表 id 从应用
数据目录加载。同族模型共用一个适配器,新增模型只改 data/models.json。
实测流式后端 CPU 约为 Qwen3-ASR 的 1/35,首个字幕 0.48~1.44s,中英
准确率持平。注意预编译库是旧 C++ ABI,必须走其 C API。
2026-10-12 16:06:51 +08:00