Уточнить оси доказательств Autonomy Core 1С

This commit is contained in:
2026-05-23 18:14:47 +03:00
parent f7314b0212
commit 4d1b25cca7
3 changed files with 92 additions and 6 deletions
@@ -34,7 +34,10 @@ function uniqueStrings(values) {
}
return result;
}
function providedAxesFromMeaning(meaning) {
function isExplicitDate(value) {
return Boolean(value && /^\d{4}-\d{2}-\d{2}$/.test(value));
}
function providedAxesFromMeaning(meaning, graph) {
const result = [];
if ((meaning?.explicit_entity_candidates?.length ?? 0) > 0) {
result.push("counterparty");
@@ -43,8 +46,15 @@ function providedAxesFromMeaning(meaning) {
if (toNonEmptyString(meaning?.explicit_organization_scope)) {
result.push("organization");
}
if (toNonEmptyString(meaning?.explicit_date_scope)) {
const explicitDateScope = toNonEmptyString(meaning?.explicit_date_scope);
if (explicitDateScope) {
result.push("period");
if (isExplicitDate(explicitDateScope)) {
result.push("as_of_date");
}
}
if (graph?.time_scope_need === "all_time_scope") {
result.push("all_time_scope");
}
if (toNonEmptyString(meaning?.asked_aggregation_axis)) {
result.push("aggregate_axis");
@@ -116,7 +126,7 @@ function buildAssistantEvidencePlanner(input) {
const plan = input.discoveryPlan;
const turnMeaning = plan.turn_meaning_ref;
const requiredAxes = uniqueStrings(plan.required_axes);
const providedAxes = providedAxesFromMeaning(turnMeaning);
const providedAxes = providedAxesFromMeaning(turnMeaning, graph);
const graphClarificationGaps = uniqueStrings(graph?.clarification_gaps ?? []);
const additionalAxisGaps = uniqueStrings(input.additionalMissingAxes ?? []).filter((axis) => !providedAxes.includes(axis) && (requiredAxes.includes(axis) || USER_ACTIONABLE_AXIS_SET.has(axis)));
const axisGaps = uniqueStrings([...additionalAxisGaps, ...missingAxes(requiredAxes, providedAxes)]);