This commit is contained in:
Slipstream 2025-04-28 16:48:37 -06:00
parent eaa68b9e54
commit 935df1d4dd
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD
3 changed files with 14 additions and 1 deletions

View File

@ -278,6 +278,18 @@ async def background_processing_task(cog: 'GurtCog'):
# --- Automatic Mood Change (Runs based on its own interval check) ---
await maybe_change_mood(cog) # Call the mood change logic
# --- Proactive Goal Creation Check (Runs periodically) ---
if now - cog.last_proactive_goal_check > GurtConfig.PROACTIVE_GOAL_CHECK_INTERVAL: # Use imported config
print("Checking if Gurt should proactively create goals...")
try:
await proactively_create_goals(cog) # Call the function from analysis.py
cog.last_proactive_goal_check = now # Update timestamp
print("Proactive goal check complete.")
except Exception as proactive_e:
print(f"Error during proactive goal check: {proactive_e}")
traceback.print_exc()
cog.last_proactive_goal_check = now # Update timestamp even on error
except asyncio.CancelledError:
print("Background processing task cancelled")
except Exception as e:

View File

@ -126,6 +126,7 @@ class GurtCog(commands.Cog, name="Gurt"): # Added explicit Cog name
self.last_reflection_time = time.time() # Timestamp for last memory reflection
self.last_goal_check_time = time.time() # Timestamp for last goal decomposition check
self.last_goal_execution_time = time.time() # Timestamp for last goal execution check
self.last_proactive_goal_check = time.time() # Timestamp for last proactive goal check
# --- Stats Tracking ---
self.api_stats = defaultdict(lambda: {"success": 0, "failure": 0, "retries": 0, "total_time": 0.0, "count": 0}) # Keyed by model name

View File

@ -9,7 +9,7 @@ logger = logging.getLogger(__name__)
# Relative imports
from .config import (
MAX_PATTERNS_PER_CHANNEL, LEARNING_RATE, TOPIC_UPDATE_INTERVAL,
LEARNING_RATE, TOPIC_UPDATE_INTERVAL,
TOPIC_RELEVANCE_DECAY, MAX_ACTIVE_TOPICS, SENTIMENT_DECAY_RATE,
EMOTION_KEYWORDS, EMOJI_SENTIMENT # Import necessary configs
)