diff --git a/app/core/async_router.py b/app/core/async_router.py index 11e1214..c51b7e3 100644 --- a/app/core/async_router.py +++ b/app/core/async_router.py @@ -366,12 +366,12 @@ class AsyncRouter: classification_prompt = f"""Классифицируй запрос пользователя: "{task_summary}" -Правила: -- execution: пользователь ХОЧЕТ выполнить действие (проверить, запустить, создать, удалить, найти, прочитать, записать) -- conversation: пользователь просто отвечает, задаёт вопрос или хочет информацию -- clarification_needed: непонятно что делать +Классы: +- execution: чтобы ответить, агенту нужно обратиться к локальной среде, файлам, shell, tools, памяти, сети или выполнить проверку/операцию. Это включает вопросы о текущем состоянии ПК, установленных пакетах, файлах, процессах, времени работы, обновлениях, логах. +- conversation: можно ответить сразу из диалога и общих знаний, без проверки локальной среды и без tools. +- clarification_needed: нельзя понять, что именно пользователь хочет. -Ответь ОДНИМ словом: execution / conversation / clarification_needed""" +Верни ровно один токен без рассуждений: execution или conversation или clarification_needed""" try: result = await classifier_model.generate(classification_prompt) diff --git a/app/core/intent_parser.py b/app/core/intent_parser.py index a5af87a..61adda1 100644 --- a/app/core/intent_parser.py +++ b/app/core/intent_parser.py @@ -23,21 +23,8 @@ MEMORY_STORE_PATTERNS = ( ) MEMORY_SEARCH_PATTERNS = ( - r"найди\s+(.+)", r"вспомни\s+(.+)", - r"search\s+(.+)", - r"find\s+(.+)", -) - -SYSTEM_COMMAND_PATTERNS = ( - ( - re.compile(r"(сколько\s+времени\s+запущен|как\s+долго\s+работает|uptime|аптайм)", re.IGNORECASE), - "uptime -p", - ), - ( - re.compile(r"(проверь|посмотри|покажи).*(обновлен|обновл|updates|upgradable)", re.IGNORECASE), - "apt list --upgradable", - ), + r"search memory\s+(.+)", ) @@ -80,19 +67,6 @@ class IntentParser: reason="User explicitly requested to search memory.", ) - for pattern, command in SYSTEM_COMMAND_PATTERNS: - if pattern.search(normalized): - return ExecutionDirective( - type="tool", - payload={ - "tool": "shell_exec", - "args": {"command": command}, - }, - requires_permission=True, - confidence=0.9, - reason="User explicitly requested local system information.", - ) - for prefix in SHELL_PREFIXES: if lowered.startswith(prefix): command = normalized[len(prefix) :].strip() diff --git a/config/prompts/thinker.md b/config/prompts/thinker.md index 4c3fc89..cd6aad2 100644 --- a/config/prompts/thinker.md +++ b/config/prompts/thinker.md @@ -11,6 +11,9 @@ INSTRUCTIONS: 1. Understand what user wants 2. Create step-by-step plan in natural language 3. Choose appropriate tools from available +4. If the user asks about the current local machine, filesystem, processes, + packages, logs, runtime state, or anything that must be observed rather than + answered from general knowledge, use an appropriate tool. MODE: {mode_hint} - If mode is "execution": create a plan with TOOL STEPS (shell_exec, file_write, etc)