diff --git a/bot/utils/bipolar_mode.py b/bot/utils/bipolar_mode.py index adca3d9..d59c49c 100644 --- a/bot/utils/bipolar_mode.py +++ b/bot/utils/bipolar_mode.py @@ -652,71 +652,6 @@ def get_evil_role_color() -> str: # ARGUMENT PROMPTS # ============================================================================ -# Personality snippet cache — loaded once per session from Cat plugin data files. -# These give each persona unique lore/lyrics to draw from during arguments. -_PERSONALITY_SNIPPETS_CACHE = {"miku": None, "evil": None} - -def _load_personality_snippets(persona: str) -> str: - """Load a random personality snippet (lore/lyrics) for a persona. - - Returns a short string (1-3 sentences) from the persona's Cat data files, - or empty string if files aren't available. Cached per session. - """ - if _PERSONALITY_SNIPPETS_CACHE.get(persona) is not None: - snippets = _PERSONALITY_SNIPPETS_CACHE[persona] - if snippets: - return random.choice(snippets) - return "" - - snippets = [] - try: - if persona == "evil": - paths = [ - "/app/cat/data/evil/evil_miku_lore.txt", - "/app/cat/data/evil/evil_miku_lyrics.txt", - ] - else: - paths = [ - "/app/cat/data/miku/miku_lore.txt", - "/app/cat/data/miku/miku_lyrics.txt", - ] - - for path in paths: - if os.path.exists(path): - with open(path, "r", encoding="utf-8") as f: - text = f.read() - # Split into sentences and collect meaningful ones - import re - sentences = re.split(r'(?<=[.!?])\s+', text) - for s in sentences: - s = s.strip() - if len(s) > 30 and len(s) < 200: # Skip too short or too long - snippets.append(s) - - # Cap at 30 snippets to keep prompt size reasonable - _PERSONALITY_SNIPPETS_CACHE[persona] = snippets[:30] if snippets else [] - logger.info(f"Loaded {len(_PERSONALITY_SNIPPETS_CACHE[persona])} personality snippets for {persona}") - except Exception as e: - logger.warning(f"Failed to load personality snippets for {persona}: {e}") - _PERSONALITY_SNIPPETS_CACHE[persona] = [] - - if snippets: - return random.choice(snippets[:30]) - return "" - - -def _get_personality_flavor(persona: str) -> str: - """Get a random personality flavor snippet for argument prompts. - 40% chance to include one — keeps it fresh without being overwhelming. - """ - if random.random() > 0.4: - return "" - - snippet = _load_personality_snippets(persona) - if snippet: - return f"\nPERSONALITY FLAVOR: Remember this about yourself: \"{snippet}\"\nWeave this into your response naturally if it fits." - return "" - # Mood-specific behavioral guidance for argument prompts. # Each mood gives a different argument style. _MIKU_MOOD_ARGUMENT_GUIDANCE = { @@ -816,7 +751,6 @@ Do NOT drift into generic "who's the real Miku" territory — stick to THIS spec {topic_block} {_get_mood_argument_guidance('miku')} -{_get_personality_flavor('miku')} IMPORTANT: Keep your response SHORT and PUNCHY - 1-3 sentences maximum. Make every word count. In arguments, brevity hits harder than long explanations. Be conversational and impactful. @@ -880,7 +814,6 @@ Do NOT drift into generic "who's the real Miku" territory — stick to THIS spec {topic_block} {_get_mood_argument_guidance('evil')} -{_get_personality_flavor('evil')} IMPORTANT: Keep your response SHORT and CUTTING - 1-3 sentences maximum. A sharp dagger is deadlier than a dull sword. The most devastating blows are precise, not rambling. Make her feel it in fewer words.