6ee6fd64dd
Introduce page edit sessions with draft preview and patch API, chat skill picker, user memory profile, h5ApiBase resolution, voice WAV transport, and scripts for 105/g2 deployment and Plaza local dev. Co-authored-by: Cursor <cursoragent@cursor.com>
20 lines
733 B
JavaScript
20 lines
733 B
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { sanitizeAsrMessage } from './asr-proxy.mjs';
|
|
|
|
test('sanitizeAsrMessage shortens ffmpeg decode errors', () => {
|
|
const message = sanitizeAsrMessage('Failed to load audio: ffmpeg version 4.2.10 ...');
|
|
assert.equal(message, '音频格式无法识别,请重新录制');
|
|
});
|
|
|
|
test('sanitizeAsrMessage keeps concise upstream messages', () => {
|
|
assert.equal(sanitizeAsrMessage('未检测到有效语音'), '未检测到有效语音');
|
|
});
|
|
|
|
test('sanitizeAsrMessage truncates long messages', () => {
|
|
const long = 'x'.repeat(200);
|
|
const message = sanitizeAsrMessage(long);
|
|
assert.ok(message.endsWith('…'));
|
|
assert.ok(message.length <= 161);
|
|
});
|