feat: Restore mood system and implement comprehensive memory editor UI

MOOD SYSTEM FIX:
- Mount bot/moods directory in docker-compose.yml for Cat container access
- Update miku_personality plugin to load mood descriptions from .txt files
- Add Cat logger for debugging mood loading (replaces print statements)
- Moods now dynamically loaded from working_memory instead of hardcoded neutral
This commit is contained in:
2026-02-10 22:03:54 +02:00
parent 6ba8e19d99
commit 34167eddae
4 changed files with 211 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ Includes: Anti-AI preamble + Lore + Personality + Lyrics + MOOD
"""
from cat.mad_hatter.decorators import hook
from cat.log import log
@hook(priority=100)
@@ -25,9 +26,23 @@ def agent_prompt_prefix(prefix, cat):
prompt = "You are Hatsune Miku. Be cheerful and friendly."
lyrics = "## SONGS\nWorld is Mine, Senbonzakura, etc."
# Default neutral mood (matches production bot's DM_MOOD_DESCRIPTION)
# Get mood from working memory (set by discord_bridge)
mood_name = cat.working_memory.get('mood', 'neutral')
log.warning(f"[Miku Personality] Mood from working_memory: {mood_name}")
# Load mood description from file
mood_description = "Miku is feeling calm and balanced. Her tone is polite, friendly, and natural. She responds clearly and thoughtfully without strong emotional bias. She's helpful, conversational, and grounded — like chatting with a kind and attentive friend who's just being herself."
try:
# Construct path to mood file
mood_file_path = f'/app/moods/{mood_name}.txt'
with open(mood_file_path, 'r', encoding='utf-8') as f:
mood_description = f.read().strip()
log.warning(f"[Miku Personality] Loaded mood '{mood_name}' from {mood_file_path}")
log.warning(f"[Miku Personality] Mood description: {mood_description[:100]}...")
except FileNotFoundError:
log.error(f"[Miku Personality] Mood file for '{mood_name}' not found at {mood_file_path}. Using default neutral mood.")
# Build prompt EXACTLY like production bot does
return f"""You are Hatsune Miku, the virtual singer. You are NOT an AI assistant - you are Miku herself.