fix(rectification): keep one spoken paragraph and strip body questions (BUG-584, BUG-585)
Set-focus must not append a second narration, and a server-owned stem must not also appear as a question in the assistant body. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -132,13 +132,80 @@ test("keeps a live opening greeting when the next public tool is set-focus", ()
|
||||
).kind,
|
||||
"none",
|
||||
);
|
||||
assert.deepEqual(
|
||||
// 原值: set-focus 后第二段 live 发布
|
||||
// 新值: discard
|
||||
// 原因: BUG-584 决策 2,保留 set-focus 前的问候,丢掉工具结果后的复述
|
||||
assert.equal(
|
||||
applyStepAnswerChunk(
|
||||
state,
|
||||
chunk("text-delta", { text: "我们慢慢来就好——想到哪件就聊哪件,不用一次说完。" }),
|
||||
isPublicTool,
|
||||
).kind,
|
||||
"discard",
|
||||
);
|
||||
});
|
||||
|
||||
test("set-focus with no prior spoken text still publishes the later greeting", () => {
|
||||
const state = createStepAnswerState();
|
||||
assert.equal(
|
||||
applyStepAnswerChunk(
|
||||
state,
|
||||
chunk("tool-call", { toolName: "rectification-set-focus" }),
|
||||
isPublicTool,
|
||||
).kind,
|
||||
"none",
|
||||
);
|
||||
assert.equal(
|
||||
applyStepAnswerChunk(
|
||||
state,
|
||||
chunk("tool-result", { toolName: "rectification-set-focus" }),
|
||||
isPublicTool,
|
||||
).kind,
|
||||
"none",
|
||||
);
|
||||
assert.deepEqual(
|
||||
applyStepAnswerChunk(
|
||||
state,
|
||||
chunk("text-delta", { text: "你好,我们从你最容易想起的经历开始就行。" }),
|
||||
isPublicTool,
|
||||
),
|
||||
{ kind: "live", text: "我们慢慢来就好——想到哪件就聊哪件,不用一次说完。" },
|
||||
{ kind: "live", text: "你好,我们从你最容易想起的经历开始就行。" },
|
||||
);
|
||||
});
|
||||
|
||||
test("set-focus publishes an unfinished CJK remainder instead of dropping it", () => {
|
||||
const state = createStepAnswerState();
|
||||
assert.equal(
|
||||
applyStepAnswerChunk(
|
||||
state,
|
||||
chunk("text-delta", { text: "范围已经收到 05:00 到 05:10" }),
|
||||
isPublicTool,
|
||||
).kind,
|
||||
"none",
|
||||
);
|
||||
assert.deepEqual(
|
||||
applyStepAnswerChunk(
|
||||
state,
|
||||
chunk("tool-call", { toolName: "rectification-set-focus" }),
|
||||
isPublicTool,
|
||||
),
|
||||
{ kind: "publish", pieces: ["范围已经收到 05:00 到 05:10"] },
|
||||
);
|
||||
});
|
||||
|
||||
test("English planning before set-focus is still discarded", () => {
|
||||
const state = createStepAnswerState();
|
||||
assert.equal(
|
||||
applyStepAnswerChunk(state, chunk("text-delta", { text: "Let me set the next collect focus" }), isPublicTool).kind,
|
||||
"none",
|
||||
);
|
||||
assert.equal(
|
||||
applyStepAnswerChunk(
|
||||
state,
|
||||
chunk("tool-call", { toolName: "rectification-set-focus" }),
|
||||
isPublicTool,
|
||||
).kind,
|
||||
"discard",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user