feat: add health consultation report pipeline
This commit is contained in:
@@ -33,8 +33,8 @@ test("request shape: POST /api/reports body carries only report identity fields"
|
||||
assert.equal(body.reportType, "personal_full");
|
||||
assert.equal(body.presentationMode, "default");
|
||||
assert.equal(body.depth, "standard");
|
||||
assert.deepEqual(body.themes, ["career", "marriage", "wealth", "timing"]);
|
||||
assert.deepEqual(DEFAULT_REPORT_THEMES, ["career", "marriage", "wealth", "timing"]);
|
||||
assert.deepEqual(body.themes, ["career", "marriage", "wealth", "timing", "health"]);
|
||||
assert.deepEqual(DEFAULT_REPORT_THEMES, ["career", "marriage", "wealth", "timing", "health"]);
|
||||
// No birth data, no chat text, no profile payload.
|
||||
assert.doesNotMatch(JSON.stringify(body), /birth|birthDate|latitude|longitude|timezone|profile|message|text/i);
|
||||
});
|
||||
|
||||
@@ -33,7 +33,25 @@ function clone<T>(value: T): T {
|
||||
}
|
||||
|
||||
function goldenWorkflow(theme: string): JsonRecord {
|
||||
return clone(GOLDEN.themes[theme] ?? GOLDEN.themes.career);
|
||||
const workflow = clone(GOLDEN.themes[theme] ?? GOLDEN.themes.career);
|
||||
if (theme === "health" || theme === "health_pressure") {
|
||||
const modules = chartModules(workflow);
|
||||
const source = clone((modules.varga_full as JsonRecord).D24_Chaturvimsamsa);
|
||||
(modules.varga_full as JsonRecord).D6_Shashthamsa = clone(source);
|
||||
(modules.varga_full as JsonRecord).D8_Ashtamsa = clone(source);
|
||||
(modules.varga_full as JsonRecord).D30_Trimsamsa = clone(source);
|
||||
const sections = (workflow.machine_evidence_packet as JsonRecord).sections as JsonRecord;
|
||||
sections.D8 = { status: "used", source_path: "modules.varga_full.D8" };
|
||||
(workflow.chart as JsonRecord).ai_prompt_pack = { evidence_snapshot: {
|
||||
health_narrative: {
|
||||
headline: "非医疗边界:D6/D8/D30 显示压力负荷与恢复节奏需要分层观察。",
|
||||
strengths: ["当前 Dasha 激活 6/8/12 宫主的部分恢复支持。"],
|
||||
risks: ["相关 Shadbala 较弱时需要降低负荷。"],
|
||||
boundaries: ["非医疗边界:本段不构成诊断或治疗建议。"],
|
||||
},
|
||||
} };
|
||||
}
|
||||
return workflow;
|
||||
}
|
||||
|
||||
function buildBundle(themes: readonly string[], workflows?: readonly JsonRecord[]) {
|
||||
@@ -206,3 +224,25 @@ test("nine requested themes close from the same golden chart layers", () => {
|
||||
assert.equal(row.status, "claim", `${row.theme} still blocked: ${row.reason}`);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test("health requires D1 D6 D8 D30 and Vimshottari while Transit stays optional", () => {
|
||||
const full = goldenWorkflow("health");
|
||||
delete chartModules(full).transits;
|
||||
const bundle = buildBundle(["health"], [full]);
|
||||
const card = bundle.claimCards.find((item) => item.theme === "health_pressure");
|
||||
assert.ok(card);
|
||||
assert.match(card.conclusion, /D6\/D8\/D30/);
|
||||
assert.match(card.conclusion, /非医疗/);
|
||||
assert.equal(bundle.blockedSections.some((item) => item.theme === "health_pressure"), false);
|
||||
assert.equal(card.assertionLevel, "parameter_sensitive");
|
||||
|
||||
for (const missing of ["D6_Shashthamsa", "D8_Ashtamsa", "D30_Trimsamsa"] as const) {
|
||||
const workflow = goldenWorkflow("health");
|
||||
delete (chartModules(workflow).varga_full as JsonRecord)[missing];
|
||||
const technique = missing.split("_")[0];
|
||||
delete ((workflow.machine_evidence_packet as JsonRecord).sections as JsonRecord)[technique];
|
||||
const blocked = buildBundle(["health"], [workflow]);
|
||||
assert.ok(blocked.blockedSections.some((item) => item.theme === "health_pressure"));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -55,6 +55,7 @@ test("packs restate the hard truth boundaries instead of relaxing them", () => {
|
||||
}
|
||||
assert.ok(general.includes("不做医疗诊断"));
|
||||
const health = interpretationPackForTheme("health_pressure")!;
|
||||
assert.ok(health.startsWith("非医疗边界:"));
|
||||
assert.ok(health.includes("不做任何诊断"));
|
||||
const wealth = interpretationPackForTheme("wealth")!;
|
||||
assert.ok(wealth.includes("不推荐任何具体投资标的"));
|
||||
|
||||
Reference in New Issue
Block a user