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
This commit is contained in:
@@ -829,15 +829,16 @@ class CatAdapter:
|
|||||||
else:
|
else:
|
||||||
logger.debug("evil_miku_personality already active, skipping toggle")
|
logger.debug("evil_miku_personality already active, skipping toggle")
|
||||||
|
|
||||||
# Step 3: Switch LLM model to darkidol (the uncensored evil model)
|
# Step 3: Switch LLM model to the configured evil model (e.g. darkidol)
|
||||||
if not await self.set_llm_model("darkidol"):
|
evil_model = getattr(globals, "EVIL_TEXT_MODEL", "darkidol")
|
||||||
logger.error("Failed to switch Cat LLM to darkidol")
|
if not await self.set_llm_model(evil_model):
|
||||||
|
logger.error(f"Failed to switch Cat LLM to {evil_model}")
|
||||||
success = False
|
success = False
|
||||||
|
|
||||||
return success
|
return success
|
||||||
|
|
||||||
async def switch_to_normal_personality(self) -> bool:
|
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.
|
Checks current plugin state first to avoid double-toggling.
|
||||||
Returns True if all operations succeed, False if any fail.
|
Returns True if all operations succeed, False if any fail.
|
||||||
@@ -865,9 +866,10 @@ class CatAdapter:
|
|||||||
else:
|
else:
|
||||||
logger.debug("miku_personality already active, skipping toggle")
|
logger.debug("miku_personality already active, skipping toggle")
|
||||||
|
|
||||||
# Step 3: Switch LLM model back to llama3.1 (normal model)
|
# Step 3: Switch LLM model to the configured normal model (e.g. llama3.1)
|
||||||
if not await self.set_llm_model("llama3.1"):
|
normal_model = getattr(globals, "TEXT_MODEL", "llama3.1")
|
||||||
logger.error("Failed to switch Cat LLM to llama3.1")
|
if not await self.set_llm_model(normal_model):
|
||||||
|
logger.error(f"Failed to switch Cat LLM to {normal_model}")
|
||||||
success = False
|
success = False
|
||||||
|
|
||||||
return success
|
return success
|
||||||
|
|||||||
Reference in New Issue
Block a user