fix(consult): speak like a person instead of a calculation report
Keep skill truth boundaries, but stop asking the model to announce skipped domains or parrot tool JSON. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -254,7 +254,8 @@ test("consult route expands an optional entrypoint for both Agent and tool input
|
||||
|
||||
assert.match(source, /entrypoint:\s*consultationEntrypointSchema\.optional\(\)/);
|
||||
assert.match(source, /question:\s*resolvedQuestion\.modelQuestion/);
|
||||
assert.match(source, /resolvedQuestion\.modelQuestion,[\s\S]*?"\\n需要查询星盘时/);
|
||||
assert.match(source, /请直接用口语回答下面的问题[\s\S]*?resolvedQuestion\.modelQuestion/);
|
||||
assert.doesNotMatch(source, /JSON\.stringify\(toolInput\)/);
|
||||
});
|
||||
|
||||
test("homepage entrypoints use two whole-card native actions", () => {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import test from "node:test";
|
||||
|
||||
const voice = readFileSync(new URL("../src/mastra/product-voice.ts", import.meta.url), "utf8");
|
||||
const mastra = readFileSync(new URL("../src/mastra/index.ts", import.meta.url), "utf8");
|
||||
const route = readFileSync(new URL("../src/app/api/consult/route.ts", import.meta.url), "utf8");
|
||||
|
||||
test("product voice overrides skill report format without relaxing truth boundaries", () => {
|
||||
assert.match(voice, /VISIBLE VOICE \(overrides skill report format\)/);
|
||||
assert.match(voice, /govern METHOD and TRUTH BOUNDARIES only/);
|
||||
assert.match(voice, /Never copy the skill's report structure, Technique Audit Table/);
|
||||
assert.match(voice, /Answer the user's actual question in the first sentence/);
|
||||
assert.match(voice, /本轮未完整计算/);
|
||||
assert.match(voice, /你更适合把已经积累的专业能力做成长期事业/);
|
||||
|
||||
assert.match(mastra, /productConversationVoice/);
|
||||
assert.match(mastra, /Visible chat format is owned by VISIBLE VOICE above/);
|
||||
assert.match(mastra, /private working notes, not user-facing copy/);
|
||||
assert.match(mastra, /Follow the skill's method and truth boundaries/);
|
||||
assert.match(mastra, /Do not use a restricted technique/);
|
||||
assert.match(mastra, /Do not announce a skipped-domain inventory/);
|
||||
assert.doesNotMatch(mastra, /Name the domains you did cover, say plainly that the remaining ones were not calculated/);
|
||||
assert.doesNotMatch(mastra, /2-5 short paragraphs/);
|
||||
});
|
||||
|
||||
test("consult user turn no longer dumps tool JSON that the model would parrot", () => {
|
||||
const chartBranch = route.slice(route.indexOf("const toolInput = consultationInputSchema.parse"));
|
||||
|
||||
assert.match(chartBranch, /请直接用口语回答下面的问题[\s\S]*?resolvedQuestion\.modelQuestion/);
|
||||
assert.doesNotMatch(chartBranch, /JSON\.stringify\(toolInput\)/);
|
||||
assert.doesNotMatch(chartBranch, /经过服务端校验的工具参数/);
|
||||
assert.match(route, /请用口语直接回答,不要复述内部字段或报本轮算了什么/);
|
||||
assert.match(chartBranch, /await runConsultationWorkflow\(toolInput/);
|
||||
});
|
||||
Reference in New Issue
Block a user