fix #I7220J [app_chatgpt]只对指定用户开放等校验功能,改到get_ai_pre中处理

This commit is contained in:
Chill
2023-05-15 15:42:24 +08:00
parent 3dbfd1b527
commit 16a2ddcd58
2 changed files with 19 additions and 10 deletions

View File

@@ -117,6 +117,14 @@ GPT-3 A set of models that can understand and generate natural language
if sensi is not None:
_logger.error('==========敏感词:%s' % sensi['Keyword'])
return _('温馨提示:您发送的内容含有敏感词,请修改内容后再向我发送。')
elif not author_id.gpt_id and answer_id.gpt_id:
user_id = answer_id.user_ids[:1]
gpt_policy = user_id.gpt_policy
gpt_wl_partners = user_id.gpt_wl_partners
is_allow = author_id.id in gpt_wl_partners.ids
if gpt_policy != 'all' and not is_allow:
# 暂时有限用户的Ai
return _('此Ai暂时未开放请联系管理员。')
else:
return False