Skip to content

Commit

Permalink
Update dialog.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Y1ran authored Dec 8, 2022
1 parent 8719d6a commit d5e0f25
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def __init__(self):
self.data = None
self.hold = None
self.persona = None
self.statement = "你好~在聊天前需要声明:\n1.当前对话不涉及任何隐私信息,双方共同确认对话的可公开性,\n" \
self.statement = "你好~在使用此AI前需要声明
"\n1.当前对话不涉及任何隐私信息,双方共同确认对话的可公开性,\n" \
"2.对话过程中请勿讨论敏感话题,否则需自行承担不当言论可能造成的法律风险。\n" \
"3.如不接受请即刻停止对话,继续对话将被视为完全理解并接受上述声明。"
self.memory_len = 2 << 5
Expand Down Expand Up @@ -212,6 +213,12 @@ def dialog_core(self, text, usr_id) -> Any:
f.write(reply + "\n")
return reply

def combine_multi_dialog(self) -> boolean:
"""
部分功能还在调试,暂不开源
"""
return

async def on_message(self, msg: Message):
"""
Message Handler for the Bot
Expand Down Expand Up @@ -245,6 +252,9 @@ async def on_message(self, msg: Message):
if text in self.hold or text[1:] in self.hold:
return

#根据时间窗口将多轮对话合并成一句
self.combine_multi_dialog()

text = text.replace(r'\s', ",").replace("#", "号").replace("&", "和")
# bad_detection_result = self.bad_detection.detection(texts=[text], use_gpu=True, batch_size=1)
#
Expand Down

0 comments on commit d5e0f25

Please sign in to comment.