fix: роутер — сметные операции всегда → Claude Code
Добавлены keywords: внеси, обнови, заполни, строк, ячейк, лист, ссрсс, смет Partial match имён файлов (ВСП → находит ЛС-01-02-4-00-01 ВСП.xlsx) "внеси стоимость из ВСП в ССРСС" раньше шло в GLM, теперь в Claude. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -42,17 +42,26 @@ elif AI_BACKEND == "auto":
|
|||||||
"перенеси данн", "измени файл", "отредактируй", "скопируй",
|
"перенеси данн", "измени файл", "отредактируй", "скопируй",
|
||||||
"проверь смет", "проверь файл", "открой файл", "покажи файл",
|
"проверь смет", "проверь файл", "открой файл", "покажи файл",
|
||||||
"загруж", "прикреп", "файл", ".xlsx", ".docx", ".pdf", ".csv",
|
"загруж", "прикреп", "файл", ".xlsx", ".docx", ".pdf", ".csv",
|
||||||
|
"внеси", "обнови", "заполни", "строк", "ячейк", "лист",
|
||||||
|
"ссрсс", "ссрс", "ведомост", "смет",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Check if message references files in work directory
|
# Check if message references files in work directory (partial match)
|
||||||
from claude_bridge_glm import get_work_dir as _get_wd
|
from claude_bridge_glm import get_work_dir as _get_wd
|
||||||
work_dir = _get_wd(username, tab_id)
|
work_dir = _get_wd(username, tab_id)
|
||||||
file_names = []
|
has_files = False
|
||||||
|
mentions_file = False
|
||||||
if work_dir.exists():
|
if work_dir.exists():
|
||||||
file_names = [f.name.lower() for f in work_dir.iterdir()
|
for f in work_dir.iterdir():
|
||||||
if f.is_file() and not f.name.startswith(".")]
|
if f.is_file() and not f.name.startswith("."):
|
||||||
|
has_files = True
|
||||||
|
# Check partial name match (without extension)
|
||||||
|
stem = f.stem.lower()
|
||||||
|
parts = [p for p in stem.replace("-", " ").replace("_", " ").split() if len(p) > 2]
|
||||||
|
if any(p in msg_lower for p in parts):
|
||||||
|
mentions_file = True
|
||||||
|
break
|
||||||
|
|
||||||
mentions_file = any(fn in msg_lower for fn in file_names) if file_names else False
|
|
||||||
has_keyword = any(kw in msg_lower for kw in claude_keywords)
|
has_keyword = any(kw in msg_lower for kw in claude_keywords)
|
||||||
|
|
||||||
use_claude = mentions_file or has_keyword
|
use_claude = mentions_file or has_keyword
|
||||||
|
|||||||
Reference in New Issue
Block a user