Архитектура: стабилизировать organization authority после late company switch и закрыть phase16 multi-company replay
This commit is contained in:
@@ -98,6 +98,10 @@ function hasSameDateHint(text: string): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
function hasSameDatePrepositionHint(text: string): boolean {
|
||||
return /(?:по\s+(?:этой|той)\s+же\s+дат(?:е|у|ой))/iu.test(String(text ?? ""));
|
||||
}
|
||||
|
||||
function hasSamePeriodHint(text: string): boolean {
|
||||
return /(?:на\s+тот\s+же\s+период|за\s+тот\s+же\s+период|тот\s+же\s+период(?:\s+рассмотрения)?|на\s+этот\s+же\s+период|за\s+этот\s+же\s+период|за\s+этот\s+период|на\s+этот\s+период|за\s+тот\s+период|на\s+тот\s+период|этот\s+период|тот\s+период|аналогичн\w+\s+текущ\w+\s+период\w+|same\s+period|same\s+range|same\s+window)/iu.test(
|
||||
String(text ?? "")
|
||||
@@ -814,7 +818,7 @@ function mergeFollowupFilters(
|
||||
const relativeMonthFromInventoryRoot = resolveRelativeMonthPeriodFromInventoryRoot(userMessage, followupContext);
|
||||
const relativeMonthFromFollowupYear = resolveRelativeMonthPeriodFromFollowupYear(userMessage, followupContext);
|
||||
const allTimeRequested = hasAllTimeHint(userMessage);
|
||||
const sameDateRequested = hasSameDateHint(userMessage);
|
||||
const sameDateRequested = hasSameDateHint(userMessage) || hasSameDatePrepositionHint(userMessage);
|
||||
const samePeriodRequested = hasSamePeriodHint(userMessage);
|
||||
const explicitQuotedItem = extractSelectedObjectItemFromFollowupText(userMessage);
|
||||
if (!toNonEmptyString(merged.organization) && previousOrganization) {
|
||||
@@ -1000,6 +1004,27 @@ function mergeFollowupFilters(
|
||||
merged.as_of_date = inheritedAsOfDate;
|
||||
reasons.push("as_of_date_from_followup_context");
|
||||
}
|
||||
if (
|
||||
(intent === "inventory_on_hand_as_of_date" || intent === "inventory_supplier_stock_overlap_as_of_date") &&
|
||||
previousPeriodFrom &&
|
||||
merged.period_from !== previousPeriodFrom
|
||||
) {
|
||||
merged.period_from = previousPeriodFrom;
|
||||
reasons.push("period_from_from_followup_context");
|
||||
}
|
||||
if (
|
||||
(intent === "inventory_on_hand_as_of_date" || intent === "inventory_supplier_stock_overlap_as_of_date") &&
|
||||
previousPeriodTo &&
|
||||
merged.period_to !== previousPeriodTo
|
||||
) {
|
||||
merged.period_to = previousPeriodTo;
|
||||
reasons.push("period_to_from_followup_context");
|
||||
}
|
||||
const currentWarehouse = toNonEmptyString(merged.warehouse);
|
||||
if (currentWarehouse && hasSameDatePrepositionHint(currentWarehouse)) {
|
||||
delete merged.warehouse;
|
||||
reasons.push("warehouse_cleared_from_same_date_followup_noise");
|
||||
}
|
||||
}
|
||||
if (
|
||||
samePeriodRequested &&
|
||||
|
||||
Reference in New Issue
Block a user