From 09464043bf55997be2ff7fb5e2773f10d0f89494 Mon Sep 17 00:00:00 2001 From: roberts Date: Mon, 30 Mar 2026 13:37:53 -0500 Subject: [PATCH] Fix: task executes before response, craft parses single word MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Commands now get a quick "On it" / "Got it" acknowledgment - No AI call before task runs — Doug does the task FIRST - Craft regex captures single word only ("sticks" not "sticks with") Co-Authored-By: Claude Opus 4.6 (1M context) --- dougbot/core/command_parser.py | 2 +- dougbot/gui/main_window.py | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/dougbot/core/command_parser.py b/dougbot/core/command_parser.py index 53ae1fb..0e3bb7b 100644 --- a/dougbot/core/command_parser.py +++ b/dougbot/core/command_parser.py @@ -57,7 +57,7 @@ class CommandParser: ] CRAFT_PATTERNS = [ - r"(?:craft|make|build|create)\s+(?:a\s+|an\s+|some\s+|me\s+)?(\w+(?:\s+\w+)?)", + r"(?:craft|make|build|create)\s+(?:a\s+|an\s+|some\s+|me\s+)?(\w+)", ] MINE_PATTERNS = [ diff --git a/dougbot/gui/main_window.py b/dougbot/gui/main_window.py index 1b08c56..6cb4085 100644 --- a/dougbot/gui/main_window.py +++ b/dougbot/gui/main_window.py @@ -2,6 +2,8 @@ Main application window - handles screen switching and Doug lifecycle. """ +import random + from PySide6.QtWidgets import QMainWindow, QStackedWidget, QMessageBox from PySide6.QtCore import QTimer, Signal @@ -427,16 +429,20 @@ class MainWindow(QMainWindow): if not task: return False - # Add task to brain's queue + # Add task to brain's queue — task runs first, then Doug responds self._brain._tasks.add(task) log.info(f"Command from {sender}: {cmd.action} → task '{task.name}'") - # Generate a personality-appropriate acknowledgment via AI - ack_prompt = ( - f"{sender} asked you to: {message}. " - f"You understood and are now doing it. Acknowledge briefly." - ) - self._generate_response("SYSTEM", f"[Command: {cmd.action}] {ack_prompt}") + # Short acknowledgment ONLY — no AI call, just a quick "on it" type response + # The real response comes after the task completes or fails + if self._ws_client: + ack = random.choice([ + "On it.", "Got it.", "Sure.", "Okay.", "Alright.", + "Yep.", "One sec.", "Working on it.", "Right.", + ]) + self._ws_client.send_chat(ack) + self.dashboard.log_viewer.append_chat(self._active_doug.name, ack) + return True # ── Brain Chat ──