Исправить прямой ответ о чистой прибыли 1С

This commit is contained in:
2026-05-23 15:34:11 +03:00
parent a15f24f21d
commit 5f7e201190
7 changed files with 391 additions and 4 deletions
@@ -262,6 +262,62 @@ describe("assistant MCP discovery response candidate", () => {
expect(candidate.reply_text).not.toContain("маржа к выручке 90.01");
});
it("answers direct net-profit questions with the accounting result first instead of saying no", () => {
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: "profit_margin_boundary",
unsupported_but_understood_family: "profit_margin_boundary",
explicit_date_scope: "2020"
},
data_need_graph: {
business_fact_family: "business_overview",
ranking_need: null,
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: {
accounting_financial_result: {
period_scope: "2020",
final_result_direction: "loss",
final_result_amount_human_ru: "7 136 815,85 руб.",
net_margin_to_revenue_pct: -59.41
}
}
},
answer_draft: {
answer_mode: "confirmed_with_bounded_inference",
headline: "Коротко: по бухгалтерскому маршруту 90/91/99 за 2020 подтвержден учетный убыток.",
confirmed_lines: [],
inference_lines: [],
unknown_lines: [],
limitation_lines: [],
next_step_line: null
}
}
})
);
const firstLine = String(candidate.reply_text ?? "").split("\n")[0] ?? "";
expect(firstLine).toContain("за 2020 по закрытию счетов 90/91/99");
expect(firstLine).toContain("учетный убыток");
expect(firstLine).toContain("минус 7 136 815,85 руб.");
expect(firstLine).not.toContain("нет, денежное операционное нетто");
expect(candidate.reply_text).toContain("не денежный поток");
});
it("keeps vendor-risk boundary answers direct instead of compacting into a money overview", () => {
const candidate = buildAssistantMcpDiscoveryResponseCandidate(
entryPoint({