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
+2 -1
View File
@@ -202,12 +202,13 @@ function simulateDeterministicRouting(normalized) {
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").length;
const noRouteInScopeCount = decisions.filter((item) => item.domain_relevance === "in_scope" && item.route === "no_route").length;
let fallbackType = "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";