From b4737c1ae1995e9c7a2ca2bebc9bb36c07ab8670 Mon Sep 17 00:00:00 2001 From: koko210Serve Date: Wed, 20 May 2026 13:55:05 +0300 Subject: [PATCH] fix(cat): use configured models instead of hardcoded strings - switch_to_evil_personality now reads EVIL_TEXT_MODEL from globals - switch_to_normal_personality now reads TEXT_MODEL from globals - Removes desync risk when user changes models via Web UI --- bot/utils/cat_client.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bot/utils/cat_client.py b/bot/utils/cat_client.py index 5cb5253..b22a65e 100644 --- a/bot/utils/cat_client.py +++ b/bot/utils/cat_client.py @@ -829,15 +829,16 @@ class CatAdapter: else: logger.debug("evil_miku_personality already active, skipping toggle") - # Step 3: Switch LLM model to darkidol (the uncensored evil model) - if not await self.set_llm_model("darkidol"): - logger.error("Failed to switch Cat LLM to darkidol") + # Step 3: Switch LLM model to the configured evil model (e.g. darkidol) + evil_model = getattr(globals, "EVIL_TEXT_MODEL", "darkidol") + if not await self.set_llm_model(evil_model): + logger.error(f"Failed to switch Cat LLM to {evil_model}") success = False return success async def switch_to_normal_personality(self) -> bool: - """Disable evil_miku_personality, enable miku_personality, switch LLM to llama3.1. + """Disable evil_miku_personality, enable miku_personality, switch LLM to the configured normal model. Checks current plugin state first to avoid double-toggling. Returns True if all operations succeed, False if any fail. @@ -865,9 +866,10 @@ class CatAdapter: else: logger.debug("miku_personality already active, skipping toggle") - # Step 3: Switch LLM model back to llama3.1 (normal model) - if not await self.set_llm_model("llama3.1"): - logger.error("Failed to switch Cat LLM to llama3.1") + # Step 3: Switch LLM model to the configured normal model (e.g. llama3.1) + normal_model = getattr(globals, "TEXT_MODEL", "llama3.1") + if not await self.set_llm_model(normal_model): + logger.error(f"Failed to switch Cat LLM to {normal_model}") success = False return success