Этап 4 добивка двух хвостов: settlement polarity и чистое разделение month_close / RBP в live acceptance
This commit is contained in:
@@ -202,18 +202,45 @@ function hasP0ClaimSignal(claimType, focusDomainHint) {
|
||||
focusDomainHint === "month_close_costs_20_44" ||
|
||||
focusDomainHint === "fixed_asset_amortization");
|
||||
}
|
||||
function hasSettlementScopeSignal(input) {
|
||||
const claim = String(input.claimType ?? "").trim();
|
||||
const domain = String(input.focusDomainHint ?? "").trim();
|
||||
if (claim === "prove_settlement_closure_state" || claim === "prove_advance_offset_state" || domain === "settlements_60_62") {
|
||||
return true;
|
||||
}
|
||||
if (Boolean(input.followupApplied) && domain === "settlements_60_62") {
|
||||
return true;
|
||||
}
|
||||
const lower = String(input.userMessage ?? "").toLowerCase();
|
||||
if (/(?:60(?:\\.\\d{2})?|62(?:\\.\\d{2})?|76(?:\\.\\d{2})?|оплат|расч[её]т|зач[её]т|аванс|долг|хвост|supplier|customer|settlement|payable|receivable|поставщ|покупат)/i.test(lower)) {
|
||||
return true;
|
||||
}
|
||||
const accounts = Array.isArray(input.companyAnchors?.accounts) ? input.companyAnchors.accounts : [];
|
||||
return accounts.some((item) => /^(?:51|60|62|76)(?:\\.|$)/.test(String(item ?? "").trim()));
|
||||
}
|
||||
function resolveBusinessScopeFromLiveContext(input) {
|
||||
const current = input.current;
|
||||
const routeSummary = current?.route_summary_resolved;
|
||||
const julyResolved = isJuly2020TemporalResolved(input.temporalGuard);
|
||||
const p0Signal = hasP0ClaimSignal(input.claimType, input.focusDomainHint);
|
||||
if (!julyResolved || !p0Signal) {
|
||||
const settlementScopeSignal = hasSettlementScopeSignal({
|
||||
userMessage: input.userMessage,
|
||||
companyAnchors: input.companyAnchors,
|
||||
claimType: input.claimType,
|
||||
focusDomainHint: input.focusDomainHint,
|
||||
followupApplied: input.followupApplied
|
||||
});
|
||||
const shouldRecoverScope = p0Signal && (julyResolved || settlementScopeSignal);
|
||||
if (!shouldRecoverScope) {
|
||||
return current;
|
||||
}
|
||||
const reasons = Array.isArray(current.scope_resolution_reason) ? [...current.scope_resolution_reason] : [];
|
||||
if (!reasons.includes("temporal_claim_bound_company_scope_recovery")) {
|
||||
if (julyResolved && !reasons.includes("temporal_claim_bound_company_scope_recovery")) {
|
||||
reasons.push("temporal_claim_bound_company_scope_recovery");
|
||||
}
|
||||
if (settlementScopeSignal && !reasons.includes("settlement_claim_company_scope_recovery")) {
|
||||
reasons.push("settlement_claim_company_scope_recovery");
|
||||
}
|
||||
const currentScopes = Array.isArray(current.business_scope_resolved) ? current.business_scope_resolved : [];
|
||||
let changed = false;
|
||||
const normalizedScopes = currentScopes
|
||||
@@ -1747,7 +1774,10 @@ export class AssistantService {
|
||||
current: initialBusinessScopeResolution,
|
||||
temporalGuard,
|
||||
claimType: claimAnchorAudit.claim_type,
|
||||
focusDomainHint: focusDomainForGuards
|
||||
focusDomainHint: focusDomainForGuards,
|
||||
userMessage,
|
||||
companyAnchors,
|
||||
followupApplied: Boolean(followupBinding.usage?.applied)
|
||||
});
|
||||
const resolvedRouteSummary = businessScopeResolution.route_summary_resolved;
|
||||
const requirementExtraction = extractRequirements(resolvedRouteSummary, normalized.normalized, userMessage);
|
||||
@@ -1966,6 +1996,9 @@ export class AssistantService {
|
||||
resolved_account_anchors: polarityGuardResult.audit.resolved_account_anchors,
|
||||
domain_polarity_guard: polarityGuardResult.audit,
|
||||
claim_anchor_audit: claimAnchorAudit,
|
||||
settlement_role: claimAnchorAudit.settlement_role ?? null,
|
||||
settlement_role_resolution_reason: claimAnchorAudit.settlement_role_resolution_reason ?? [],
|
||||
polarity_resolution_status: claimAnchorAudit.polarity_resolution_status ?? "not_applicable",
|
||||
targeted_evidence_acquisition: targetedEvidenceResult.audit,
|
||||
evidence_admissibility_gate: evidenceGateResult.audit,
|
||||
...(rbpLiveRouteAudit ? { rbp_live_route_audit: rbpLiveRouteAudit } : {}),
|
||||
@@ -2060,6 +2093,9 @@ export class AssistantService {
|
||||
resolved_account_anchors: polarityGuardResult.audit.resolved_account_anchors,
|
||||
domain_polarity_guard: polarityGuardResult.audit,
|
||||
claim_anchor_audit: claimAnchorAudit,
|
||||
settlement_role: claimAnchorAudit.settlement_role ?? null,
|
||||
settlement_role_resolution_reason: claimAnchorAudit.settlement_role_resolution_reason ?? [],
|
||||
polarity_resolution_status: claimAnchorAudit.polarity_resolution_status ?? "not_applicable",
|
||||
targeted_evidence_acquisition: targetedEvidenceResult.audit,
|
||||
evidence_admissibility_gate: evidenceGateResult.audit,
|
||||
...(rbpLiveRouteAudit ? { rbp_live_route_audit: rbpLiveRouteAudit } : {}),
|
||||
|
||||
Reference in New Issue
Block a user