perf: 可以设置回复时不加前缀 #29

This commit is contained in:
Rock Chin 2022-12-14 21:49:26 +08:00
parent ae8b0658c3
commit f554ae86ac
2 changed files with 5 additions and 1 deletions

View File

@ -23,6 +23,9 @@ openai_config = {
# 管理员QQ号用于接收报错等通知为0时不发送通知
admin_qq = 0
# 回复消息时是否显示[GPT]前缀
show_prefix = False
# 敏感词过滤开关,以同样数量的*代替敏感词回复
# 请在sensitive.json中添加敏感词
sensitive_word_filter = True

View File

@ -175,7 +175,8 @@ class QQBotManager:
session = pkg.openai.session.get_session(session_name)
try:
reply = "[GPT]" + session.append(text_message)
prefix = "[GPT]" if hasattr(config, "show_prefix") and config.show_prefix else ""
reply = prefix + session.append(text_message)
except openai.error.APIConnectionError as e:
self.notify_admin("{}会话调用API失败:{}".format(session_name, e))
reply = "[bot]err:调用API失败请联系作者或等待修复"