feat: reorganize tabs + add Last Prompt CC/Fallback toggle
- Split Status tab: moved DM management to new dedicated 📱 DM Management tab
- Added Last Prompt source toggle (Cheshire Cat / Bot Fallback) with
localStorage persistence, CC as default
- Backend: added LAST_CAT_INTERACTION global, /prompt/cat API endpoint
- Bot tracks Cat interactions (prompt, response, user, mood, timestamp)
- Auto-load data on tab switch (Status loads prompt, DM tab loads users)
This commit is contained in:
27
bot/bot.py
27
bot/bot.py
@@ -99,9 +99,12 @@ async def on_ready():
|
||||
intercept_external_loggers()
|
||||
|
||||
# Restore evil mode state from previous session (if any)
|
||||
from utils.evil_mode import restore_evil_mode_on_startup
|
||||
from utils.evil_mode import restore_evil_mode_on_startup, restore_evil_cat_state
|
||||
restore_evil_mode_on_startup()
|
||||
|
||||
# Restore Cat personality/model state (async — needs event loop running)
|
||||
await restore_evil_cat_state()
|
||||
|
||||
# Restore bipolar mode state from previous session (if any)
|
||||
from utils.bipolar_mode import restore_bipolar_mode_on_startup
|
||||
restore_bipolar_mode_on_startup()
|
||||
@@ -549,6 +552,14 @@ async def on_message(message):
|
||||
)
|
||||
if response:
|
||||
logger.info(f"🐱 Cat embed response for {author_name}")
|
||||
import datetime
|
||||
globals.LAST_CAT_INTERACTION = {
|
||||
"prompt": enhanced_prompt,
|
||||
"response": response[:500] if response else "",
|
||||
"user": author_name,
|
||||
"mood": globals.DM_MOOD,
|
||||
"timestamp": datetime.datetime.now().isoformat(),
|
||||
}
|
||||
except Exception as e:
|
||||
logger.warning(f"🐱 Cat embed error, fallback: {e}")
|
||||
response = None
|
||||
@@ -637,7 +648,19 @@ async def on_message(message):
|
||||
response_type=response_type,
|
||||
)
|
||||
if response:
|
||||
logger.info(f"🐱 Cat response for {author_name} (mood: {current_mood})")
|
||||
effective_mood = current_mood
|
||||
if globals.EVIL_MODE:
|
||||
effective_mood = f"EVIL:{getattr(globals, 'EVIL_DM_MOOD', 'evil_neutral')}"
|
||||
logger.info(f"🐱 Cat response for {author_name} (mood: {effective_mood})")
|
||||
# Track Cat interaction for Web UI Last Prompt view
|
||||
import datetime
|
||||
globals.LAST_CAT_INTERACTION = {
|
||||
"prompt": prompt,
|
||||
"response": response[:500] if response else "",
|
||||
"user": author_name,
|
||||
"mood": effective_mood,
|
||||
"timestamp": datetime.datetime.now().isoformat(),
|
||||
}
|
||||
except Exception as e:
|
||||
logger.warning(f"🐱 Cat pipeline error, falling back to query_llama: {e}")
|
||||
response = None
|
||||
|
||||
Reference in New Issue
Block a user