fix: 避免识别异常与支付锁泄漏

修复 ASR 取消后的孤立会话、OCR 表格重复及支付锁无法回收的问题,并补充回归测试。
This commit is contained in:
lik
2026-11-08 12:43:06 +08:00
parent 7c4a90c113
commit 84461e9445
6 changed files with 76 additions and 7 deletions
+8
View File
@@ -451,6 +451,14 @@ test("原生 OCR 的制表符与全角空格分列同样还原成表格", () =>
assert.match(fullWidthTable, /\| 白细胞计数 WBC \| 6\.2 \| 10\^9\/L \| \| \|/);
});
test("OCR 表格超出列并入最后一列时不重复已有单元格", () => {
const formatted = formatTranscription("项目 结果 单位\n白细胞 6.2 10^9/L 偏高");
assert.equal(
formatted,
"| 项目 | 结果 | 单位 |\n| --- | --- | --- |\n| 白细胞 | 6.2 | 10^9/L 偏高 |"
);
});
test("识别行只有坐标没有文字时视为未识别", () => {
const result = parseVisionResult('[{"rotate_rect":[358,40,33,375,90]},{"rotate_rect":[268,96,25,453,90]}]');
assert.equal(result.text, "");