adjust:整理代码,仅添加json方式的prompt读取

This commit is contained in:
chordfish
2023-03-10 10:13:40 +08:00
parent 7477c7c67f
commit ac65d81ba1
4 changed files with 39 additions and 74 deletions
+1 -9
View File
@@ -27,15 +27,7 @@ def check_response_rule(text: str, event):
config = pkg.utils.context.get_config()
if not hasattr(config, 'response_rules'):
return False, ''
bot_name = pkg.openai.session.get_session('group_{}'.format(event.group.id)).bot_name
logging.debug(bot_name)
# 检查情景json自带的名字
if bot_name:
import re
if re.search(bot_name, text):
return True, text
rules = config.response_rules
# 检查前缀匹配
if 'prefix' in rules: