Stage 3: улучшена логика жизненного цикла и очищены ответы ассистента

This commit is contained in:
2026-03-26 20:21:51 +03:00
parent d0b842adb0
commit 914843a8ba
81 changed files with 18051 additions and 654 deletions
@@ -237,6 +237,7 @@ export function simulateDeterministicRouting(normalized: V2Family): RouteHintSum
const decisions = normalized.fragments.map((fragment) => decideRouteForFragment(fragment));
const inScopeCount = decisions.filter((item) => item.domain_relevance === "in_scope").length;
const outOfScopeCount = decisions.filter((item) => item.domain_relevance === "out_of_scope").length;
const unclearCount = decisions.filter((item) => item.domain_relevance === "unclear").length;
const routedInScopeCount = decisions.filter((item) => item.domain_relevance === "in_scope" && item.route !== "no_route").length;
const clarificationInScopeCount = decisions.filter(
(item) => item.domain_relevance === "in_scope" && item.execution_readiness === "needs_clarification"
@@ -245,7 +246,7 @@ export function simulateDeterministicRouting(normalized: V2Family): RouteHintSum
let fallbackType: RouteHintSummaryV2["fallback"]["type"] = "none";
if (!normalized.message_in_scope || inScopeCount === 0) {
fallbackType = "out_of_scope";
fallbackType = outOfScopeCount > 0 && unclearCount === 0 ? "out_of_scope" : "clarification";
} else if (routedInScopeCount === 0 && clarificationInScopeCount > 0) {
fallbackType = "clarification";
} else if (routedInScopeCount === 0 && noRouteInScopeCount > 0) {