Open-World: добавить годовую динамику в бизнес-обзор

This commit is contained in:
2026-05-04 11:47:31 +03:00
parent 027e9b373e
commit 04244ff3d7
9 changed files with 396 additions and 14 deletions
@@ -218,11 +218,15 @@ describe("assistant MCP discovery answer adapter", () => {
{
rows: [
{ Period: "2020-01-15T00:00:00", Amount: 120000, Counterparty: "Клиент А" },
{ Period: "2020-02-15T00:00:00", Amount: 80000, Counterparty: "Клиент Б" }
{ Period: "2020-02-15T00:00:00", Amount: 80000, Counterparty: "Клиент Б" },
{ Period: "2021-03-15T00:00:00", Amount: 220000, Counterparty: "Клиент А" }
]
},
{
rows: [{ Period: "2020-01-20T00:00:00", Amount: 150000, Counterparty: "Поставщик А" }]
rows: [
{ Period: "2020-01-20T00:00:00", Amount: 150000, Counterparty: "Поставщик А" },
{ Period: "2021-03-20T00:00:00", Amount: 50000, Counterparty: "Поставщик Б" }
]
},
{
rows: [
@@ -240,17 +244,22 @@ describe("assistant MCP discovery answer adapter", () => {
expect(draft.confirmed_lines.join("\n")).toContain("Входящие поступления");
expect(draft.confirmed_lines.join("\n")).toContain("Самый крупный подтвержденный клиент");
expect(draft.confirmed_lines.join("\n")).toContain("Самый крупный подтвержденный поставщик");
expect(draft.confirmed_lines.join("\n")).toContain("Годовая раскладка операционного денежного потока");
expect(draft.inference_lines.join("\n")).toContain("Аналитический вывод по оборотам");
expect(draft.inference_lines.join("\n")).toContain("Концентрация входящего потока");
expect(draft.inference_lines.join("\n")).toContain("Концентрация исходящего потока");
expect(draft.inference_lines.join("\n")).toContain("Годовая динамика по проверенным строкам");
expect(draft.inference_lines.join("\n")).toContain("2021");
expect(draft.inference_lines.join("\n")).toContain("Сводный LLM-аудит");
expect(draft.inference_lines.join("\n")).toContain("не прибыль и не маржа");
expect(draft.unknown_lines.join("\n")).toContain("Прибыль и маржа");
expect(draft.unknown_lines.join("\n")).toContain("Налоговая/VAT-позиция");
expect(draft.must_not_claim).toContain("Do not present business overview cash-flow spread as profit or margin.");
expect(draft.must_not_claim).toContain("Do not present business overview yearly operating-flow breakdown as profit, financial result, or a complete annual P&L.");
expect(draft.must_not_claim).toContain("Do not present business overview supplier concentration as vendor-risk audit, procurement quality, or full expense structure.");
expect(draft.reason_codes).toContain("answer_contains_business_overview");
expect(draft.reason_codes).toContain("answer_contains_business_overview_supplier_concentration");
expect(draft.reason_codes).toContain("answer_contains_business_overview_yearly_operating_breakdown");
expect(draft.reason_codes).toContain("answer_contains_business_overview_analyst_synthesis");
});
@@ -138,12 +138,14 @@ describe("assistant MCP discovery pilot executor", () => {
{
rows: [
{ Period: "2020-01-15T00:00:00", Amount: 120000, Counterparty: "Клиент А" },
{ Period: "2020-02-15T00:00:00", Amount: 80000, Counterparty: "Клиент Б" }
{ Period: "2020-02-15T00:00:00", Amount: 80000, Counterparty: "Клиент Б" },
{ Period: "2021-03-15T00:00:00", Amount: 220000, Counterparty: "Клиент А" }
]
},
{
rows: [
{ Period: "2020-01-20T00:00:00", Amount: 150000, Counterparty: "Поставщик А" }
{ Period: "2020-01-20T00:00:00", Amount: 150000, Counterparty: "Поставщик А" },
{ Period: "2021-03-20T00:00:00", Amount: 50000, Counterparty: "Поставщик Б" }
]
},
{
@@ -175,33 +177,50 @@ describe("assistant MCP discovery pilot executor", () => {
expect(result.derived_business_overview).toMatchObject({
organization_scope: "ООО Альтернатива Плюс",
incoming_customer_revenue: {
total_amount: 420000,
rows_with_amount: 3
},
outgoing_supplier_payout: {
total_amount: 200000,
rows_with_amount: 2
},
outgoing_supplier_payout: {
total_amount: 150000,
rows_with_amount: 1
},
net_amount: 50000,
net_amount: 220000,
net_direction: "net_incoming"
});
expect(result.derived_business_overview?.top_customers[0]).toMatchObject({
axis_value: "Клиент А",
total_amount: 120000
total_amount: 340000
});
expect(result.derived_business_overview?.top_suppliers[0]).toMatchObject({
axis_value: "Поставщик А",
total_amount: 150000
});
expect(result.derived_business_overview?.yearly_breakdown).toMatchObject([
{
year_bucket: "2020",
incoming_total_amount: 200000,
outgoing_total_amount: 150000,
net_amount: 50000
},
{
year_bucket: "2021",
incoming_total_amount: 220000,
outgoing_total_amount: 50000,
net_amount: 170000
}
]);
expect(result.derived_business_overview?.activity_period?.duration_total_months).toBe(11);
expect(result.evidence.confirmed_facts.join("\n")).toContain("В 1С подтверждены входящие поступления");
expect(result.evidence.confirmed_facts.join("\n")).toContain("Самый крупный подтвержденный поставщик");
expect(result.evidence.confirmed_facts.join("\n")).toContain("Годовая раскладка операционного денежного потока");
expect(result.evidence.inferred_facts.join("\n")).toContain("procurement concentration proxy");
expect(result.evidence.inferred_facts.join("\n")).toContain("Самый сильный год по подтвержденным входящим поступлениям: 2021");
expect(result.evidence.unknown_facts).toContain(
"Прибыль и маржа этим бизнес-обзором не подтверждены: нужны себестоимость, расходы и закрывающие документы."
);
expect(result.reason_codes).toContain("pilot_derived_business_overview_from_confirmed_rows");
expect(result.reason_codes).toContain("pilot_derived_business_overview_top_suppliers_from_confirmed_rows");
expect(result.reason_codes).toContain("pilot_derived_business_overview_yearly_operating_breakdown_from_confirmed_rows");
expect(deps.executeAddressMcpQuery).toHaveBeenCalledTimes(3);
});