Compare commits

...

6 Commits

Author SHA1 Message Date
f0b5d71097 feat: add loading spinners on tab switch for data-driven tabs
Show a CSS spinner overlay when switching to Autonomous Stats (tab6),
Memories (tab9), and DM Management (tab10). Spinner only shows on
first visit when content is empty, removed after data loads.
2026-03-01 00:29:03 +02:00
0cdf26dc34 feat: populate all mood dropdowns dynamically from API
Replace hardcoded <option> lists in #mood (tab1 DM mood) and
#chat-mood-select (tab7 chat mood) with empty selects populated
by populateMoodDropdowns(). Respects evil mode emoji mapping.
Called on DOMContentLoaded and after server cards render.
2026-03-01 00:28:07 +02:00
1037d13b0a 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)
2026-03-01 00:26:22 +02:00
5bdd907730 refactor: standardize raw fetch() calls to use apiCall() wrapper
Convert 47 raw fetch+response.json+error-handling patterns to use the
centralized apiCall() utility. The 11 remaining raw fetch() calls are
FormData uploads or SSE streaming that require direct fetch access.
2026-03-01 00:14:08 +02:00
820a226dd9 refactor: consolidate 3 DOMContentLoaded listeners into single init block
- Extract initTabState, initTabWheelScroll, initVisibilityPolling,
  initChatImagePreview, initModalAccessibility as named functions
- Move polling interval vars to outer scope for accessibility
- Single DOMContentLoaded calls all init functions in logical order
- Replace scattered listeners with comment markers at original locations
2026-02-28 23:50:40 +02:00
e0dc190710 feat: add responsive CSS breakpoints for mobile and tablet support
- 1200px: Adjust panel widths to 55/45
- 1024px: Stack panels vertically, logs below main content
- 768px: Tab buttons flow into auto-fill grid rows
- 480px: Two-column tab grid, reduced padding for small screens
2026-02-28 23:48:23 +02:00
4 changed files with 486 additions and 549 deletions

View File

@@ -201,6 +201,14 @@ def get_logs():
def get_last_prompt(): def get_last_prompt():
return {"prompt": globals.LAST_FULL_PROMPT or "No prompt has been issued yet."} 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") @app.get("/mood")
def get_current_mood(): def get_current_mood():
return {"mood": globals.DM_MOOD, "description": globals.DM_MOOD_DESCRIPTION} return {"mood": globals.DM_MOOD, "description": globals.DM_MOOD_DESCRIPTION}

View File

@@ -99,9 +99,12 @@ async def on_ready():
intercept_external_loggers() intercept_external_loggers()
# Restore evil mode state from previous session (if any) # 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_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) # Restore bipolar mode state from previous session (if any)
from utils.bipolar_mode import restore_bipolar_mode_on_startup from utils.bipolar_mode import restore_bipolar_mode_on_startup
restore_bipolar_mode_on_startup() restore_bipolar_mode_on_startup()
@@ -549,6 +552,14 @@ async def on_message(message):
) )
if response: if response:
logger.info(f"🐱 Cat embed response for {author_name}") 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: except Exception as e:
logger.warning(f"🐱 Cat embed error, fallback: {e}") logger.warning(f"🐱 Cat embed error, fallback: {e}")
response = None response = None
@@ -637,7 +648,19 @@ async def on_message(message):
response_type=response_type, response_type=response_type,
) )
if response: 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: except Exception as e:
logger.warning(f"🐱 Cat pipeline error, falling back to query_llama: {e}") logger.warning(f"🐱 Cat pipeline error, falling back to query_llama: {e}")
response = None response = None

View File

@@ -68,7 +68,7 @@ AVAILABLE_MOODS = [
EVIL_MODE = False EVIL_MODE = False
EVIL_DM_MOOD = "evil_neutral" EVIL_DM_MOOD = "evil_neutral"
EVIL_DM_MOOD_DESCRIPTION = "Evil Miku is calculating and cold." 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 # EVIL_MOOD_EMOJIS removed — canonical source is utils/moods.py
# Bipolar Mode System (both Mikus can argue via webhooks) # Bipolar Mode System (both Mikus can argue via webhooks)
@@ -83,6 +83,15 @@ BOT_USER = None
LAST_FULL_PROMPT = "" 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) # Persona Dialogue System (conversations between Miku and Evil Miku)
LAST_PERSONA_DIALOGUE_TIME = 0 # Timestamp of last dialogue for cooldown LAST_PERSONA_DIALOGUE_TIME = 0 # Timestamp of last dialogue for cooldown

File diff suppressed because it is too large Load Diff