Архитектура: централизовать root-frame-aware carryover filters в continuity policy и transition glue
This commit is contained in:
@@ -8,6 +8,7 @@ exports.readAddressDebugScopedDate = readAddressDebugScopedDate;
|
||||
exports.readAddressDebugTemporalScope = readAddressDebugTemporalScope;
|
||||
exports.resolveAddressDebugAnchorContext = resolveAddressDebugAnchorContext;
|
||||
exports.resolveAddressDebugContextFacts = resolveAddressDebugContextFacts;
|
||||
exports.resolveAddressDebugCarryoverFilters = resolveAddressDebugCarryoverFilters;
|
||||
exports.buildInventoryRootFrameFromAddressDebug = buildInventoryRootFrameFromAddressDebug;
|
||||
exports.isGroundedAddressDebug = isGroundedAddressDebug;
|
||||
exports.resolveAssistantContinuitySnapshot = resolveAssistantContinuitySnapshot;
|
||||
@@ -121,6 +122,37 @@ function resolveAddressDebugContextFacts(debug, toNonEmptyString = fallbackToNon
|
||||
scopedDate: readAddressDebugScopedDate(debug)
|
||||
};
|
||||
}
|
||||
function resolveAddressDebugCarryoverFilters(debug, toNonEmptyString = fallbackToNonEmptyString) {
|
||||
const extractedFilters = readAddressDebugFilters(debug);
|
||||
const nextFilters = extractedFilters ? { ...extractedFilters } : {};
|
||||
const inventoryRootFrame = buildInventoryRootFrameFromAddressDebug(debug, toNonEmptyString);
|
||||
const rootFilters = inventoryRootFrame?.filters && typeof inventoryRootFrame.filters === "object"
|
||||
? inventoryRootFrame.filters
|
||||
: null;
|
||||
if (rootFilters) {
|
||||
const organization = toNonEmptyString(rootFilters.organization);
|
||||
const warehouse = toNonEmptyString(rootFilters.warehouse);
|
||||
const asOfDate = toNonEmptyString(rootFilters.as_of_date);
|
||||
const periodFrom = toNonEmptyString(rootFilters.period_from);
|
||||
const periodTo = toNonEmptyString(rootFilters.period_to);
|
||||
if (organization) {
|
||||
nextFilters.organization = organization;
|
||||
}
|
||||
if (warehouse) {
|
||||
nextFilters.warehouse = warehouse;
|
||||
}
|
||||
if (asOfDate) {
|
||||
nextFilters.as_of_date = asOfDate;
|
||||
}
|
||||
if (periodFrom) {
|
||||
nextFilters.period_from = periodFrom;
|
||||
}
|
||||
if (periodTo) {
|
||||
nextFilters.period_to = periodTo;
|
||||
}
|
||||
}
|
||||
return nextFilters;
|
||||
}
|
||||
function buildInventoryRootFrameFromAddressDebug(debug, toNonEmptyString = fallbackToNonEmptyString) {
|
||||
if (!debug || typeof debug !== "object") {
|
||||
return null;
|
||||
|
||||
@@ -627,8 +627,7 @@ function createAssistantTransitionPolicy(deps) {
|
||||
: null;
|
||||
let resolvedCounterpartyFromDisplay = false;
|
||||
let displayedEntityTargetIntent = null;
|
||||
const previousFiltersRaw = previousAddressDebug.extracted_filters;
|
||||
let previousFilters = previousFiltersRaw && typeof previousFiltersRaw === "object" ? { ...previousFiltersRaw } : {};
|
||||
let previousFilters = (0, assistantContinuityPolicy_1.resolveAddressDebugCarryoverFilters)(previousAddressDebug, deps.toNonEmptyString);
|
||||
const shouldBackfillHistoricalPartyAnchors = sourceIntentHint === "list_contracts_by_counterparty" ||
|
||||
sourceIntentHint === "list_documents_by_counterparty" ||
|
||||
sourceIntentHint === "bank_operations_by_counterparty" ||
|
||||
|
||||
Reference in New Issue
Block a user