feat:人设结构更改,不需要以“是”开头

This commit is contained in:
SengokuCola
2026-04-28 17:49:36 +08:00
parent 742e21a727
commit 25220e92a8
4 changed files with 14 additions and 10 deletions

View File

@@ -93,12 +93,14 @@ class BaseMaisakaReplyGenerator:
alias_names = global_config.bot.alias_names alias_names = global_config.bot.alias_names
bot_aliases = f",也有人叫你{','.join(alias_names)}" if alias_names else "" bot_aliases = f",也有人叫你{','.join(alias_names)}" if alias_names else ""
prompt_personality = global_config.personality.personality prompt_personality = global_config.personality.personality.strip()
if not prompt_personality:
prompt_personality = "是人类。"
return f"你的名字是{bot_name}{bot_aliases},你{prompt_personality};" return f"你的名字是{bot_name}{bot_aliases}\n{prompt_personality}"
except Exception as exc: except Exception as exc:
logger.warning(f"构建 Maisaka 人设提示词失败: {exc}") logger.warning(f"构建 Maisaka 人设提示词失败: {exc}")
return "你的名字是麦麦,你是一个活泼可爱的 AI 助手" return "你的名字是麦麦\n是人类"
@staticmethod @staticmethod
def _normalize_content(content: str, limit: int = 500) -> str: def _normalize_content(content: str, limit: int = 500) -> str:

View File

@@ -56,7 +56,7 @@ BOT_CONFIG_PATH: Path = (CONFIG_DIR / "bot_config.toml").resolve().absolute()
MODEL_CONFIG_PATH: Path = (CONFIG_DIR / "model_config.toml").resolve().absolute() MODEL_CONFIG_PATH: Path = (CONFIG_DIR / "model_config.toml").resolve().absolute()
LEGACY_ENV_PATH: Path = (PROJECT_ROOT / ".env").resolve().absolute() LEGACY_ENV_PATH: Path = (PROJECT_ROOT / ".env").resolve().absolute()
MMC_VERSION: str = "1.0.0" MMC_VERSION: str = "1.0.0"
CONFIG_VERSION: str = "8.9.18" CONFIG_VERSION: str = "8.9.19"
MODEL_CONFIG_VERSION: str = "1.14.3" MODEL_CONFIG_VERSION: str = "1.14.3"
logger = get_logger("config") logger = get_logger("config")

View File

@@ -75,13 +75,13 @@ class PersonalityConfig(ConfigBase):
__ui_icon__ = "user-circle" __ui_icon__ = "user-circle"
personality: str = Field( personality: str = Field(
default="是一个大二女大学生,现在正在上网和群友聊天。", default="是一个大二女大学生,现在正在上网和群友聊天。",
json_schema_extra={ json_schema_extra={
"x-widget": "textarea", "x-widget": "textarea",
"x-icon": "user-circle", "x-icon": "user-circle",
}, },
) )
"""人格,建议100字以内描述人格特质和身份特征""" """人格,建议200字以内描述人格特质和身份特征;可以写完整设定。要求第二人称"""
reply_style: str = Field( reply_style: str = Field(
default="你的风格平淡简短。可以参考贴吧,知乎和微博的回复风格。不浮夸不长篇大论,不要过分修辞和复杂句。尽量回复的简短一些,平淡一些", default="你的风格平淡简短。可以参考贴吧,知乎和微博的回复风格。不浮夸不长篇大论,不要过分修辞和复杂句。尽量回复的简短一些,平淡一些",

View File

@@ -282,15 +282,17 @@ class MaisakaChatLoopService:
try: try:
bot_name = global_config.bot.nickname bot_name = global_config.bot.nickname
if global_config.bot.alias_names: if global_config.bot.alias_names:
bot_nickname = f", also known as {','.join(global_config.bot.alias_names)}" bot_nickname = f",也有人叫你{','.join(global_config.bot.alias_names)}"
else: else:
bot_nickname = "" bot_nickname = ""
prompt_personality = global_config.personality.personality prompt_personality = global_config.personality.personality.strip()
if not prompt_personality:
prompt_personality = "是人类。"
return f"Your name is {bot_name}{bot_nickname}; persona: {prompt_personality};" return f"你的名字是{bot_name}{bot_nickname}\n{prompt_personality}"
except Exception: except Exception:
return "Your name is MaiMai; persona: lively and cute AI assistant." return "你的名字是麦麦。\n是人类。"
async def ensure_chat_prompt_loaded(self, tools_section: str = "") -> None: async def ensure_chat_prompt_loaded(self, tools_section: str = "") -> None:
"""确保主聊天提示词已经加载完成。 """确保主聊天提示词已经加载完成。