ARCH: довести surface-aware planner и catalog search
This commit is contained in:
@@ -109,13 +109,29 @@ function aggregationNeedFor(axis: string): string | null {
|
||||
return `by_${axis}`;
|
||||
}
|
||||
|
||||
function hasAllTimeScopeHint(rawUtterance: string): boolean {
|
||||
if (!rawUtterance) {
|
||||
return false;
|
||||
}
|
||||
return /(?:\u0437\u0430\s+\u0432\u0441[\u0435\u0451]\s+\u0432\u0440\u0435\u043c\u044f|\u0437\u0430\s+\u0432\u0435\u0441\u044c\s+\u043f\u0435\u0440\u0438\u043e\u0434|\u0437\u0430\s+\u0432\u0441\u044e\s+\u0438\u0441\u0442\u043e\u0440\u0438(?:\u044e|\u0438)|\u0437\u0430\s+\u043b\u044e\u0431\u043e\u0439\s+\u043f\u0435\u0440\u0438\u043e\u0434|for\s+all\s+time|all\s+time|entire\s+period|full\s+history|any\s+period)/iu.test(
|
||||
rawUtterance
|
||||
);
|
||||
}
|
||||
|
||||
function timeScopeNeedFor(input: {
|
||||
family: string | null;
|
||||
explicitDateScope: string | null;
|
||||
allTimeScopeHint: boolean;
|
||||
}): string | null {
|
||||
if (input.explicitDateScope) {
|
||||
return "explicit_period";
|
||||
}
|
||||
if (
|
||||
input.allTimeScopeHint &&
|
||||
(input.family === "value_flow" || input.family === "movement_evidence" || input.family === "document_evidence")
|
||||
) {
|
||||
return "all_time_scope";
|
||||
}
|
||||
if (input.family === "value_flow" || input.family === "movement_evidence" || input.family === "document_evidence") {
|
||||
return "period_required";
|
||||
}
|
||||
@@ -341,6 +357,7 @@ export function buildAssistantMcpDiscoveryDataNeedGraph(
|
||||
const aggregationNeed = aggregationNeedFor(aggregationAxis);
|
||||
const comparisonNeed = comparisonNeedFor(action);
|
||||
const rankingNeed = rankingNeedFromRawUtterance(rawUtterance) ?? seededRankingNeed;
|
||||
const allTimeScopeHint = hasAllTimeScopeHint(rawUtterance);
|
||||
const oneSidedOpenScopeTotalHint = hasOpenScopeOneSidedValueTotalHintUtf8Safe(rawUtterance, action);
|
||||
const openScopeWithoutSubject =
|
||||
subjectCandidates.length === 0 &&
|
||||
@@ -368,7 +385,8 @@ export function buildAssistantMcpDiscoveryDataNeedGraph(
|
||||
}
|
||||
const timeScopeNeed = timeScopeNeedFor({
|
||||
family: businessFactFamily,
|
||||
explicitDateScope
|
||||
explicitDateScope,
|
||||
allTimeScopeHint
|
||||
});
|
||||
if (timeScopeNeed === "period_required" && !explicitDateScope) {
|
||||
pushUnique(clarificationGaps, "period");
|
||||
@@ -400,6 +418,9 @@ export function buildAssistantMcpDiscoveryDataNeedGraph(
|
||||
if (openScopeWithoutSubject && !rankingNeed && !comparisonNeed) {
|
||||
pushReason(reasonCodes, "data_need_graph_open_scope_total_without_subject");
|
||||
}
|
||||
if (allTimeScopeHint) {
|
||||
pushReason(reasonCodes, "data_need_graph_all_time_scope_hint");
|
||||
}
|
||||
if (clarificationGaps.includes("organization")) {
|
||||
pushReason(reasonCodes, "data_need_graph_open_scope_total_needs_organization");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user