ГЛОБАЛЬНЫЙ РЕФАКТОРИНГ АРХИТЕКТУРЫ - Рефакторинг этапов Stage 3.3: убран шаблонный LIMITED_WITH_REASON и переведен в контекстный мягкий отказ с полезными next-step.

This commit is contained in:
2026-04-11 17:22:25 +03:00
parent c2fa360eb9
commit a0d0f95dde
5 changed files with 597 additions and 50 deletions
+19
View File
@@ -2382,6 +2382,25 @@ Implemented in current pass (Stage 3.2 semantic route arbitration):
- Stage 3 focused suite: `10` files / `76` tests passed.
- Type build: `npm --prefix llm_normalizer/backend run build` passed.
Implemented in current pass (Stage 3.3 soft-refusal + anti-template limited replies):
1. Reworked address-lane limited reply composer from fixed template to contextual soft-refusal:
- Added deterministic phrasing variants (stable, non-random) to reduce repeated boilerplate.
- Kept concise "Коротко" structure while replacing hard repeated wording.
2. Added context-aware explanation and recovery offers for limited responses:
- Response now injects request scope hints when available (organization, as-of date, period window).
- Added "Что могу сделать сейчас" with nearest supported scenarios (documents/payments by anchor, open contracts/tails, account-balance drilldown).
- Added weak-anchor suppression for user-facing hints to avoid low-value auto-substitutions in suggestions.
3. Improved unsupported aggregate handling UX:
- For aggregate/ranking style queries, reply now proposes evidence-first path (collect factual base -> continue in extended analysis) instead of hard static fallback phrase.
4. Improved missing-anchor UX:
- Missing anchor tokens are normalized to user-facing terms (e.g., `counterparty_or_contract` -> "контрагент или договор").
- Added concrete reformulation hint for underspecified anchor cases.
5. Regression updates:
- Updated `addressQueryRuntimeM23.test.ts` soft out-of-scope assertion to validate contextual soft-refusal structure.
6. Validation snapshot:
- Extended regression pack: `11` files / `344` tests passed.
- 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.