From 21e6f7bba19932abe15ed04d715ea7bb18fff3b7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 21 Jun 2025 08:01:54 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20=E8=87=AA=E5=8A=A8=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=E4=BB=A3=E7=A0=81=20[skip=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../info_processors/relationship_processor.py | 44 ++++++++++++++++--- src/plugins/built_in/core_actions/plugin.py | 6 ++- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/chat/focus_chat/info_processors/relationship_processor.py b/src/chat/focus_chat/info_processors/relationship_processor.py index f0c7811e2..0f5505701 100644 --- a/src/chat/focus_chat/info_processors/relationship_processor.py +++ b/src/chat/focus_chat/info_processors/relationship_processor.py @@ -40,10 +40,40 @@ SEGMENT_CLEANUP_CONFIG = { # 用于随机生成prompt示例的资源池 USER_EXAMPLE_KEYS = ["用户A", "小明", "Alice", "陈皮", "老王", "Bob", "张三", "李四"] USER_EXAMPLE_VALUES = [ - "ta的昵称", "ta对你的态度", "你对ta的印象", "ta最近心情如何", - "你们的关系", "ta的身份", "ta的兴趣爱好", "ta和你的共同点", "ta的习惯","你们最近做的事","你对ta的语气","你们的互动方式","给你的第一印象","你们最近聊过什么" + "ta的昵称", + "ta对你的态度", + "你对ta的印象", + "ta最近心情如何", + "你们的关系", + "ta的身份", + "ta的兴趣爱好", + "ta和你的共同点", + "ta的习惯", + "你们最近做的事", + "你对ta的语气", + "你们的互动方式", + "给你的第一印象", + "你们最近聊过什么", +] +BOT_EXAMPLE_VALUES = [ + "身份", + "性格", + "你的原则", + "你的知识", + "你的目标", + "你的爱好", + "你最近在做什么", + "头像", + "年龄", + "性别", + "职业", + "兴趣爱好", + "习惯", + "目标", + "原则", + "知识", + "爱好", ] -BOT_EXAMPLE_VALUES = ["身份", "性格", "你的原则", "你的知识", "你的目标", "你的爱好", "你最近在做什么","头像","年龄","性别","职业","兴趣爱好","习惯","目标","原则","知识","爱好"] logger = get_logger("processor") @@ -51,10 +81,10 @@ logger = get_logger("processor") def _generate_random_prompt_example() -> str: """动态生成一个随机的、符合规则的JSON示例字符串""" - + bot_nickname = global_config.bot.nickname bot_aliases = list(global_config.bot.alias_names) - + # 确定示例数量 num_user_examples = random.randint(1, 2) num_bot_examples = random.randint(1, 2) @@ -71,7 +101,7 @@ def _generate_random_prompt_example() -> str: bot_name_pool = [bot_nickname] + bot_aliases random.shuffle(bot_name_pool) bot_values = random.sample(BOT_EXAMPLE_VALUES, min(num_bot_examples, len(BOT_EXAMPLE_VALUES))) - + for i in range(min(num_bot_examples, len(bot_name_pool), len(bot_values))): example_dict[bot_name_pool[i]] = bot_values[i] @@ -82,7 +112,7 @@ def _generate_random_prompt_example() -> str: items = list(example_dict.items()) random.shuffle(items) shuffled_dict = dict(items) - + return json.dumps(shuffled_dict, ensure_ascii=False, indent=4) diff --git a/src/plugins/built_in/core_actions/plugin.py b/src/plugins/built_in/core_actions/plugin.py index f4f9187e5..1ada97f3e 100644 --- a/src/plugins/built_in/core_actions/plugin.py +++ b/src/plugins/built_in/core_actions/plugin.py @@ -38,8 +38,10 @@ class ReplyAction(BaseAction): action_description = "参与聊天回复,发送文本进行表达" # 动作参数定义 - action_parameters = {"reply_to": "你要回复的对方的发言内容,格式:(用户名:发言内容),可以为none", - "reason": "回复的原因"} + action_parameters = { + "reply_to": "你要回复的对方的发言内容,格式:(用户名:发言内容),可以为none", + "reason": "回复的原因", + } # 动作使用场景 action_require = ["你想要闲聊或者随便附和", "有人提到你", "如果你刚刚进行了回复,不要对同一个话题重复回应"]