Укрепить debt-boundary ответы MCP discovery
This commit is contained in:
@@ -235,6 +235,24 @@ describe("assistant deep turn response runtime adapter", () => {
|
||||
|
||||
expect(runtime.response.assistant_reply).toContain("Discovery answer");
|
||||
expect(runtime.debug?.mcp_discovery_response_applied).toBe(true);
|
||||
expect(runtime.debug?.truth_gate_contract_status).toBe("partial_supported");
|
||||
expect(runtime.debug?.truth_mode).toBe("limited");
|
||||
expect(runtime.debug?.coverage_gate_contract).toEqual(
|
||||
expect.objectContaining({
|
||||
coverage_status: "partial",
|
||||
evidence_grade: "medium",
|
||||
grounding_status: "partial",
|
||||
truth_mode: "limited",
|
||||
source_truth_gate_status: "partial_supported"
|
||||
})
|
||||
);
|
||||
expect(runtime.debug?.answer_shape_contract).toEqual(
|
||||
expect.objectContaining({
|
||||
answer_shape: "limited_with_reason",
|
||||
reply_type: "partial_coverage",
|
||||
may_state_confirmed_facts: true
|
||||
})
|
||||
);
|
||||
expect(runFinalizeDeepTurn).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
assistantReply: expect.stringContaining("Discovery answer"),
|
||||
|
||||
@@ -523,6 +523,116 @@ describe("assistant MCP discovery response candidate", () => {
|
||||
expect(candidate.reply_text).not.toContain("руб..");
|
||||
});
|
||||
|
||||
it("keeps debt due-date boundary answers useful and hides row counters", () => {
|
||||
const candidate = buildAssistantMcpDiscoveryResponseCandidate(
|
||||
entryPoint({
|
||||
turn_input: {
|
||||
adapter_status: "ready",
|
||||
turn_meaning_ref: {
|
||||
raw_message: "По ООО Альтернатива Плюс на конец 2020 можно точно понять, какая дебиторка просрочена?",
|
||||
effective_message: "Проверить просроченную дебиторку ООО Альтернатива Плюс на конец 2020.",
|
||||
asked_domain_family: "business_overview",
|
||||
asked_action_family: "debt_due_date_boundary",
|
||||
explicit_organization_scope: "ООО Альтернатива Плюс",
|
||||
explicit_date_scope: "2020-12-31"
|
||||
},
|
||||
data_need_graph: {
|
||||
business_fact_family: "business_overview",
|
||||
reason_codes: ["data_need_graph_family_business_overview"]
|
||||
}
|
||||
},
|
||||
bridge: {
|
||||
bridge_status: "answer_draft_ready",
|
||||
user_facing_response_allowed: true,
|
||||
business_fact_answer_allowed: true,
|
||||
requires_user_clarification: false,
|
||||
pilot: {
|
||||
pilot_scope: "business_overview_route_template_v1",
|
||||
derived_business_overview: {
|
||||
debt_due_date_aging: {
|
||||
evidence_status: "no_payment_terms_configured",
|
||||
as_of_date: "2020-12-31",
|
||||
gross_open_amount_human_ru: "35 472 380,36 руб.",
|
||||
rows_with_amount: 46
|
||||
}
|
||||
}
|
||||
},
|
||||
answer_draft: {
|
||||
answer_mode: "confirmed_with_bounded_inference",
|
||||
headline: "Debt boundary.",
|
||||
confirmed_lines: [],
|
||||
inference_lines: [],
|
||||
unknown_lines: [],
|
||||
limitation_lines: [],
|
||||
next_step_line: null
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
expect(candidate.reply_text).toContain("35 472 380,36 руб.");
|
||||
expect(candidate.reply_text).toContain("срок оплаты не установлен");
|
||||
expect(candidate.reply_text).toContain("нельзя честно назвать эти остатки просрочкой");
|
||||
expect(candidate.reply_text).toContain("Что проверить дальше");
|
||||
expect(candidate.reply_text).not.toContain("Проверено строк");
|
||||
expect(candidate.reply_text).not.toContain("строк с суммой");
|
||||
});
|
||||
|
||||
it("answers short debt boundary follow-ups directly instead of replaying the full debt packet", () => {
|
||||
const candidate = buildAssistantMcpDiscoveryResponseCandidate(
|
||||
entryPoint({
|
||||
turn_input: {
|
||||
adapter_status: "ready",
|
||||
turn_meaning_ref: {
|
||||
raw_message: "То есть просрочку доказать нельзя, коротко почему?",
|
||||
effective_message: "Коротко объяснить, почему просрочку нельзя доказать.",
|
||||
asked_domain_family: "business_overview",
|
||||
asked_action_family: "debt_due_date_boundary",
|
||||
explicit_organization_scope: "ООО Альтернатива Плюс",
|
||||
explicit_date_scope: "2020-12-31"
|
||||
},
|
||||
data_need_graph: {
|
||||
business_fact_family: "business_overview",
|
||||
question: "То есть просрочку доказать нельзя, коротко почему?",
|
||||
reason_codes: ["data_need_graph_family_business_overview"]
|
||||
}
|
||||
},
|
||||
bridge: {
|
||||
bridge_status: "answer_draft_ready",
|
||||
user_facing_response_allowed: true,
|
||||
business_fact_answer_allowed: true,
|
||||
requires_user_clarification: false,
|
||||
pilot: {
|
||||
pilot_scope: "business_overview_route_template_v1",
|
||||
derived_business_overview: {
|
||||
debt_due_date_aging: {
|
||||
evidence_status: "no_payment_terms_configured",
|
||||
as_of_date: "2020-12-31",
|
||||
gross_open_amount_human_ru: "35 472 380,36 руб.",
|
||||
rows_with_amount: 46
|
||||
}
|
||||
}
|
||||
},
|
||||
answer_draft: {
|
||||
answer_mode: "confirmed_with_bounded_inference",
|
||||
headline: "Debt boundary.",
|
||||
confirmed_lines: [],
|
||||
inference_lines: [],
|
||||
unknown_lines: [],
|
||||
limitation_lines: [],
|
||||
next_step_line: null
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
expect(candidate.reply_text?.split("\n")[0]).toContain("доказать просрочку");
|
||||
expect(candidate.reply_text?.split("\n")[0]).toContain("нельзя");
|
||||
expect(candidate.reply_text).toContain("due date");
|
||||
expect(candidate.reply_text).not.toContain("Проверено строк");
|
||||
expect(candidate.reply_text).not.toContain("строк с суммой");
|
||||
});
|
||||
|
||||
it("uses a compact direct answer for business-overview top year questions", () => {
|
||||
const candidate = buildAssistantMcpDiscoveryResponseCandidate(
|
||||
entryPoint({
|
||||
|
||||
Reference in New Issue
Block a user