删除一部分注释和调试信息

This commit is contained in:
chordfish
2023-03-09 21:20:59 +08:00
parent 453952859e
commit 7288d3cb15
2 changed files with 13 additions and 11 deletions

View File

@@ -89,7 +89,7 @@ preset_mode = "default"
# 过滤AI脱离人设的消息
# 这类消息在对应情景json中设置将其替换为自定义消息以保持人格
# filter_ai_warning = False
filter_ai_warning = False
# 群内响应规则
# 符合此消息的群内消息即使不包含at机器人也会响应

View File

@@ -256,17 +256,19 @@ class Session:
del (res_ans_spt[0])
res_ans = '\n\n'.join(res_ans_spt)
# 检测是否包含ai人格否定
# logging.debug('bot_filter: {}'.format(self.bot_filter))
# if config.filter_ai_warning and self.bot_filter:
# import re
# match = re.search(self.bot_filter['reg'], res_ans)
# logging.debug(self.bot_filter)
# logging.debug(res_ans)
# if match:
# logging.debug('回复:{} 检测到人格否定,替换中。。'.format(res_ans))
# res_ans = self.bot_filter['replace']
# logging.debug('替换为: {}'.format(res_ans))
logging.debug('bot_filter: {}'.format(self.bot_filter))
if config.filter_ai_warning and self.bot_filter:
import re
match = re.search(self.bot_filter['reg'], res_ans)
logging.debug(self.bot_filter)
logging.debug(res_ans)
if match:
logging.debug('回复:{} 检测到人格否定,替换中。。'.format(res_ans))
res_ans = self.bot_filter['replace']
logging.debug('替换为: {}'.format(res_ans))
# 将此次对话的双方内容加入到prompt中
self.prompt.append({'role': 'user', 'content': text})