ГЛОБАЛЬНЫЙ РЕФАКТОРИНГ АРХИТЕКТУРЫ - Рефакторинг этапов Stage 3.6 Усилина оркестрация и детект data-scope для живого сленга. Убрана шаблонность soft-refusal в limited-ответах. Подрезана словарнаю жирность в фильтр-экстракторе

This commit is contained in:
2026-04-11 19:45:20 +03:00
parent 88d5561fad
commit 351993430f
20 changed files with 2060 additions and 830 deletions
+37
View File
@@ -2416,6 +2416,43 @@ Implemented in current pass (Stage 3.4 deep/living soft-refusal boundary widenin
- Stage 3 focused suite (+boundary): `12` files / `348` tests passed.
- Type build: `npm --prefix llm_normalizer/backend run build` passed.
Implemented in current pass (Stage 3.5 evidence-first soft policy reply):
1. Added soft policy renderer for weak deep-policy envelopes:
- For weak `broad_partial` and clarification/no-grounded envelopes, final user reply now uses concise non-sectional soft format (`Коротко`, `Что уже проверено`, `Что пока не доказано`, `Что могу сделать сейчас`).
- Prevents repeated rigid section template in weak-evidence responses while preserving actionable next steps.
2. Added explicit policy gate for soft rendering:
- `shouldUseSoftPolicyReply(...)` evaluates mode + coverage gaps + weak evidence signals (`broad_query_detected`, `minimum_evidence_failed`, low confidence, critical limitation reason codes).
- Keeps structured sectioned renderer for strong grounded envelopes.
3. Preserved strong answer path:
- `focused_grounded` / high-confidence cases continue to use structured policy layout with explicit sections.
4. Added regression coverage:
- New `assistantSoftPolicyReply.test.ts`:
- weak broad-partial -> soft non-template reply;
- strong grounded -> structured sectioned reply.
5. Validation snapshot:
- Stage 3 focused suite (+soft policy): `13` files / `350` tests passed.
- Type build: `npm --prefix llm_normalizer/backend run build` passed.
Implemented in current pass (Stage 3.6 route arbitration hardening + followup isolation):
1. Isolated standalone address topics from stale followup carryover:
- Added standalone-topic detector (`hasStandaloneAddressTopicSignal`) and applied it in followup signal/carryover gates.
- Explicit standalone requests with their own anchor (`date/account/object`) no longer inherit previous address followup context by default.
2. Hardened orchestration for real regression cases:
- Added explicit open-contract lookup signal guard (`hasOpenContractsAddressSignal`) to keep `list_open_contracts` style requests in address lane even with stale deep context.
- Extended aggregate fallback arbitration so stale followup context cannot pin standalone aggregate queries in address lane (`aggregate_analytics_signal_fallback_to_deep` remains allowed).
3. Improved data-scope slang detection resilience:
- Added direct slang lead detection for queries like `по каким конторам можем общаться` / `какая база подрублена`.
- Preserved deterministic chat/data-scope routing despite aggressive predecompose rewrites.
4. Reduced limited-reply template repetition:
- Reworked unsupported/aggregate limited phrasing in `composeLimitedReply(...)` to softer non-rigid variants.
- Suppressed redundant `Сигнал запроса` line for unsupported aggregate envelopes.
5. Reduced dictionary overfitting pressure in filter extraction:
- Shrunk `COUNTERPARTY_TOKEN_NOISE` to compact core stopwords.
- Added pattern-based filler/slang/profanity detector (`isCounterpartyFillerToken`) instead of expanding static token lists.
6. Validation snapshot:
- Targeted regression pack: `4` files / `318` tests passed (`assistantLivingRouter`, `assistantLivingChatMode`, `addressQueryRuntimeM23`, `assistantSoftPolicyReply`).
- Type build: `npm --prefix llm_normalizer/backend run build` passed.
Acceptance (Stage 3):
1. LLM outputs strictly validated schema for extraction/decomposition (no free-form).
2. Deterministic guards can block or downgrade answers when evidence insufficient.