Уточнить оси доказательств 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
@@ -113,7 +113,14 @@ function uniqueStrings(values: unknown[]): string[] {
return result;
}
function providedAxesFromMeaning(meaning: AssistantMcpDiscoveryTurnMeaningRef | null): string[] {
function isExplicitDate(value: string | null): boolean {
return Boolean(value && /^\d{4}-\d{2}-\d{2}$/.test(value));
}
function providedAxesFromMeaning(
meaning: AssistantMcpDiscoveryTurnMeaningRef | null,
graph: AssistantMcpDiscoveryDataNeedGraphContract | null
): string[] {
const result: string[] = [];
if ((meaning?.explicit_entity_candidates?.length ?? 0) > 0) {
result.push("counterparty");
@@ -122,8 +129,15 @@ function providedAxesFromMeaning(meaning: AssistantMcpDiscoveryTurnMeaningRef |
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");
@@ -209,7 +223,7 @@ export function buildAssistantEvidencePlanner(
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)),