|
@@ -237,5 +237,30 @@ if (!credentials.ak || !credentials.sk || !credentials.appkey) {
|
|
|
check('识别结果长度合理(≥ 8 字)', text.length >= 8, String(text.length));
|
|
check('识别结果长度合理(≥ 8 字)', text.length >= 8, String(text.length));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// ── 4. 接线(源码级:这段是 Vue 壳组件里的事,node 跑不起来)────────────────
|
|
|
|
|
+console.log('\n【4】两个壳组件已切到 NLS 实现(源码级断言)');
|
|
|
|
|
+{
|
|
|
|
|
+ const { readFileSync } = await import('node:fs');
|
|
|
|
|
+ for (const file of [
|
|
|
|
|
+ 'src/components/BusinessAssistantPC.vue',
|
|
|
|
|
+ 'src/components/BusinessAssistantMobile.vue',
|
|
|
|
|
+ ]) {
|
|
|
|
|
+ const source = readFileSync(file, 'utf8');
|
|
|
|
|
+ check(`${file}:import 的是 NLS 实现`,
|
|
|
|
|
+ /import ASR from '@\/three-libs\/asr\/nls';/.test(source));
|
|
|
|
|
+ check(`${file}:不再 import 旧的厂商 SDK`,
|
|
|
|
|
+ !/import ASR from '@\/three-libs\/asr\/index';/.test(source));
|
|
|
|
|
+ check(`${file}:不再硬编码 appKey(改由端点下发)`,
|
|
|
|
|
+ !/new ASR\("/.test(source) && /new ASR\(undefined/.test(source));
|
|
|
|
|
+ // 契约没变:这几个调用点必须还在(换了实现就得跟着改)
|
|
|
|
|
+ check(`${file}:openMicroPhone / startRecord / openSocket / transform 调用点齐全`,
|
|
|
|
|
+ /openMicroPhone\(\)/.test(source) && /startRecord\(\)/.test(source) &&
|
|
|
|
|
+ /openSocket\(\)/.test(source) && /\.transform\(\)/.test(source) &&
|
|
|
|
|
+ /\.close\(\)/.test(source) && /\.clear\(\)/.test(source));
|
|
|
|
|
+ }
|
|
|
|
|
+ // 旧实现仍在仓库里(切回去的退路),别被顺手删掉
|
|
|
|
|
+ check('旧的厂商 SDK 仍在(切回去只改 import)', existsSync('src/three-libs/asr/index.ts'));
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
console.log(`\n===== 通过 ${pass} 项,失败 ${fail} 项 =====`);
|
|
console.log(`\n===== 通过 ${pass} 项,失败 ${fail} 项 =====`);
|
|
|
process.exit(fail ? 1 : 0);
|
|
process.exit(fail ? 1 : 0);
|