dsh-folia 4.26.0-pre.55 → 4.26.0-pre.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/asr/asr-local.js +10 -2
- package/lib/client.js +557 -120
- package/lib/routes/pet-chat.js +276 -67
- package/lib/tts/tts-worker.cjs +254 -8
- package/lib/tts/tts.js +13 -5
- package/lib/voice/record.js +170 -27
- package/package.json +1 -1
package/lib/asr/asr-local.js
CHANGED
|
@@ -193,14 +193,22 @@ export function startWorker(root) {
|
|
|
193
193
|
let lastError = '';
|
|
194
194
|
child.stderr.on('data', (chunk) => { lastError = (lastError + chunk).slice(-2000); });
|
|
195
195
|
|
|
196
|
-
const request = (wavPath, timeoutMs = 30000) => new Promise((resolve, reject) => {
|
|
196
|
+
const request = (wavPath, timeoutMs = 30000, options = {}) => new Promise((resolve, reject) => {
|
|
197
197
|
const id = String(++seq);
|
|
198
198
|
const timer = setTimeout(() => {
|
|
199
199
|
pending.delete(id);
|
|
200
200
|
reject(new Error('识别超时'));
|
|
201
201
|
}, timeoutMs);
|
|
202
202
|
pending.set(id, { resolve, timer });
|
|
203
|
-
|
|
203
|
+
// pre.57:中文 + 逆文本归一化。worker 的 SenseVoice 已按 language=zh /
|
|
204
|
+
// useInverseTextNormalization=1 初始化;请求里也显式带上,便于换模型时协议层生效。
|
|
205
|
+
const payload = {
|
|
206
|
+
id,
|
|
207
|
+
wavPath,
|
|
208
|
+
language: String(options.language || 'zh').slice(0, 8),
|
|
209
|
+
itn: options.itn !== false,
|
|
210
|
+
};
|
|
211
|
+
child.stdin.write(JSON.stringify(payload) + '\n', (err) => {
|
|
204
212
|
if (err) {
|
|
205
213
|
clearTimeout(timer);
|
|
206
214
|
pending.delete(id);
|