ДОМЕНЫ - ВОПРОСЫ - кто должен нам
This commit is contained in:
@@ -2,7 +2,11 @@
|
||||
|
||||
const RECEIVABLES_STRONG = [
|
||||
"кто должен нам",
|
||||
"кто нам должен",
|
||||
"кто нам должэн",
|
||||
"нам должны",
|
||||
"нам должен",
|
||||
"нам должэны",
|
||||
"who owes us",
|
||||
"receivable",
|
||||
"receivables",
|
||||
@@ -14,7 +18,11 @@ const RECEIVABLES_STRONG = [
|
||||
|
||||
const PAYABLES_STRONG = [
|
||||
"кому должны мы",
|
||||
"кому должэны мы",
|
||||
"кому мы должны",
|
||||
"кому мы должэны",
|
||||
"мы должны",
|
||||
"мы должэны",
|
||||
"who we owe",
|
||||
"payable",
|
||||
"payables",
|
||||
@@ -1012,6 +1020,22 @@ function hasPayablesDebtLifecycleSignal(text: string): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
function hasReceivablesDebtLifecycleSignal(text: string): boolean {
|
||||
const hasOweUsSignal =
|
||||
/(?:кто\s+нам\s+долж(?:ен|ны)?|кто\s+долж(?:ен|ны)?\s+нам|нам\s+долж(?:ен|ны)|должник(?:и|ов|а)?|дебитор(?:ы|ов|ск)?|задолж|долг(?:и|ов|а|у)?|к\s+получению|на\s+поступление|к\s+взысканию|who\s+owes\s+us|receivables?)/iu.test(
|
||||
text
|
||||
);
|
||||
if (!hasOweUsSignal) {
|
||||
return false;
|
||||
}
|
||||
const hasPastInflowSignal = /(?:прин[её]с|зан[её]с|поступил|приход|inflow|paid\s+us|already\s+paid)/iu.test(text);
|
||||
const hasTopRankingSignal = /(?:топ|top|больше\s+всего|сам(?:ый|ая|ое|ые)|наибольш|максимальн)/iu.test(text);
|
||||
if (hasPastInflowSignal && hasTopRankingSignal) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function hasReceivablesLatencyRiskSignal(text: string): boolean {
|
||||
const hasBuyer = /(?:покупател|клиент|заказчик|customer|buyer)/iu.test(text);
|
||||
const hasCounterparty = /(?:контрагент|counterparty|partner)/iu.test(text);
|
||||
@@ -1452,10 +1476,15 @@ export function resolveAddressIntent(userMessage: string): AddressIntentResoluti
|
||||
}
|
||||
|
||||
if (hasAny(text, RECEIVABLES_STRONG)) {
|
||||
const receivablesDebtLifecycleSignal = hasReceivablesDebtLifecycleSignal(text);
|
||||
const reasons = ["receivables_signal_detected"];
|
||||
if (receivablesDebtLifecycleSignal) {
|
||||
reasons.push("receivables_debt_lifecycle_signal_detected");
|
||||
}
|
||||
return {
|
||||
intent: "list_receivables_counterparties",
|
||||
intent: receivablesDebtLifecycleSignal ? "receivables_confirmed_as_of_date" : "list_receivables_counterparties",
|
||||
confidence: "high",
|
||||
reasons: ["receivables_signal_detected"]
|
||||
reasons
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user