From 06be74e8907c42db6f0f6acaec3b65ff411017b7 Mon Sep 17 00:00:00 2001 From: anor Date: Fri, 27 Mar 2026 01:47:49 +1000 Subject: [PATCH] =?UTF-8?q?fix:=20RAG=20threshold=200.83=20+=20=D1=80?= =?UTF-8?q?=D0=B0=D1=81=D1=88=D0=B8=D1=80=D0=B5=D0=BD=D0=BD=D1=8B=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=B0=D1=82=D1=82=D0=B5=D1=80=D0=BD=D1=8B=20=D1=80=D0=B5?= =?UTF-8?q?=D1=81=D1=83=D1=80=D1=81=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B8=D1=81=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Тест 205 запросов выявил: 1. Порог 0.5 бесполезен (все scores 0.79-0.89) → повышен до 0.83 2. Normative RAG затенял Resources и CAG → теперь параллельно 3. Ресурсный поиск срабатывал на 6 слов → расширен до 30+ паттернов Результат: "рецепт борща" отсекается, "индексы Q1 2026" находится. Co-Authored-By: Claude Opus 4.6 (1M context) --- claude_bridge_glm.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/claude_bridge_glm.py b/claude_bridge_glm.py index 2216ab4..4219dfa 100644 --- a/claude_bridge_glm.py +++ b/claude_bridge_glm.py @@ -94,7 +94,7 @@ def _search_normative(query: str, top_k: int = 3) -> str: results = [] for dist, idx in zip(D[0], I[0]): - if dist < 0.5: # skip low relevance + if dist < 0.83: # e5-base scores cluster 0.79-0.89; 0.83 balances precision/recall continue m = _norm_metadata[idx] results.append(f"[{m['source']}] {m['full_text'][:500]}") @@ -245,9 +245,16 @@ async def stream_claude( work_dir = get_work_dir(username, tab_id) - # Search resources if question looks like a GESN lookup + # Search resources if question mentions works/norms/materials resource_context = "" - gesn_patterns = ["расценк", "гэсн", "норм", "28-", "01-", "единиц"] + gesn_patterns = [ + "расценк", "гэсн", "норм", "28-", "01-", "единиц", + "земляны", "бетон", "монтаж", "насыпь", "балласт", "рельс", + "стрелоч", "шпал", "щебен", "щебн", "укладк", "разборк", + "кровел", "штукатур", "гидроизоляц", "теплоизоляц", "трубопровод", + "кабел", "электромонтаж", "сантехн", "вентиляц", "благоустр", + "сварочн", "устройство", "ремонт пути", "всп", "сцб", + ] if any(p in message.lower() for p in gesn_patterns): resource_context = _search_resources(message)