Compare commits
6 Commits
191a368258
...
f0b5d71097
| Author | SHA1 | Date | |
|---|---|---|---|
| f0b5d71097 | |||
| 0cdf26dc34 | |||
| 1037d13b0a | |||
| 5bdd907730 | |||
| 820a226dd9 | |||
| e0dc190710 |
@@ -201,6 +201,14 @@ def get_logs():
|
||||
def get_last_prompt():
|
||||
return {"prompt": globals.LAST_FULL_PROMPT or "No prompt has been issued yet."}
|
||||
|
||||
@app.get("/prompt/cat")
|
||||
def get_last_cat_prompt():
|
||||
"""Get the last Cheshire Cat interaction (prompt + response) for Web UI."""
|
||||
interaction = globals.LAST_CAT_INTERACTION
|
||||
if not interaction.get("prompt"):
|
||||
return {"prompt": "No Cheshire Cat interaction has occurred yet.", "response": "", "user": "", "mood": "", "timestamp": ""}
|
||||
return interaction
|
||||
|
||||
@app.get("/mood")
|
||||
def get_current_mood():
|
||||
return {"mood": globals.DM_MOOD, "description": globals.DM_MOOD_DESCRIPTION}
|
||||
|
||||
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
|
||||
|
||||
@@ -68,7 +68,7 @@ AVAILABLE_MOODS = [
|
||||
EVIL_MODE = False
|
||||
EVIL_DM_MOOD = "evil_neutral"
|
||||
EVIL_DM_MOOD_DESCRIPTION = "Evil Miku is calculating and cold."
|
||||
EVIL_AVAILABLE_MOODS = ["aggressive", "cunning", "sarcastic", "evil_neutral"]
|
||||
EVIL_AVAILABLE_MOODS = ["aggressive", "cunning", "sarcastic", "evil_neutral", "bored", "manic", "jealous", "melancholic", "playful_cruel", "contemptuous"]
|
||||
# EVIL_MOOD_EMOJIS removed — canonical source is utils/moods.py
|
||||
|
||||
# Bipolar Mode System (both Mikus can argue via webhooks)
|
||||
@@ -83,6 +83,15 @@ BOT_USER = None
|
||||
|
||||
LAST_FULL_PROMPT = ""
|
||||
|
||||
# Cheshire Cat last interaction tracking (for Web UI Last Prompt toggle)
|
||||
LAST_CAT_INTERACTION = {
|
||||
"prompt": "",
|
||||
"response": "",
|
||||
"user": "",
|
||||
"mood": "",
|
||||
"timestamp": "",
|
||||
}
|
||||
|
||||
# Persona Dialogue System (conversations between Miku and Evil Miku)
|
||||
LAST_PERSONA_DIALOGUE_TIME = 0 # Timestamp of last dialogue for cooldown
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user