АРЧ АП11 - Архитектура после регресса: Архитектура: сохранить свежую дату при inventory root restore и очистить data-scope ответы от грязных лейблов

This commit is contained in:
2026-04-18 09:12:39 +03:00
parent a5ea9adf53
commit 0431595542
24 changed files with 1030 additions and 58 deletions
@@ -287,10 +287,36 @@ function buildInventoryRootFollowupContext(followupContext) {
if (!followupContext || !followupContext.root_intent || !followupContext.root_filters) {
return followupContext;
}
const rootFilters = followupContext.root_filters && typeof followupContext.root_filters === "object"
? { ...followupContext.root_filters }
: {};
const previousFilters = followupContext.previous_filters && typeof followupContext.previous_filters === "object"
? followupContext.previous_filters
: {};
const previousAsOfDate = toNonEmptyString(previousFilters.as_of_date);
const previousPeriodFrom = toNonEmptyString(previousFilters.period_from);
const previousPeriodTo = toNonEmptyString(previousFilters.period_to);
const previousOrganization = toNonEmptyString(previousFilters.organization);
const previousWarehouse = toNonEmptyString(previousFilters.warehouse);
if (previousAsOfDate) {
rootFilters.as_of_date = previousAsOfDate;
}
if (previousPeriodFrom) {
rootFilters.period_from = previousPeriodFrom;
}
if (previousPeriodTo) {
rootFilters.period_to = previousPeriodTo;
}
if (!toNonEmptyString(rootFilters.organization) && previousOrganization) {
rootFilters.organization = previousOrganization;
}
if (!toNonEmptyString(rootFilters.warehouse) && previousWarehouse) {
rootFilters.warehouse = previousWarehouse;
}
return {
...followupContext,
previous_intent: followupContext.root_intent,
previous_filters: { ...followupContext.root_filters },
previous_filters: rootFilters,
previous_anchor_type: followupContext.root_anchor_type ?? followupContext.previous_anchor_type,
previous_anchor_value: followupContext.root_anchor_value ?? followupContext.previous_anchor_value,
current_frame_kind: "inventory_root"