АРЧ АП11 - Архитектура: вынести counterparty intent-family из resolveAddressIntent и обновить pre-expansion cut
This commit is contained in:
@@ -0,0 +1,166 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveCounterpartyAddressIntent = resolveCounterpartyAddressIntent;
|
||||
function resolveCounterpartyAddressIntent(text, deps) {
|
||||
if (deps.hasOpenContractsListSignal(text)) {
|
||||
return {
|
||||
intent: "open_contracts_confirmed_as_of_date",
|
||||
confidence: "medium",
|
||||
reasons: ["open_contract_signal_detected"]
|
||||
};
|
||||
}
|
||||
if (deps.hasAny(text, deps.openItemsHints) &&
|
||||
!deps.hasCounterpartyDebtLongevitySignal(text) &&
|
||||
!deps.hasInventoryAgingSignal(text) &&
|
||||
!deps.hasInventoryProvenanceSignalV2(text) &&
|
||||
!deps.hasInventoryPurchaseDocumentsSignalV2(text) &&
|
||||
!deps.hasInventorySaleTraceSignalV2(text) &&
|
||||
(/(?:контраг|договор|контракт|counterparty|contract|покупател|клиент|заказчик|customer|client|buyer|supplier|поставщик)/iu.test(text) ||
|
||||
deps.hasAccountNumberAnchor(text) ||
|
||||
deps.hasCompactAccountCodeToken(text))) {
|
||||
return {
|
||||
intent: "open_items_by_counterparty_or_contract",
|
||||
confidence: "medium",
|
||||
reasons: ["open_items_signal_detected"]
|
||||
};
|
||||
}
|
||||
if (deps.hasPeriodCoverageProfileSignal(text) &&
|
||||
!deps.hasPartyAnchorMention(text) &&
|
||||
!deps.hasContractAnchorSignal(text) &&
|
||||
!deps.hasAccountBalanceSignal(text)) {
|
||||
return {
|
||||
intent: "period_coverage_profile",
|
||||
confidence: "high",
|
||||
reasons: ["period_coverage_profile_signal_detected"]
|
||||
};
|
||||
}
|
||||
if (deps.hasDocumentTypeAndAccountSectionProfileSignal(text) &&
|
||||
!deps.hasPartyAnchorMention(text) &&
|
||||
!deps.hasContractAnchorSignal(text) &&
|
||||
!deps.hasAccountBalanceSignal(text)) {
|
||||
return {
|
||||
intent: "document_type_and_account_section_profile",
|
||||
confidence: "high",
|
||||
reasons: ["document_type_and_account_section_profile_signal_detected"]
|
||||
};
|
||||
}
|
||||
if (deps.hasCounterpartyPopulationAndRolesSignal(text) &&
|
||||
!deps.hasContractAnchorSignal(text) &&
|
||||
!deps.hasAccountBalanceSignal(text)) {
|
||||
return {
|
||||
intent: "counterparty_population_and_roles",
|
||||
confidence: "high",
|
||||
reasons: ["counterparty_population_and_roles_signal_detected"]
|
||||
};
|
||||
}
|
||||
if (deps.hasCounterpartyActivityLifecycleSignal(text) &&
|
||||
!deps.hasContractAnchorSignal(text) &&
|
||||
!deps.hasAccountBalanceSignal(text)) {
|
||||
return {
|
||||
intent: "counterparty_activity_lifecycle",
|
||||
confidence: "high",
|
||||
reasons: ["counterparty_activity_lifecycle_signal_detected"]
|
||||
};
|
||||
}
|
||||
if (deps.hasContractUsageOverviewSignal(text) &&
|
||||
!deps.hasAccountBalanceSignal(text) &&
|
||||
!deps.hasOpenContractsListSignal(text)) {
|
||||
return {
|
||||
intent: "contract_usage_overview",
|
||||
confidence: "high",
|
||||
reasons: ["contract_usage_overview_signal_detected"]
|
||||
};
|
||||
}
|
||||
if (deps.hasCustomerRevenueAndPaymentsSignal(text) && !deps.hasAccountBalanceSignal(text)) {
|
||||
return {
|
||||
intent: "customer_revenue_and_payments",
|
||||
confidence: "high",
|
||||
reasons: ["customer_revenue_and_payments_signal_detected"]
|
||||
};
|
||||
}
|
||||
if (deps.hasSupplierPayoutsProfileSignal(text) && !deps.hasAccountBalanceSignal(text)) {
|
||||
return {
|
||||
intent: "supplier_payouts_profile",
|
||||
confidence: "high",
|
||||
reasons: ["supplier_payouts_profile_signal_detected"]
|
||||
};
|
||||
}
|
||||
if (deps.hasContractUsageAndValueSignal(text) &&
|
||||
!deps.hasAccountBalanceSignal(text) &&
|
||||
!deps.hasOpenContractsListSignal(text)) {
|
||||
return {
|
||||
intent: "contract_usage_and_value",
|
||||
confidence: "high",
|
||||
reasons: ["contract_usage_and_value_signal_detected"]
|
||||
};
|
||||
}
|
||||
if (deps.hasContractListByCounterpartySignal(text)) {
|
||||
return {
|
||||
intent: "list_contracts_by_counterparty",
|
||||
confidence: "medium",
|
||||
reasons: ["contracts_by_counterparty_signal_detected"]
|
||||
};
|
||||
}
|
||||
if (deps.hasContractAnchorSignal(text) && deps.hasBankOperationSignal(text)) {
|
||||
return {
|
||||
intent: "bank_operations_by_contract",
|
||||
confidence: "medium",
|
||||
reasons: ["bank_ops_by_contract_signal_detected"]
|
||||
};
|
||||
}
|
||||
if (deps.hasContractAnchorSignal(text) &&
|
||||
(deps.hasAny(text, deps.documentsByContractHints) || deps.hasDocumentSignal(text))) {
|
||||
return {
|
||||
intent: "list_documents_by_contract",
|
||||
confidence: "medium",
|
||||
reasons: ["documents_by_contract_signal_detected"]
|
||||
};
|
||||
}
|
||||
if (deps.hasAny(text, deps.bankOperationsByCounterpartyHints) &&
|
||||
(deps.hasPartyAnchorMention(text) || deps.hasLooseByAnchorMention(text) || deps.hasHeuristicCounterpartyAnchor(text))) {
|
||||
return {
|
||||
intent: "bank_operations_by_counterparty",
|
||||
confidence: "medium",
|
||||
reasons: ["bank_ops_by_counterparty_signal_detected"]
|
||||
};
|
||||
}
|
||||
if ((deps.hasAny(text, deps.documentsByCounterpartyHints) || deps.hasCounterpartyShipmentItemFlowSignal(text)) &&
|
||||
(deps.hasPartyAnchorMention(text) ||
|
||||
deps.hasLooseByAnchorMention(text) ||
|
||||
deps.hasImplicitCounterpartyAnchorAroundDocs(text) ||
|
||||
deps.hasHeuristicCounterpartyAnchor(text) ||
|
||||
deps.hasCounterpartyShipmentItemFlowSignal(text))) {
|
||||
return {
|
||||
intent: "list_documents_by_counterparty",
|
||||
confidence: "medium",
|
||||
reasons: [
|
||||
deps.hasCounterpartyShipmentItemFlowSignal(text)
|
||||
? "counterparty_item_flow_signal_detected"
|
||||
: "documents_by_counterparty_signal_detected"
|
||||
]
|
||||
};
|
||||
}
|
||||
if (deps.hasAccountBalanceSignal(text)) {
|
||||
return {
|
||||
intent: "account_balance_snapshot",
|
||||
confidence: "high",
|
||||
reasons: ["account_balance_signal_detected"]
|
||||
};
|
||||
}
|
||||
if (deps.hasLooseByAnchorMention(text) && deps.hasGenericAddressLookupSignal(text)) {
|
||||
return {
|
||||
intent: "list_documents_by_counterparty",
|
||||
confidence: "low",
|
||||
reasons: ["generic_lookup_with_loose_anchor_fallback"]
|
||||
};
|
||||
}
|
||||
if (deps.hasAny(text, deps.openContractsHints) &&
|
||||
(text.includes("договор") || text.includes("контракт") || text.includes("contract"))) {
|
||||
return {
|
||||
intent: "open_contracts_confirmed_as_of_date",
|
||||
confidence: "medium",
|
||||
reasons: ["open_contract_signal_detected"]
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveAddressIntent = resolveAddressIntent;
|
||||
const addressCounterpartyIntentSignals_1 = require("./addressCounterpartyIntentSignals");
|
||||
const addressInventoryIntentSignals_1 = require("./addressInventoryIntentSignals");
|
||||
const inventoryLifecycleCueHelpers_1 = require("./inventoryLifecycleCueHelpers");
|
||||
const RECEIVABLES_STRONG = [
|
||||
@@ -1679,6 +1680,44 @@ function resolveAddressIntent(userMessage) {
|
||||
reasons: ["inventory_on_hand_signal_detected"]
|
||||
};
|
||||
}
|
||||
const counterpartyIntent = (0, addressCounterpartyIntentSignals_1.resolveCounterpartyAddressIntent)(text, {
|
||||
hasAny,
|
||||
openItemsHints: OPEN_ITEMS_HINTS,
|
||||
openContractsHints: OPEN_CONTRACTS_HINTS,
|
||||
documentsByCounterpartyHints: DOCUMENTS_BY_COUNTERPARTY_HINTS,
|
||||
bankOperationsByCounterpartyHints: BANK_OPERATIONS_BY_COUNTERPARTY_HINTS,
|
||||
documentsByContractHints: DOCUMENTS_BY_CONTRACT_HINTS,
|
||||
hasCounterpartyDebtLongevitySignal,
|
||||
hasInventoryAgingSignal,
|
||||
hasInventoryProvenanceSignalV2,
|
||||
hasInventoryPurchaseDocumentsSignalV2,
|
||||
hasInventorySaleTraceSignalV2,
|
||||
hasAccountNumberAnchor,
|
||||
hasCompactAccountCodeToken,
|
||||
hasPeriodCoverageProfileSignal,
|
||||
hasPartyAnchorMention,
|
||||
hasContractAnchorSignal,
|
||||
hasAccountBalanceSignal,
|
||||
hasDocumentTypeAndAccountSectionProfileSignal,
|
||||
hasCounterpartyPopulationAndRolesSignal,
|
||||
hasCounterpartyActivityLifecycleSignal,
|
||||
hasContractUsageOverviewSignal,
|
||||
hasOpenContractsListSignal,
|
||||
hasCustomerRevenueAndPaymentsSignal,
|
||||
hasSupplierPayoutsProfileSignal,
|
||||
hasContractUsageAndValueSignal,
|
||||
hasContractListByCounterpartySignal,
|
||||
hasBankOperationSignal,
|
||||
hasDocumentSignal,
|
||||
hasLooseByAnchorMention,
|
||||
hasHeuristicCounterpartyAnchor,
|
||||
hasCounterpartyShipmentItemFlowSignal,
|
||||
hasImplicitCounterpartyAnchorAroundDocs,
|
||||
hasGenericAddressLookupSignal
|
||||
});
|
||||
if (counterpartyIntent) {
|
||||
return counterpartyIntent;
|
||||
}
|
||||
if (hasOpenContractsListSignal(text)) {
|
||||
return {
|
||||
intent: "open_contracts_confirmed_as_of_date",
|
||||
|
||||
Reference in New Issue
Block a user