diff --git a/src/plugins/chat_module/reasoning_chat/reasoning_prompt_builder.py b/src/plugins/chat_module/reasoning_chat/reasoning_prompt_builder.py index 045045bae..75a876a9c 100644 --- a/src/plugins/chat_module/reasoning_chat/reasoning_prompt_builder.py +++ b/src/plugins/chat_module/reasoning_chat/reasoning_prompt_builder.py @@ -115,17 +115,18 @@ class PromptBuilder: f"检测到以下关键词之一:{rule.get('keywords', [])},触发反应:{rule.get('reaction', '')}" ) keywords_reaction_prompt += rule.get("reaction", "") + "," - for pattern in rule.get("regex", []): - result = pattern.search(message_txt) - if result: - reaction = rule.get('reaction', '') - for name, content in result.groupdict().items(): - reaction = reaction.replace(f'[{name}]', content) - logger.info( - f"匹配到以下正则表达式:{pattern},触发反应:{reaction}" - ) - keywords_reaction_prompt += reaction + "," - break + else: + for pattern in rule.get("regex", []): + result = pattern.search(message_txt) + if result: + reaction = rule.get('reaction', '') + for name, content in result.groupdict().items(): + reaction = reaction.replace(f'[{name}]', content) + logger.info( + f"匹配到以下正则表达式:{pattern},触发反应:{reaction}" + ) + keywords_reaction_prompt += reaction + "," + break # 中文高手(新加的好玩功能) prompt_ger = "" diff --git a/src/plugins/chat_module/think_flow_chat/think_flow_prompt_builder.py b/src/plugins/chat_module/think_flow_chat/think_flow_prompt_builder.py index 8938e2e78..7ae7940bb 100644 --- a/src/plugins/chat_module/think_flow_chat/think_flow_prompt_builder.py +++ b/src/plugins/chat_module/think_flow_chat/think_flow_prompt_builder.py @@ -61,17 +61,18 @@ class PromptBuilder: f"检测到以下关键词之一:{rule.get('keywords', [])},触发反应:{rule.get('reaction', '')}" ) keywords_reaction_prompt += rule.get("reaction", "") + "," - for pattern in rule.get("regex", []): - result = pattern.search(message_txt) - if result: - reaction = rule.get('reaction', '') - for name, content in result.groupdict().items(): - reaction = reaction.replace(f'[{name}]', content) - logger.info( - f"匹配到以下正则表达式:{pattern},触发反应:{reaction}" - ) - keywords_reaction_prompt += reaction + "," - break + else: + for pattern in rule.get("regex", []): + result = pattern.search(message_txt) + if result: + reaction = rule.get('reaction', '') + for name, content in result.groupdict().items(): + reaction = reaction.replace(f'[{name}]', content) + logger.info( + f"匹配到以下正则表达式:{pattern},触发反应:{reaction}" + ) + keywords_reaction_prompt += reaction + "," + break # 中文高手(新加的好玩功能) prompt_ger = ""