feat: 对齐 Jev 真实 API schema、Web Speech 语音输入(优雅降级)、C1-01 语音化身份登记与真 key 冒烟脚本
This commit is contained in:
+17
-5
@@ -84,7 +84,7 @@ for (const ch of chapters) {
|
||||
}
|
||||
check(reachable.size === ch.nodes.length, `${ch.id}: 全部 ${ch.nodes.length} 个节点可达`);
|
||||
for (const n of ch.nodes) {
|
||||
if (n.type === 'choice' || n.type === 'narration') {
|
||||
if (n.type === 'choice' || n.type === 'narration' || n.type === 'identity') {
|
||||
check(!seenPoints.has(n.pointId), `${n.pointId}: 选择点 ID 全局唯一`);
|
||||
seenPoints.set(n.pointId, n.dimensions);
|
||||
}
|
||||
@@ -123,6 +123,9 @@ while (!engine.state.finished && guard++ < 200) {
|
||||
const node = engine.currentNode();
|
||||
if (node.type === 'choice') {
|
||||
await engine.choose((node as ChoiceNode).options[0].id);
|
||||
} else if (node.type === 'identity') {
|
||||
const profile = await engine.extractIdentity('我叫阿黎,29岁,在杭州做互联网产品经理,硕士学历');
|
||||
await engine.confirmIdentity(profile);
|
||||
} else if (node.type === 'narration') {
|
||||
// C2-05 走"沉默"路径验证合法选项,其余讲述
|
||||
if ((node as NarrationNode).pointId === 'C2-05') await engine.skipNarration();
|
||||
@@ -142,11 +145,11 @@ const c102 = store.events.find((e) => e.pointId === 'C1-02');
|
||||
check(!!c305?.variantId && c305.variantId === c102?.variantId, 'C3-02 幻境变体复用 C1-02 情绪解析结果');
|
||||
|
||||
// --- 5. 画像报告:7 维 score 问题 ---
|
||||
const criteria = Array.from({ length: 10 }, (_, i) => String(i + 1));
|
||||
const criteria = Array.from({ length: 10 }, (_, i) => `${i + 1} 级`);
|
||||
const dims = ['attachment', 'conflict_style', 'values', 'emotional_stability', 'risk', 'culture', 'mate_preference'];
|
||||
const answers = await jev.ask(
|
||||
store.events,
|
||||
Object.fromEntries(dims.map((d) => [d, { type: 'score' as const, description: d, criteria }])),
|
||||
Object.fromEntries(dims.map((d) => [d, { type: 'score' as const, instructions: d, criteria }])),
|
||||
);
|
||||
check(
|
||||
dims.every((d) => answers[d]?.type === 'score' && answers[d].confidence >= 0 && answers[d].confidence <= 1),
|
||||
@@ -158,10 +161,19 @@ const before = store.events.length;
|
||||
const oldSession = engine.state.sessionId;
|
||||
engine.replay('chapter1');
|
||||
check(engine.state.sessionId !== oldSession, '重玩产生新 sessionId');
|
||||
while (engine.currentNode().type !== 'choice') engine.advance();
|
||||
while (engine.currentNode().type !== 'choice') {
|
||||
const n = engine.currentNode();
|
||||
if (n.type === 'identity') {
|
||||
await engine.confirmIdentity(await engine.extractIdentity('占位自我介绍'));
|
||||
} else if (n.type === 'narration') {
|
||||
await engine.submitNarration('(验证用占位讲述)');
|
||||
} else {
|
||||
engine.advance();
|
||||
}
|
||||
}
|
||||
const firstChoice = engine.currentNode() as ChoiceNode;
|
||||
await engine.choose(firstChoice.options[0].id);
|
||||
check(store.events.length === before + 1, '重玩追加新事件,旧事件不变');
|
||||
check(store.events.length === before + 3, '重玩追加新事件(profile + narration + choice),旧事件不变');
|
||||
check((await store.list(oldSession)).length === before, '旧轨迹事件完整保留');
|
||||
|
||||
if (failures > 0) {
|
||||
|
||||
Reference in New Issue
Block a user