From 25220e92a8df748db6a4f2b702d7bcaae05a3441 Mon Sep 17 00:00:00 2001 From: SengokuCola <1026294844@qq.com> Date: Tue, 28 Apr 2026 17:49:36 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E4=BA=BA=E8=AE=BE=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E6=9B=B4=E6=94=B9=EF=BC=8C=E4=B8=8D=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E4=BB=A5=E2=80=9C=E6=98=AF=E2=80=9D=E5=BC=80=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat/replyer/maisaka_generator_base.py | 8 +++++--- src/config/config.py | 2 +- src/config/official_configs.py | 4 ++-- src/maisaka/chat_loop_service.py | 10 ++++++---- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/chat/replyer/maisaka_generator_base.py b/src/chat/replyer/maisaka_generator_base.py index e6a16733..168928bf 100644 --- a/src/chat/replyer/maisaka_generator_base.py +++ b/src/chat/replyer/maisaka_generator_base.py @@ -93,12 +93,14 @@ class BaseMaisakaReplyGenerator: alias_names = global_config.bot.alias_names 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: logger.warning(f"构建 Maisaka 人设提示词失败: {exc}") - return "你的名字是麦麦,你是一个活泼可爱的 AI 助手。" + return "你的名字是麦麦。\n是人类。" @staticmethod def _normalize_content(content: str, limit: int = 500) -> str: diff --git a/src/config/config.py b/src/config/config.py index 36eac1a9..252b4a05 100644 --- a/src/config/config.py +++ b/src/config/config.py @@ -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() LEGACY_ENV_PATH: Path = (PROJECT_ROOT / ".env").resolve().absolute() 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" logger = get_logger("config") diff --git a/src/config/official_configs.py b/src/config/official_configs.py index 00c122eb..ec181cbe 100644 --- a/src/config/official_configs.py +++ b/src/config/official_configs.py @@ -75,13 +75,13 @@ class PersonalityConfig(ConfigBase): __ui_icon__ = "user-circle" personality: str = Field( - default="是一个大二女大学生,现在正在上网和群友聊天。", + default="你是一个大二女大学生,现在正在上网和群友聊天。", json_schema_extra={ "x-widget": "textarea", "x-icon": "user-circle", }, ) - """人格,建议100字以内,描述人格特质和身份特征""" + """人格,建议200字以内,描述人格特质和身份特征;可以写完整设定。要求第二人称""" reply_style: str = Field( default="你的风格平淡简短。可以参考贴吧,知乎和微博的回复风格。不浮夸不长篇大论,不要过分修辞和复杂句。尽量回复的简短一些,平淡一些", diff --git a/src/maisaka/chat_loop_service.py b/src/maisaka/chat_loop_service.py index 358b3231..81d66129 100644 --- a/src/maisaka/chat_loop_service.py +++ b/src/maisaka/chat_loop_service.py @@ -282,15 +282,17 @@ class MaisakaChatLoopService: try: bot_name = global_config.bot.nickname 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: 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: - return "Your name is MaiMai; persona: lively and cute AI assistant." + return "你的名字是麦麦。\n是人类。" async def ensure_chat_prompt_loaded(self, tools_section: str = "") -> None: """确保主聊天提示词已经加载完成。